A laravel package for SAML 2.0 Service Provider (SP) authentication
philwilliammee/samlserviceprovider is a Laravel package for a laravel package for saml 2.0 service provider (sp) authentication.
It currently has 0 GitHub stars and 2 downloads on Packagist.
Install it with composer require philwilliammee/samlserviceprovider.
Discover more Laravel packages by philwilliammee
or browse all Laravel packages to compare alternatives.
Last updated
SAML2.0 Service Provider Laravel Package, use this package to log into a IDP with SAML2.0. Please feel free to contribute to this package. This package has had minimal testing, and provides no security guarantees. Use at your own risk.
Via Composer
composer require philwilliammee/samlserviceprovider
Run the migrations
php artisan migrate
Publish Config and Views with
php artisan vendor:publish --provider="PhilWilliammee\SamlServiceProvider\SamlServiceProviderServiceProvider"
Edit the config file in config/samlserviceprovider.php to your liking.
This package comes with some blade templates that you can use to get you started. You can review them in resources/views/vendor/philwilliammee
example usage:
<x-samlserviceprovider::login redirect="/user">
Login
</x-samlserviceprovider::login>
<x-samlserviceprovider::logout>
Logout
</x-samlserviceprovider::logout>
then in the user controller call:
$session_id = session()->getId();
$user_attributes = SamlServiceProvider::getAttributes($session_id);
You will then probably want to login the user with Laravel, something like this:
$email = $user_attributes['mail'][0];
$name = $user_attributes['displayName'][0];
$user = User::where('email', $email)->first();
if (!$user) {
$user = User::create([
'email' => $email,
'name' => $name,
]);
}
Auth::login($user);
Please see the changelog for more information on what has changed recently.
composer test
Please see contributing.md for details and a todolist.
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
MIT. Please see the license file for more information.