LaravelPackages.net
Acme Inc.
Toggle sidebar
monkeydp/laravel-cas

Simple CAS Authentication for Laravel 5.5

78
3
0.1.6
About monkeydp/laravel-cas

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

Laravel CAS

Based on https://github.com/apereo/phpCAS

About

Simple CAS Authentication for Laravel 5.5

Features

  • Single Sign On
  • Single Logout

Requirement

  • Laravel >= 5.5

Installation

Require the monkeydp/laravel-cas package in your composer.json:

$ composer require monkeydp/laravel-cas

Configuration

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

Register Route Middleware

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, ];

Example

Single sign on

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

Single Logout

Just access http://your.project.host/cas/logout

Use Get request

Star History Chart