| Package Data | |
|---|---|
| Maintainer Username: | dfoxx |
| Maintainer Contact: | dfoxx@users.noreply.github.com (David Foxx Sterling) |
| Package Create Date: | 2017-02-07 |
| Package Last Update: | 2025-04-15 |
| Home Page: | |
| Language: | PHP |
| License: | MIT |
| Last Refreshed: | 2025-11-02 15:03:14 |
| Package Statistics | |
|---|---|
| Total Downloads: | 41 |
| Monthly Downloads: | 0 |
| Daily Downloads: | 0 |
| Total Stars: | 2 |
| Total Watchers: | 1 |
| Total Forks: | 2 |
| Total Open Issues: | 2 |
This package is provide some basic guidance on setting up authentication middleware, custom guard, and user provider for Shibboleth in Laravel 5.4, 5.5.
Via Composer
$ composer require dfoxx/laravel-shibboleth
Then add the service provider in config/app.php:
Dfoxx\Shibboleth\ShibbolethServiceProvider::class,
You must add the unity_id to the $fillable array in app/User.php:
protected $fillable = [
'unity_id', 'name', 'email',
];
You must specify the identifier on the User model by adding the following to app/User.php:
/**
* Get the name of the unique identifier for the user.
*
* @return string
*/
public function getAuthIdentifierName()
{
return 'unity_id';
}
/**
* Get the unique identifier for the user.
*
* @return mixed
*/
public function getAuthIdentifier()
{
return $this->unity_id;
}
Edit config/auth.php:
'guards' => [
'web' => [
'driver' => 'shibboleth',
'provider' => 'users',
],
],
'providers' => [
'users' => [
'driver' => 'shibboleth',
'model' => App\User::class,
],
],
Add default user for testing to config/services.php:
'shib' => [
'default_user' => env('APP_USER')
],
Note: Because we are using Laravel's config caching, you will need to run php artisan config:cache in order to reflect the change in config/services.php
Add middleware to the app/Http/Kernel.php:
'auth.shib' => \Dfoxx\Shibboleth\AuthenticateWithShibboleth::class,
When the app environment is set to local APP_ENV=local in .env can add the value
APP_USER=userid to specify which user you want to log in as.
To configure routes that use the middleware see this example:
Route::group(['middleware' => 'auth.shib'], function() {
Route::get('/home', 'HomeController@index');
});
The MIT License (MIT). Please see License File for more information.