monkeydp/laravel-cas is a Laravel package for simple cas authentication for laravel 5.5.
It currently has 3 GitHub stars and 78 downloads on Packagist (latest version 0.1.6).
Install it with composer require monkeydp/laravel-cas.
Discover more Laravel packages by monkeydp
or browse all Laravel packages to compare alternatives.
Last updated
Based on https://github.com/apereo/phpCAS
Simple CAS Authentication for Laravel 5.5
Require the monkeydp/laravel-cas package in your composer.json:
$ composer require monkeydp/laravel-cas
The defaults are set in config/cas.php. Copy this file to your own config directory to modify the values. You can publish the config using this command:
$ php artisan vendor:publish --provider="Monkeydp\Cas\ServiceProvider"
This command not working in
cmd
In your .env, configuration is as follows
CAS_SERVER_VERSION=3.0
CAS_SERVER_HOST=your.cas-server.host
CAS_SERVER_PORT=443
# Keep empty if cas-server in root
CAS_SERVER_URI=/path/to/cas-server
# Keep empty if the cert is homemade
CAS_SERVER_CA_CERT=/path/to/cert
# An array of host names allowed to send logout requests, separated by ","
CAS_ALLOWED_CLIENTS=192.168.10.114,192.168.20.10
# The url you want to redirect to after logout
CAS_LOGOUT_REDIRECT_TO=http://your.project.host
If you want to allow CAS on a specific route, add the HandleCas middleware to $routeMiddleware in app/Http/Kernel.php:
protected $routeMiddleware = [
// ...
'cas' => \Monkeydp\Cas\HandleCas::class,
];
In routes/web.php, use cas middleware for any route has to login:
Route::group(['middleware' => 'cas'], function () {
Route::get('/home', function(){
return 'HOME';
});
});
When you access http://your.project.host/home, the browser will redirect to Login Page of cas-server
Just access http://your.project.host/cas/logout
Use
Getrequest