Skip to main content

How to setup and configure CAS - Central Authentication Service

Points To Remember
  • CAS works on Maven WAR overlay technique.
  • You need to create a SSL certificate to use CAS and run it over https to enable SSO(single sign on). How to create a SSL certificate and add it to keystore.
  • You can use LDAP, Database and Active Directory techniques to authenticate the user.
Requirements
  1. You need to have Java SDK v1.6 or greater.
  2. Servlet Containers like Tomcat , Websphere, JBoss etc. 
  3. Apache Maven v3.0 or greater.
  4. Authentication technique related dependencies.
For the sake of simplicity let us assume that out application path is
PROJECT = /home/ekiras/cas
and our tomcat path is
TOMCAT = /home/ekiras/apache

Step 1 : Create pom.xml
You need to create a pom.xml to create the war file and package it. lets create the pom file in the project directory i.e. PROJECT/pom.xml
Add the following code to the pom.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd ">
<modelVersion>4.0.0</modelVersion>
<groupId>cas</groupId>
<artifactId>ekiras</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>

<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warName>cas</warName>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.jasig.cas</groupId>
<artifactId>cas-server-webapp</artifactId>
<version>${cas.version}</version>
<type>war</type>
<scope>runtime</scope>
</dependency>
</dependencies>

<properties>
<cas.version>4.0.0</cas.version>
</properties>

<repositories>
<repository>
<id>ja-sig</id>
<url>http://oss.sonatype.org/content/repositories/releases/ </url>
</repository>
</repositories>
</project>
Here we have added the dependencies of the project and the repositories where it will look for the dependencies and jars. We are setting up CAS version 4.0.0
Step 2 : Lets check our progress
Let us check our progress and see if we have not missed on something. Run the following command
mvn clean package
This will create a war file in the directory PROJECT/target/. Deploy this war file on tomcat as instructed here. Now run the app you will see the screen like the following.
CAS login screen
You can now login to the CAS server using username="casuser" and password="Mellon". These are the default username password that can be used to login. After login you will see the screen like the following.
CAS Successful Login screen
We can logout the cas server using the path /logout. This will log out the user.
CAS successful logout screen.
So, we have now setup our CAS server and successfully logged into and logged out of  the CAS server.

How to Use Database for CAS Authentication.

Comments