#jasig cas

How to integrate phpCAS in Laravel

I would like to share you how to integrate phpCAS in Laravel. As you know, Jasig CAS is a Single-Sign-On System. If you want to connect to Jasig CAS from your system (that is wrote by PHP), you use phpCAS Library

Work hard in Silence, Let Success make the noise

Work hard in Silence, Let Success make the noise

To know how to install a Jasig CAS server, please see:  https://sonnguyen.ws/install-jasig-cas-ubuntu-14-04/

Step 1:  Download phpCAS Library and locate it in app/library directory

Step 2: Create CAS Authentication Provider

We create file CasAuthProvider.php

Add source code to file:

Please make note that, you have to add  cas_host, cas_context, cas_port to app/config/app.php file

Step 3: Adding new provider to Laravel

Edit app/start/global.php file by adding code:

Step 4: Adding phpCAS library, new provider to Laravel Autoload

Open composer.json located at Laravel Root Directory and add app/library/phpCAS, app/cas:

Dump new Laravel Autoload file:

Step 5: Finally, create route and controller for login action

In app/routes.php file add:

In app/controllers/Admin.php add:

 

 

Install Jasig CAS in ubuntu 14.04

To install CAS, your machine has to have Tomcat. In ubuntu 14.04, you will easily install Tomcat 7 with command apt-get. It is quite simple, just concern about ssl connection

19b004fa-32bf-11e4-9354-12313b024af0-medium

 

The first step, install tomcat7 by command:

Next step, you install https for Tomcat. To do that, you need to generate key by using keytool:

Change tomcat config file:

Add content below to server.xml:

Download Jasig Cas 4.0:

Copy war file to Tomcat Web Root:

So now, restart tomcat:

Forward port 443 to port 8443:

Test:

Login CAS with default account: casuser/Mellon

Or you can add new account by editing file: /var/lib/tomcat7/webapps/cas-server-webapp-4.0.0/WEB-INF/deployerConfigContext.xml

Troubleshooting your installation: