Download the PHP package kchinkesh/laravel-saml without Composer
On this page you can find all versions of the php package kchinkesh/laravel-saml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kchinkesh/laravel-saml
More information about kchinkesh/laravel-saml
Files in kchinkesh/laravel-saml
Package laravel-saml
Short Description A Laravel Package to Implement SAML based SSO Service Provider
License MIT
Informations about the package laravel-saml
Laravel - Saml
A Laravel package for Saml2 integration as a SP (service provider) based on OneLogin toolkit, which is much lighter and easier to install. It doesn't need separate routes or session storage to work!
The aim of this library is to be as simple as possible. We won't mess with Laravel users, auth, session... We prefer to limit ourselves to a concrete task. Ask the user to authenticate at the IDP and process the response. Same case for SLO requests.
Installation - Composer
You can install the package via composer:
Then publish the config files with
This will add the files app/config/samlidp_settings.php
, which you will need to customize.
Configure laravel-saml to know about IDP
Usage
When you want your user to login, just redirect to the login route configured for the particular IDP,
route('saml_login')
.
Just remember that it does not use any session storage, so if you ask it to login it will redirect to the IDP whether the user is already logged in or not. For example, you can change your authentication middleware.
After login is called, the user will be redirected to the IDP login page. Then the IDP, which you have configured with an endpoint the library serves, will call back. That will process the response and fire an event when ready. The next step for you is to handle that event. You just need to login the user or refuse.
Auth persistence
Be careful about necessary Laravel middleware for Auth persistence in Session. Add the saml middleware to middleware groups For exemple, it can be:
Log out
Now there are two ways the user can log out.
- 1 - By logging out in your app: In this case you 'should' notify the IDP first so it closes global session.
- 2 - By logging out of the global SSO Session. In this case the IDP will notify you on /idp/slo endpoint (already provided), if the IDP supports SLO
For case 1, initiate a logout by redirecting the user to the saml2_logout route (route('saml_logout')
). Do not close the session immediately as you need to receive a response confirmation from the IDP (redirection). That response will be handled by the library at the sls
route, and it will fire a SamlLogoutEvent
event that you can use to complete the logout in the same way as with case 2 below.
For case 2 you will only receive the event. Both cases 1 and 2 receive the same SamlLogoutEvent
event.
Note that for case 2, you may have to manually save your session to make the logout stick (as the session is saved by middleware, but the OneLogin library will redirect back to your IDP before that happens)
Note : This Packaged is an Updated Version on aacotroneo/laravel-saml2 which works with PHP 8.0
All versions of laravel-saml with dependencies
ext-openssl Version ^8.0
illuminate/support Version ^8.0
onelogin/php-saml Version ^4.0