karolornoch/oneloginsaml-bundle
Symfony bundle integrating the OneLogin SAML toolkit, simplifying SAML 2.0 service provider setup for single sign-on. Provides bundle configuration and service wiring to add SAML authentication to Symfony applications.
This package is primarily a Symfony bundle wrapping onelogin/php-saml, so a Laravel developer picking it up should first confirm whether they want (a) the bundle via a Symfony/Laravel bridge, or (b) the underlying onelogin/php-saml toolkit directly. For most Laravel apps, the bundle is not the first stop — but it is the reference implementation for correct SP behavior and useful to read.
composer require karolornoch/onelogin-saml-bundle (v1.8.3 is a low-risk patch on top of 1.8.2).DependencyInjection/Configuration.php in the repo — it defines the full config schema (SP entity ID, ACS URL, IdP metadata, certificates, attribute mapping, security mode). The README's YAML examples map almost 1:1 to this schema.OneLogin\Saml2\Auth as a singleton and inject your config array, rather than pulling the bundle's Symfony DI container.email, name, groups) to your User model.AuthRequest from the Auth instance, redirect to the IdP ssoUrl. On callback, call $auth->processResponse() and check getErrors() before trusting getAttributes().SAMLResponse. Guard against replay by checking getLastRequestXML() and using the toolkit's LastRequestId tracking if you have a store (cache/db).SsoIdentity value object rather than mutating your User model directly — it makes multi-tenant / multi-IdP setups (which newer versions support) tractable./saml/logout route; invalidate both the Laravel session and the toolkit's session store./saml/metadata returning $auth->getSettings()->getSPMetadata() so IdP admins can import your SP configuration without hand-editing XML.OneLogin\Saml2\Auth behind an interface so feature tests can return a canned getAttributes() payload without needing a signed response.onelogin/php-saml directly, which is what most Laravel SAML wrappers ultimately call).-----END CERTIFICATE----- newline stripped — signature validation fails silently with a generic error.Signature validation failed when server time drifts more than the allowedClockDrift (default 60s). Verify NTP before chasing SAML logic bugs.security.requestsSigned = true and configure the IdP's signatureAlgorithm to sha256; leaving sha1 fails on newer Azure AD / Okta tenants.strict mode: Enable it in production (strict = true) so unsigned responses are rejected — but you will need the IdP cert loaded before it works, so don't flip the switch until cert config is verified.processResponse() fails, log getLastErrorReason() and the raw POSTed SAMLResponse (base64-decoded) — the toolkit's errors are often terse and don't identify which assertion field was wrong.onelogin/php-saml 3.x/4.x as the underlying dependency; watch upstream PHP-SAML releases for the real security surface rather than the bundle patch bumps.How can I help you explore Laravel packages today?