Download the PHP package maize-tech/laravel-saml2-sp without Composer

On this page you can find all versions of the php package maize-tech/laravel-saml2-sp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-saml2-sp

Laravel SAML2 Service Provider

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

This package lets you add SAML2 authentication support within your application.

It acts as a SAML2 Service Provider (SP): it exposes the SP metadata, redirects users to your Identity Provider (IdP) for authentication, consumes the IdP assertion to log the user in, and handles single logout. Under the hood it wraps onelogin/php-saml and stores one or more SAML configurations in the database.

Installation

You can install the package via composer:

You can publish the config and migration files and run the migrations with:

This is the content of the published config file:

Usage

Minimum configuration

After publishing the config file, set at least the following keys in config/saml2-sp.php (or via your environment):

Both login_return_url and logout_return_url also accept a closure or the class name of an invokable class, so you can resolve the destination at runtime:

Creating a SAML configuration

SAML settings are stored in the database through the SamlConfig model. Each row holds the service provider (sp) and identity provider (idp) sections, merged at runtime with the default_values defined in the config file. The sp, idp, security, contactPerson and organization columns are transparently encrypted.

Routes

When routes.enabled is true (the default), the package registers the following routes under the configured prefix (saml2 by default) and middleware (web):

Method URI Name Description
GET saml2/metadata saml2.metadata Returns the SP metadata XML to share with your IdP.
GET saml2/login saml2.login Builds the authentication request and redirects to the IdP.
POST saml2/acs saml2.acs Assertion Consumer Service: consumes the IdP response and logs in.
GET saml2/logout saml2.logout Builds the logout request and redirects to the IdP.
GET/POST saml2/sls saml2.sls Single Logout Service: logs the user out and redirects back.

A typical flow looks like this:

  1. Share saml2/metadata with your Identity Provider.
  2. Send the user to saml2/login (optionally with a whitelisted ?return_url=). They are redirected to the IdP to authenticate.
  3. The IdP posts the assertion back to saml2/acs. The package validates it, resolves the matching user and logs them in, then redirects to the RelayState (if whitelisted) or to login_return_url.
  4. To log out, send the user to saml2/logout. After the IdP processes it, the saml2/sls endpoint logs the user out locally and redirects to logout_return_url.

You may disable the built-in routes (routes.enabled => false) and register your own pointing to the package controllers if you need full control.

Events

The package dispatches two events you can listen to:

Both expose the affected user via a public $user property:

Customizing the authentication logic

The default AuthenticateUser action looks up the user by matching its email column against the SAML nameId, then logs it in through the configured guard. The default LogoutUser action logs out the currently authenticated user.

You can replace either action with your own by pointing the config to a custom class:

A custom authenticate action receives the Maize\Saml2Sp\SamlUserData instance (name id, attributes and friendly-name attributes) and must return an Illuminate\Contracts\Auth\Authenticatable:

Resolving the configuration per request (multi-tenant)

By default the DefaultSamlConfigFinder returns the first SamlConfig row. If you serve several Identity Providers (e.g. one per tenant or domain), implement your own finder and register it in the config:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-saml2-sp with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/http Version ^11.0|^12.0|^13.0
illuminate/routing Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
onelogin/php-saml Version ^4.3
spatie/laravel-package-tools Version ^1.16
spatie/url Version ^2.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package maize-tech/laravel-saml2-sp contains the following files

Loading the files please wait ...