ctbuh/laravel-auth-sso

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

universal login provider

v0.8.6 2019-10-19 05:00 UTC

This package is not auto-updated.

Last update: 2021-05-06 05:27:27 UTC


README

https://login.ctbuh.org/

Install

composer require ctbuh/laravel-auth-sso

Usage

Add 'sso' guard to config/auth.php

'sso' => [
    'driver' => 'sso',
    'provider' => null
]

Add this to config/app.php

ctbuh\Login\LoginServiceProvider::class

Make sure SESSION_DOMAIN= is set to primary domain.

Reload all config

php artisan config:cache

Use from within your controller or as middleware:

Route::middleware('auth:sso')->group(function () {

    Route::get('whoami', function(){
        $user = auth()->guard('sso')->user();
        return $user->getFirstName();
    });
    
});

Route list

  • /sso/login - Send person to login page.
  • /sso/callback?access_token={token} -- If successful, person will be sent to this page.
  • /sso/logout --- Revoke cookie & token itself.