« Return to Thread: CAS and mysql

Re: CAS and mysql

by David Whitehurst :: Rate this Message:

Reply to Author | View in Thread

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@...> 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@...
http://tp.its.yale.edu/mailman/listinfo/cas-dev


_______________________________________________
cas-dev mailing list
cas-dev@...
http://tp.its.yale.edu/mailman/listinfo/cas-dev

 « Return to Thread: CAS and mysql

LightInTheBox - Buy quality products at wholesale price