Thursday, January 15, 2009

CAS + LDAP

Well, its been a while and right now I'm installing CAS + LDAP.

Install Java JDK's - required to start tomcat an compilers.
Try to store it anywhere, or in my case @ /opt.

/opt/jdk-version - usually u need V1.5 up.

Set environment variable JAVA_HOME=/opt/jdk-{version}

#export JAVA_HOME=/opt/jdk-{version}/

Install latest apache-maven (for compiling cas if possible)
Install latest apache-ant (for compiling using ant)

Download and Install Tomcat 5.5 (core - usually standalone).

Place tomcat anywhere, for me @ /opt/tomcat5.

Next off, try to run or execute Tomcat to see if it is working. Usually the howto's install and run
Tomcat is already packed within it's source. ( Check Readme or Install files.)
Then check to see if tomcat is running by visiting http://localhost:8080
Running Tomcat:
#/opt/tomcat5/bin/startup.sh
Shutting Tomcat:

#/opt/tomcat/bin/shutdow
n.sh

Download CAS server @ http://www.ja-sig.org/products/cas/downloads/index.html
Extract the archive in your favorite folder.
Explore the extracted file
s and test CAS. Use the war file located in one of its directories
ie. PATH/cas-server-{ve
rsion}/modules/cas{version}.war
Copy the war file to the to
mcat's webapps directory.

#cp /PATH/cas-server-{ver}/modules/cas{version}.war /opt/tomcat/webapps

Start Tomcat. Try to see catalina's logs or monitor the webapps directory of CAS if modules were copy and loaded. Check for errors.

#tail -f /opt/tomcat/logs/catalina.out

Visit the CAS login and test page if loaded successfully. http://localhost:8080/cas/login
Use the default username a
nd password to check if CAS is ok.

If successful, we now ha
ve to compile CAS to support ldap authentication.

Go to CAS source directory (where you extracted the dl'ed source).
CAS-PATH-source/cas-server-webapps

Edit the pom.xml in the directory and add the following line at the dependency area.

(from cas - ldap support)







(from spring ldap support)











I applied both support in my setup cause the first one does not work; well, maybe I just had wrong setup of my deployer.xml file and have to rebuild again and applied both in my new compilation.
Save the file and compile usin
g maven.

#mvn download
#mvn package


After compiling, check to see the subdirectory 'target' if contains *.war file.
You needed this file for tomcat. Remove all your previo
us version of CAS in tomcat's webapp directory and the previous war file. Copy the new war file to tomcat's webapps directory. check if dependencies were copied; or restart tomcat. Check for errors on its log files.

After installation of cas, edit deployerConfigContext.xml file for linking your CAS to an LDAP server.
Backup the original deployerConfigContext.xml file
. The following lines were added in my configuration.

Under the authenticationHandlers property add this lines







Before the end of the file (before the
closing) add this following
lines














Restart Tomcat. Check the CAS site again and use your ldap username and password.


:p