Socialite SAML2 Provider
SAML2 single sign-on provider for Laravel Socialite, backed by LightSAML.
Repository Health
Technical Analysis
Socialite SAML2 Provider adds enterprise SAML2 single sign-on to Laravel applications through the familiar Laravel Socialite API. Instead of writing raw SAML request/response handling, you configure an identity provider once and authenticate users with the same Socialite::driver() flow you already use for OAuth providers. It wraps the LightSAML library to build authentication requests, validate signed assertions, and map the returned attributes onto a Socialite user.
What You Get
- A
saml2Socialite driver that plugs into the standard redirect/callback authentication flow - Identity provider configuration via metadata URL, metadata XML, or a manual certificate and entity ID
- Automatic parsing and signature validation of SAML assertions, exposing the authenticated user’s attributes
Common Use Cases
- Letting enterprise customers log into your Laravel SaaS with their existing corporate SSO
- Integrating with identity providers such as Okta, OneLogin, or Azure AD that expose SAML metadata
- Replacing bespoke SAML handling with the same Socialite abstraction used for OAuth logins
Under The Hood
Architecture - The package registers a Saml2ExtendSocialite listener that adds the saml2 driver to the SocialiteProviders manager. The core Provider class extends Socialite’s AbstractProvider, building an AuthnRequest and redirecting to the IdP, then consuming the posted SAML Response on callback; certificate and endpoint data are loaded from a metadata URL, inline XML, or explicit config keys. Tech Stack - Written for PHP 8.0+, it depends on litesaml/lightsaml (^4.0) for SAML message construction and validation and socialiteproviders/manager (^4.4) to register the driver. It ships as a Composer subtree split of the SocialiteProviders monorepo. Code Quality - The provider is a focused set of classes (Provider, User, exception types, attribute-URI constants) with clear responsibilities; there is no bundled test suite in this split, and correctness leans on LightSAML’s assertion validation. API Design - Configuration mirrors every other Socialite provider: add a services.saml2 entry and call Socialite::driver('saml2'), keeping SAML complexity behind a one-line integration.