1. Go to this page and download the library: Download postiefs/laravel-sso library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
postiefs / laravel-sso example snippets
Route::middleware(['web', 'sso'])->group(...); // guests go to the portal
Route::middleware(['web', 'auth', 'sso.session'])->...; // keep your own login, add the portal's rules
use Postiefs\Sso\Facades\Sso;
Sso::active(); // signed in through the portal (false for a local login)
Sso::secondsRemaining();
Sso::hasRole('editor'); // the portal's `admin` role always passes
Sso::groups(); Sso::department();
class AppUserResolver extends \Postiefs\Sso\Support\DefaultUserResolver
{
protected function isAllowed(Model&Authenticatable $user, SsoIdentity $identity): bool
{
return $user->status !== UserStatus::Inactive; // a refused user sees a 403
}
}