为Jboss/tomcat配置Yale-CAS(二)配置CAS JDBC验证

1.修改cas/webapp/WEB-INF/deployerConfigContext.xml 加入以下定义:

   <!-- 数据源定义 -->  
       <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" destroy-method="close">  
        <property name="driverClassName" value="${db.driver}" />  
       <property name="url" value="${db.url}" />  
        <property name="username" value="${db.username}" />  
        <property name="password" value="${db.password}" />         
       </bean>  
 

2.屏蔽原有验证方法:

 <!--   
 <bean  
     class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" />  
 -->  
 

3.加入通过访问数据库进行验证的handler:我们这里不对密码做md5

    <bean class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">  
                    <property name="sql" value="select password from CORE_USERS where logid=?" />  
                    <property name="dataSource" ref="dataSource" />  
</bean>     
 

4.修改cas\webapp\WEB-INF\cas.properties,定义数据库连接资源,本例子是连接的oracle数据库

database.hibernate.dialect=org.hibernate.dialect.OracleDialect?

cas.datasource.driverClassName=oracle.jdbc.driver.OracleDriver?
cas.datasource.userName=sa
cas.datasource.password=password

cas.datasource.url=jdbc:oracle:thin:@192.168.1.169:1521:orcl

cas.securityContext.serviceProperties.service=https://localhost:8443/cas/services/j_acegi_cas_security_check

cas.securityContext.casProcessingFilterEntryPoint.loginUrl=https://localhost:8443/cas/login

cas.securityContext.casProxyTicketValidator.casValidate=https://localhost:8443/cas/proxyValidate

cas.themeResolver.defaultThemeName=default

cas.viewResolver.basename=default_views

host.name=cas

5.增加相关jar包到cas\webapp\WEB-INF\lib\目录下: cas-server-support-jdbc-3.2.jar (cas连接数据库的支持包) ojdbc14.jar (连接oracle数据的jdbc驱动程序)

你可能感兴趣的:(oracle,tomcat,bean,jdbc,jboss)