PHPackages                             firmantr3/laravel-sso - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. firmantr3/laravel-sso

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

firmantr3/laravel-sso
=====================

Laravel Single Sign On (SSO) authenticatable credentials implementation.

2.0.3(6y ago)255MITPHPCI failing

Since Sep 26Pushed 6y ago1 watchersCompare

[ Source](https://github.com/firmantr3/laravel-sso)[ Packagist](https://packagist.org/packages/firmantr3/laravel-sso)[ RSS](/packages/firmantr3-laravel-sso/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (6)Versions (11)Used By (0)

Implement Single Sign On (SSO) authenticatable credentials for your user models
===============================================================================

[](#implement-single-sign-on-sso-authenticatable-credentials-for-your-user-models)

Create just one unique credential for multiple authenticatable users that has different eloquent model.

Introduction
------------

[](#introduction)

Given you need to implement a school management application, that have 3 different user: admins, teachers, students. Sometimes, admins can be teacher as well, how if the email and password don't need to be different? Well, **Laravel SSO** to the rescue!

Installation
------------

[](#installation)

```
composer require firmantr3/laravel-sso
```

Publish migration by running artisan `vendor:publish`:

```
php artisan vendor:publish
```

Configuration
-------------

[](#configuration)

Update your laravel auth config: `/config/auth.php`, and use `sso` provider, like so:

```
    'providers' => [
        'admins' => [
            'driver' => 'sso',
            'model' => App\Admin::class,
        ],

        'teachers' => [
            'driver' => 'sso',
            'model' => App\Teacher::class,
        ],

        'students' => [
            'driver' => 'sso',
            'model' => App\Student::class,
        ],
    ],
```

You can use preset Credential model: `Firmantr3\LaravelSSO\Models\Credential`. You can also create your own `Credential` model class that extends from `Firmantr3\LaravelSSO\Models\Credential` so you can customize the child relations, and then update your class namespace in `config/sso.php`.

Sample Usage
------------

[](#sample-usage)

Your user models must have `credential_id` AND Laravel's default user attributes like `remember_token`, check your user model migration. The `credential_id` should be unique for each models, to prevent duplication.

User model's class must extend `Firmantr3\LaravelSSO\Models\User` like so:

```
