Download the PHP package oyoun-media/academy-saml without Composer
On this page you can find all versions of the php package oyoun-media/academy-saml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download oyoun-media/academy-saml
More information about oyoun-media/academy-saml
Files in oyoun-media/academy-saml
Package academy-saml
Short Description Make your PHP Laravel application an Identification Provider using SAML 2.0. This package allows you to implement your own Identification Provider (idP) using the SAML 2.0 standard to be used with supporting SAML 2.0 Service Providers (SP).
License MIT
Informations about the package academy-saml
Buy me a coffee :coffee:
Laravel SAML IdP
This package allows you to implement your own Identification Provider (idP) using the SAML 2.0 standard to be used with supporting SAML 2.0 Service Providers (SP).
Starting in version ^5.1, Laravel 9 is supported. Starting in version ^5.2.4, Laravel 10 is supported.
In this version we will be allowing for Laravel ^7.0 or ^8.0.
If you are looking for Laravel ^5.6 see v1.0
If you are looking for Laravel ^6.0 use v2.0
Installation
Configuration
FileSystem configuration
Use the following command to create a self signed certificate for your IdP. If you change the certname or keyname to anything other than the default names, you will need to update your config/samlidp.php
config file to reflect those new file names.
Optionally, you can set the certificate and key using two environment variables: SAMLIDP_CERT
and SAMLIDP_KEY
.
Usage
Within your login view, probably resources/views/auth/login.blade.php
add the SAMLRequest directive beneath the CSRF directive:
The SAMLRequest directive will fill out the hidden input automatically when a SAMLRequest is sent by an HTTP request and therefore initiate a SAML authentication attempt. To initiate the SAML auth, the login and redirect processes need to be intervened. This is done using the Laravel events fired upon authentication.
Config
After you publish the config file, you will need to set up your Service Providers. The key for the Service Provider is a base 64 encoded Consumer Service (ACS) URL. You can get this information from your Service Provider, but you will need to base 64 encode the URL and place it in your config. This is due to config dot notation.
You may use this command to help generate a new SAML Service Provider:
Example SP in config/samlidp.php
file:
Setting the service provider certificate
There are three options to set the service provider certificate.
-
Provide the certificate as a string:
-
Load from a variable within the
.env
file. You can choose an appropriate variable name that best matches your projects requirements. - Load the certificate from a file:
Log out of IdP after SLO
If you wish to log out of the IdP after SLO has completed, set LOGOUT_AFTER_SLO
to true
in your .env
perform the logout action on the Idp.
Redirect to SLO initiator after logout
If you wish to return the user back to the SP by which SLO was initiated, you may provide an additional query parameter to the /saml/logout
route, for example:
After all SP's have been logged out of, the user will be redirected to mysp.com
. For this to work properly you need to add the sp_slo_redirects
option to your config/samlidp.php
config file, for example:
Attributes (optional)
Service providers may require more additional attributes to be sent via assertion. Its even possible that they require the same information but as a different Claim Type.
By Default this package will send the following Claim Types:
ClaimTypes::EMAIL_ADDRESS
as auth()->user()->email
ClaimTypes::GIVEN_NAME
as auth()->user()->name
This is because Laravel migrations, by default, only supply email and name fields that are usable by SAML 2.0.
To add additional Claim Types, you can subscribe to the Assertion event:
CodeGreenCreative\SamlIdp\Events\Assertion
Subscribing to the Event:
In your App\Providers\EventServiceProvider
class, add to the already existing $listen
property...
Sample Listener:
Digest Algorithm (optional)
See \RobRichards\XMLSecLibs\XMLSecurityDSig
for all digest options.
Buy me a coffee :coffee:
All versions of academy-saml with dependencies
illuminate/support Version ^7.0|^8.0|^9.0|^10.0
illuminate/routing Version ^7.0|^8.0|^9.0|^10.0
litesaml/lightsaml Version ^4.0