1.首先打开deployerConfigContext.xml。红色为新增,
<bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager">
<constructor-arg>
<map>
<!--
| IMPORTANT
| Every handler requires a unique name.
| If more than one instance of the same handler class is configured, you must explicitly
| set its name to something other than its default name (typically the simple class name).
-->
<entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver" />
<entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" />
<entry key-ref="primaryAuthenticationHandler1" value-ref="primaryPrincipalResolver1" />
</map>
</constructor-arg>
2.添加数据源
<bean id="primaryAuthenticationHandler1" class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="dataSource" ref="dataSourceForP2P" ></property>
<property name="sql" value="select F03 from T6110 where F02 =?" ></property>
<!-- <property name="passwordEncoder" ref="RS10Md5PasswordEncoder" /> -->
</bean>
<bean id="dataSourceForP2P" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"><value>com.mysql.jdbc.Driver</value></property>
<property name="url"><value>jdbc:mysql://localhost:3306/s61</value></property>
<property name="username"><value>root</value></property>
<property name="password"><value>root</value></property>
</bean>
3.新增
<bean id="primaryPrincipalResolver1" class="org.jasig.cas.authentication.principal.PersonDirectoryPrincipalResolver" >
<property name="attributeRepository" ref="selfAttributeRepository1" />
</bean>
4.新增
<bean id="selfAttributeRepository1" class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
<constructor-arg index="0" ref="dataSourceForP2P"/>
<constructor-arg index="1" value="select * from T6110 where {0}"/>
<property name="queryAttributeMapping">
<map>
<entry key="username" value="F02"/>
</map>
</property>
<property name="resultAttributeMapping">
<map>
<entry key="F02" value="phones"/>
<entry key="F01" value="uId"/>
<entry key="F09" value="createDate"/>
</map>
</property>
</bean>
5.配置完成。