Friday, June 3, 2011

Integrating Liferay with CAS Server -------Single Sign On


1.      Go to this path ( liferay-portal-6.3.0.0\tomcat-6.0.24\conf ) and open the server.xml file. Uncomment the SSL connections and open port 8443 for build connections https.
<!-- Define a SSL HTTP/1.1 Connector on port 8443
         This connector uses the JSSE configuration, when using APR, the
         connector should be using the OpenSSL style configuration
         described in the APR documentation -->
    <!--
    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->
Red color things should be uncommented for open the port 8443.
2.       Download the latest available version of the Liferay-portal-cas-4.3.x.war file from www.liferay/web/guest/downloads.
3.       Rename the download file to cas-web.war.
4.       Copy the cas-web.war file and paste it to the Tomcat webapps (liferay-portal-6.3.0.0\tomcat-6.0.24\webapps) directory.
5.       Then To download the Yale CAS Client 2.0.11 go to http://downloads.jasig.org/cas-clients/ and download cas-client-2.0.11.tar.gz or zip(for windows)
6.       Extract the above file and open the folder and navigate to the casclient jar file (cas-client-2.0.11\java\lib).  
7.       Copy the file for Go to the lib file in Tomcat (liferay-portal-6.3.0.0\tomcat-6.0.24\webapps\ROOT\WEB_INF\lib) and paste the casclient jar file to replace the existing one.
The next steps are very important steps. It is described how to generate https key.
1.       In the command prompt or linux terminal go to the ROOT (liferay-portal-6.3.0.0\tomcat-6.0.24\webapps\ROOT) directory.
2.       Enter this command for generate the key…….
keytool -genkey -alias tomcat -keypass changeit -keyalg RSA
3.       Enter changeit for the password.
4.       Answer the list of questions. Note that the first and last name must be the host name of your server and cannot be an IP address. This is very important because an IP address will fail client hostname verification even if it is correct. So example give the (localhost).
5.       No need to give answer for other questions…………when questions are finished, finally give the (yes).
6.       Enter the following command to export he cert you generated from your personal keystore:keytool -export -alias tomcat -keypass changeit -file server.cert
7.       server.cert is a file name.
8.       Enter changeit for the password.

9.       Import the cert into Java's keystore with this command:

keytool -import -alias tomcat -file server.cert -keypass changeit -keystore %JAVA_HOME%/jre/lib/security/cacerts
%JAVA_HOME% means java home path..
10.   Enter changeit for the password.
11.   Enter yes
12.   Then go to (liferay-portal-6.3.0.0\tomcat-6.0.24\webapps\ROOT\WEB_INF\classes) folder and Create portal-ext.properties file if it does not exist yet.
13.   Open portal-ext.properties and enter:
cas.auth.enabled=true
14.   Enter these default values………..in portal-ext.properties for cas integration.

15.   Save the settings.
16.   Start Tomcat and go to Liferay Portal.
17.   Click Sign In. If everything is set up correctly you will be redirected to the CAS server's login screen.
18.   If your user in both CAS data base and liferay database you can login successfully.










Dileepa sisisla Chandrasekera
Computer Science & Engineering (University of Moratuwa)
hsenid mobile Solutions company (trainee)


No comments:

Post a Comment