Package Data | |
---|---|
Maintainer Username: | csi-uksw |
Maintainer Contact: | p.cieszkowski@uksw.edu.pl (Paweł Cieszkowski) |
Package Create Date: | 2015-11-19 |
Package Last Update: | 2017-04-20 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-25 15:05:25 |
Package Statistics | |
---|---|
Total Downloads: | 134 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 3 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 1 |
Version 1.0 requires PHP 5.5.9+.
To install this package pull it in through Composer.
composer require csi-uksw/laravel-cas
After Composer is done, you need to tell your application to use the CAS service provider.
Open config/app.php
and add the service provider
CSI_UKSW\Laravel\CAS\CASServiceProvider::class
after
Illuminate\Auth\AuthServiceProvider::class
As well the Facade :
'CAS' => CSI_UKSW\Laravel\CAS\Facades\CAS::class
To set up your CAS for connections you have to publish CAS config. This will provide all the configuration values for your connection.
php artisan vendor:publish --provider="CSI_UKSW\Laravel\CAS\CASServiceProvider"
After that please edit your app/cas.php
. Using the .env
file will allow you to have different environments without even touching the app/cas.php
config file.
Optionally you can use provided Auth Middleware.
After publishing please edit your app/Http/Kernel.php
protected $routeMiddleware = [
'auth.cas' => \CSI_UKSW\Laravel\CAS\Http\Middleware\CASAuthMiddleware::class
];
Authenticate:
CAS::authenticate()
Logout:
CAS::logout()
Get username:
CAS::getUser()
Get user attributes:
CAS::getAttributes()
Check if is authenticated:
CAS::isAuthenticated()
Route middleware:
Route::group(['middleware' => 'auth.cas'], function () {
get('cas', function(){
echo 'authorized only';
});
});