Prerequest
Install mysql on the machine and be sure it's working properly.I used the default settings of mysql.If you used different one, change the configuration according to it.(localhost:3306)
Download apache tomcat and configure it to allow SSL connection.( You can follow my previous post)
Download cas server source code package
Install apache maven
How
- Go to CAS source code location -> cas-server-webapp ->src->main->webapp->WEB-INF
- Open deployerConfigContext.xml in a text editor
- Change the bean serviceRegistryDao in deployerConfigContext.xml to something like this
<bean id="serviceRegistryDao" class="org.jasig.cas.services.JpaServiceRegistryDaoImpl"
p:entityManagerFactory-ref="entityManagerFactory" />
<!-- This is the EntityManagerFactory configuration for Hibernate -->
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="generateDdl" value="true"/>
<property name="showSql" value="true" />
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory"/>
</bean>
<tx:annotation-driven transaction-manager="transactionManager"/>
<!-- change test as your database name, and give username and password of mysql login credential-->
<bean
id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource"
p:driverClassName="com.mysql.jdbc.Driver"
p:url="jdbc:mysql://localhost:3306/test?autoReconnect=true"
p:password=""
p:username="root" />
- Change following line
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
- Open cas.properties file
database.hibernate.dialect=org.hibernate.dialect.MySQLDialect
- Go to CAS source code location -> cas-server-webapp
- Open pom.xml and add following dependency according to your CAS version
<!--
Apache Commons DBCP
for Java 6 (use version 1.3 for Java 5 or lower)
-->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
<scope>runtime</scope>
</dependency>
<!--
Hibernate Core and Entity Manager
for CAS 3.5.0 and higher
-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<!--
Hibernate Entity Manager
for CAS 3.4.2.1
-->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.5.0-CR-2</version>
</dependency>
<!--
MySQL Connector
-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.20</version>
</dependency>
- Open command prompt change directory to CAS source code location -> cas-server-webapp
- type mvn package
- copy cas.war to apache tomcat webapps location and you are done
there is no mapping given regarding databse table ? from where the user is authenticated ?
ReplyDelete