`
starbhhc
  • 浏览: 632751 次
  • 性别: Icon_minigender_2
  • 来自: 深圳
社区版块
存档分类
最新评论

第七节:CAS4.0.0 以上服务端配置多个数据源

    博客分类:
  • java
 
阅读更多

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.配置完成。

 

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics