Single Sign-On in CAS Server with java spring security

Single sign on

How it works!

SSO structure

Clone using Maven-Overlay

Adding necessary dependencies

<dependency><groupId>org.apereo.cas</groupId><artifactId>cas-server-support-jdbc</artifactId><version>${cas.version}</version></dependency><dependency><groupId>org.apereo.cas</groupId><artifactId>cas-server-support-jdbc-drivers</artifactId><version>${cas.version}</version></dependency>

Generating the SSL keystore for secured connections

keytool -import -alias thekeystore -storepass changeit -file thekeystore.crt-keystore C:\ProgramFiles\Java\jdk1.8.0_152\jre\lib\security\cacerts”keytool -import -alias thekeystore -storepass changeit -file thekeystore.crt-keystore “C:\Program Files\Java\jre1.8.0_152\lib\security\cacerts”

Specifying port and SSL configurations

server.port=6443cas.standalone.config=classpath:/etc/cas/config

Building the project

Connecting the CAS server to the Database

#cas.authn.accept.users=casuser::Melloncas.authn.accept.users=cas.authn.accept.name=#CAS Database Authentication Propertycas.authn.jdbc.query[0].sql=SELECT * FROM USER WHERE USERNAME= ?cas.authn.jdbc.query[0].url=jdbc:sqlserver://127.0.0.1:1433;databaseName=TESTcas.authn.jdbc.query[0].dialect=org.hibernate.dialect.SQLServer2012Dialectcas.authn.jdbc.query[0].user=rootcas.authn.jdbc.query[0].password=rootcas.authn.jdbc.query[0].ddlAuto=none#cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Drivercas.authn.jdbc.query[0].driverClass=com.microsoft.sqlserver.jdbc.SQLServerDrivercas.authn.jdbc.query[0].fieldPassword=PASSWORDcas.authn.jdbc.query[0].passwordEncoder.type=DEFAULTcas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=NONEcas.authn.jdbc.query[0].passwordEncoder.characterEncoding=NONE

Encryption and character encoding

CAS login page

$……………….………… Happy learning…………………………….$

I have a passion for understanding technology at a fundamental level and Sharing ideas and code. * Aspire to Inspire before I expire* https://balavenkatesh.com

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store