[cas-dev] CAS and mysql
Edward Chen
edwardc at wolfram.com
Tue Apr 8 18:14:06 EDT 2008
David,
I follow the instruction below but it doesn't work. I don't know what I
miss. I have the following error
CAS is Unavailable
There was a fatal error initializing the CAS application context. This
is almost always because of an error in the Spring bean configuration
files. Are the files valid XML? Do the beans they refer to all exist?
.....
Below is what I modify. I have mysql installed in my PC, the mysql
server name is "edwardcwin.wri.wolfram.com"
<bean id="SearchModeSearchDatabaseAuthenticationHandler"
class="org.jasig.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler"
abstract="false" singleton="true" lazy-init="default"
autowire="default" dependency-check="default">
<property name="tableUsers">
<value>users</value>
</property>
<property name="fieldUser">
<value>user_id</value>
</property>
<property name="fieldPassword">
<value>password</value>
</property>
<property name="dataSource" ref="dataSource" />
</bean>
<bean
class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="dataSource" ref="dataSource" />
<property name="sql" value="select password from users
where lower(username) = lower(?)" />
</bean>
</list>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@database-server-name:1521:SID</value>
</property>
<property name="username">
<value>admusr</value>
</property>
<property name="password">
<value>admpwd</value>
</property>
</bean>
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://edwardcwin.wri.wolfram.com:3306/login</value>
</property>
<property name="username">
<value>admusr</value>
</property>
<property name="password">
<value>admpwd</value>
</property>
</bean>
</beans>
Also, from your instruction, I download "cas-server-jdbc-3.0.5.jar" into
%CATALINA_HOME%/webapps/cas/WEB-INF/lib
I got confused if I need to download ojdbc14.jar (this is the Oracle
JDBC Driver) or mysql-connector-java-5.1.5-bin.jar (this is the mysql
driver) into ..cas/WEB-INF/lib
How about
* commons-collections-3.2.jar
* commons-dbcp-1.2.1.jar
* commons-pool-1.3.jar
Also, do I need to write a java handler file into C:\Program
Files\Apache Software Foundation\Tomcat
5.5\webapps\servlets-examples\WEB-INF\classes
in order to do the authentication???
Thanks,
Edward
David Whitehurst wrote:
> Edward:
>
> I wasn't paying attention. There's detailed instructions here:
>
> http://www.ja-sig.org/wiki/display/CASUM/Using+JDBC+for+Authentication
>
> David
>
>
> On 4/8/08, *David Whitehurst* <dlwhitehurst at gmail.com
> <mailto:dlwhitehurst at gmail.com>> wrote:
>
> Edward:
>
> Include this snippet into the pom.xml in the directory
> ../cas-server-webapp/
>
> <dependency>
> <groupId>${project.groupId}</groupId>
> <artifactId>cas-server-support-jdbc</artifactId>
> <version>${project.version}</version>
> </dependency>
>
> This tells Maven to add the JDBC dependency to cas.war. You
> should be building everything when using Maven. It makes things
> easier.
>
> Change directory into */cas-server-3.0.7* and use the following
> command to build the entire server and supporting modules.
>
> $ mvn clean install -Dmaven.test.skip=true
>
> After all the dependencies are downloaded and the software builds,
> you should see something similar to the below output in your
> terminal window.
>
> After all the dependencies are downloaded and the software builds,
> you should see something similar to the below output in your
> terminal window.
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Reactor Summary:
> [INFO]
> ------------------------------------------------------------------------
> [INFO] JA-SIG Central Authentication Service .................
> SUCCESS [1:11.959
> s]
> [INFO] JA-SIG CAS Core .......................................
> SUCCESS [1:09.663
> s]
> [INFO] JA-SIG CAS Generic Support ............................
> SUCCESS [2.250s]
> [INFO] JA-SIG CAS JDBC Support ...............................
> SUCCESS [2.031s]
> [INFO] JA-SIG CAS LDAP Support ...............................
> SUCCESS [2.391s]
> [INFO] JA-SIG CAS Legacy Support .............................
> SUCCESS [24.721s]
>
> [INFO] JA-SIG CAS OpenId Support .............................
> SUCCESS [2.625s]
> [INFO] JA-SIG CAS RADIUS Support .............................
> SUCCESS [38.816s]
>
> [INFO] JA-SIG CAS SPNEGO/NTLM Support ........................
> SUCCESS [12.501s]
>
> [INFO] JA-SIG CAS Trusted User Support .......................
> SUCCESS [2.016s]
> [INFO] JA-SIG CAS X.509 Client Certificate Support ...........
> SUCCESS [2.500s]
> [INFO] JA-SIG CAS JBoss Cache Integration ....................
> SUCCESS [29.502s]
>
> [INFO] JA-SIG CAS BerkeleyDB Integration .....................
> SUCCESS [10.501s]
>
> [INFO] JA-SIG CAS Web Application ............................
> SUCCESS [54.333s]
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESSFUL
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Total time: 5 minutes 26 seconds
> [INFO] Finished at: Thu Mar 13 10:18:36 EDT 2008
> [INFO] Final Memory: 17M/38M
> [INFO]
> ------------------------------------------------------------------------
>
> At this point, you will have built the CAS WAR and should only
> have to configure it. The CAS Wiki instructions are slim,
> however, it's not too difficult to figure them out.
>
> In deployerConfigContext.xml add something like this ...
>
> <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" />
>
> Next make this authenticationManager look like this ...
>
>
> <bean id="authenticationManager"
> class="org.jasig.cas.authentication.AuthenticationManagerImpl">
> <property name="credentialsToPrincipalResolvers">
> <list>
> <bean
> class="org.jasig.cas.authentication.principal.UsernamePasswordCredentialsToPrincipalResolver"
> />
> <bean
> class="org.jasig.cas.authentication.principal.HttpBasedServiceCredentialsToPrincipalResolver"
> />
> </list>
> </property>
>
> <property name="authenticationHandlers">
> <list>
> <bean
> class="org.jasig.cas.adaptors.ldap.QueryDatabaseAuthenticationHandler">
> <property name="sql" value="select password from mytable where
> username = ?"/> <property name="passwordEncoder"
> value="PlainTextPasswordEncoder"/>
>
> <property name="dataSource" ref="dataSource"/>
> </bean>
> </list>
> </property>
> </bean>
>
> Notice that I just changed the file deployerConfigContext.xml in
> the cas.war. I assumed that you either changed it and rebuilt
> with Maven or ..
>
> You are running cas.war as an exploded deployment.
>
> Try it. It should work. I'm not 100% sure that the property
> dataSource is correct. Anyhow, it should get you a little further.
>
> David
>
> On 4/8/08, *Edward Chen* <edwardc at wolfram.com
> <mailto:edwardc at wolfram.com>> wrote:
>
> I am using CAS 3.0.7
>
> I want to set up the connectivity to MySQL so that the CAS
> login page
> can authenticate the users ( user name and password) in MySQL.
>
> I have installed MySQL in my PC but I don't know how to set up
> connectivity to CAS login to MySQL.
>
> Any specific ideas? can you show me step by step how to do?
>
>
> Also, I browsed CAS website, there is about "How to Write an
> Authentication Handler", I read the code but I don't
> understand how to
> insert this code into "where it is" in the directory, can you
> tell?
> _______________________________________________
> cas-dev mailing list
> cas-dev at tp.its.yale.edu <mailto:cas-dev at tp.its.yale.edu>
> http://tp.its.yale.edu/mailman/listinfo/cas-dev
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> cas-dev mailing list
> cas-dev at tp.its.yale.edu
> http://tp.its.yale.edu/mailman/listinfo/cas-dev
>
More information about the cas-dev
mailing list