mdspeirs / laravel-sso-provider
Provides custom SSO integration to Laravel 5 applications.
dev-master
2019-07-02 01:31 UTC
Requires (Dev)
- php: 5.6.*
- phpunit/phpunit: 5.6.*
This package is auto-updated.
Last update: 2025-05-29 01:32:55 UTC
README
Provides custom SSO integration to Laravel 5 applications.
Where do I start?
1. Require the mdspeirs/laravel-sso-provider
package.
composer require mdspeirs/laravel-sso-provider
2. Use the library in your authentication controller.
use MDSpeirs\SSOProvider\Helpers\SSOHelper; $sso = SSOHelper::login(); if ($sso->valid() && $sso->isStaffMember) { // Assumes you have a method defined elsewhere which returns an existing User object. $thisUser = findUserByStaffNumber($sso->staffNumber); if ($thisUser == null) { // We could not find user so lets create them. $thisUser = new User; $thisUser->staff_number = $sso->staffNumber; } // Keep name and email up to date with SSO data for new and existing users. $thisUser->full_name = $sso->fullName; $thisUser->email = $sso->email; // Save any changes made to the user. $thisUser->save(); if ($thisUser != null) { // Finish the login using Laravel's Auth facade. Auth::login($thisUser, false); } }
Testing
See https://travis-ci.com/michaelspeirs/laravel-sso-provider for CI results, run on each commit.
Unit Testing
composer run test
Releasing
Releases are automatically deployed to Packagist from Github.
Created Down Under by Daniel Tedman & Michael Speirs