Yale CAS认证模式替换——数据库

Yale CAS Server 3.0.7

1. 从Yale CAS官方网上下载cas-server-jdbc-3.0.5-rc3.jar包后入入Yale CAS server的WEB-INF\lib目录下

2. 更新Yale CAS server的WEB-INF\deployerConfigContext.xml文件,配置片段如下( 本配置只进行了AuthenticationHandler替换及新增passwordEncoder、dataSource配置):

将以下:

  1. <bean    
  2.                     class="org.jasig.cas.authentication.handler.support.MyUsernamePasswordAuthenticationHandler">  
  3.                     <property    
  4.                     name="passwordEncoder"    
  5.                     ref="passwordEncoder"/>  
  6.                 </bean>  

 

替换成:

  1. <bean  
  2.                     class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">  
  3.                     <property name="sql"  
  4.                         value="select password_ from users where emailAddress=?"/>  
  5.                     <property name="dataSource" ref="dataSource" />  
  6.                     <property name="passwordEncoder"  
  7.                         ref="passwordEncoder" />  
  8.                 </bean>  

 

然后新增:

  1. <bean id="passwordEncoder"  
  2.         class="org.jasig.cas.authentication.handler.LiferayPasswordEncoder" />  
  3.   
  4.     <bean id="dataSource"  
  5.         class="org.springframework.jdbc.datasource.DriverManagerDataSource"  
  6.         destroy-method="close">  
  7.         <property name="driverClassName">  
  8.             <value>com.mysql.jdbc.Driver</value>  
  9.         </property>  
  10.         <property name="url">  
  11.             <value>  
  12.                 jdbc:mysql://localhost/liferay?useUnicode=true&amp;characterEncoding=UTF-8   
  13.             </value>  
  14.         </property>  
  15.         <property name="username">  
  16.             <value>test</value>  
  17.         </property>  
  18.         <property name="password">  
  19.             <value>test</value>  
  20.         </property>  
  21.     </bean>  

你可能感兴趣的:(bean,mysql,Web,jdbc,SQL Server)