cas单点登录数据库配置及自定义密码加密方式

  1. 修改deployerConfigContext.xml文件:
  2. <?xml version="1.0" encoding="UTF-8"?>

<bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager">
    <constructor-arg>
        <map>
            <entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver" />
            <!-- <entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" /> -->
			<entry key-ref="dbAuthHandler" value-ref="primaryPrincipalResolver"/>
        </map>
    </constructor-arg>

    <property name="authenticationPolicy">
        <bean class="org.jasig.cas.authentication.AnyAuthenticationPolicy" />
    </property>
</bean>

   <bean id="proxyAuthenticationHandler"
      class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
      p:httpClient-ref="httpClient" p:requireSecure="false" />

<!—将默认的用户名和密码注释–>

<!-- 配置数据源-->
<bean id="dataSource"
  class="com.mchange.v2.c3p0.ComboPooledDataSource"
 p:driverClass="com.mysql.jdbc.Driver"
 p:jdbcUrl="jdbc:mysql://localhost:3306/itoo_cloudroot?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull"
  p:user="root"
  p:password="rootitoo" 
  />

<!-- cas默认:密码加密方式-->
<bean id="passwordEncoder"
  class="org.jasig.cas.authentication.handler.DefaultPasswordEncoder"
  c:encodingAlgorithm="MD5"
  p:characterEncoding="UTF-8" />
<!-- Required for proxy ticket mechanism -->
<bean id="proxyPrincipalResolver"
      class="org.jasig.cas.authentication.principal.BasicPrincipalResolver" />

<!--
   | Resolves a principal from a credential using an attribute repository that is configured to resolve
   | against a deployer-specific store (e.g. LDAP).
   -->
<bean id="primaryPrincipalResolver"
      class="org.jasig.cas.authentication.principal.PersonDirectoryPrincipalResolver" >
    <property name="attributeRepository" ref="attributeRepository" />
</bean>

<!--
Bean that defines the attributes that a service may return.  This example uses the Stub/Mock version.  A real implementation
may go against a database or LDAP server.  The id should remain "attributeRepository" though.
+-->
<!-- <bean id="attributeRepository" class="org.jasig.services.persondir.support.StubPersonAttributeDao"
        p:backingMap-ref="attrRepoBackingMap" />

<util:map id="attrRepoBackingMap">
    <entry key="uid" value="uid" />
    <entry key="eduPersonAffiliation" value="eduPersonAffiliation" /> 
    <entry key="groupMembership" value="groupMembership" />
</util:map> -->

<bean id="attributeRepository" class="org.jasig.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao">
 <!--  <property name="contextSource" ref="contextSource" />
  <property name="baseDN" value="ou=people,o=company,c=fr" />
  <property name="requireAllQueryAttributes" value="true" /> -->
  <constructor-arg index="0" ref="dataSource"/>
  <constructor-arg index="1" value="select r.databaseName FROM itoo_cloudroot.ta_allusers a INNER JOIN itoo_cloudroot.ta_registuser r ON a.regist

自定义密码加密的实现要实现PasswordEncoder接口:

public class Md5PasswordEncoder implement PasswordEncoder {
public String encode(String password){

}

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值