Cas用户密码自定义加密

时间:2022-07-14 19:17:00


 <bean class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
      <property name="dataSource" ref="dataSourceForMySql" ></property>
      <property name="sql" value="select password from eauser as u where u.ACCOUNT = ? and  u.enabled = 1" ></property>
      <property name="passwordEncoder" ref="EDS2PasswordEncoder" ></property>
     </bean>



  <!--数据验证模式 自定义的加密类,返回值:加密后的字符串-->
  <bean id="EDS2PasswordEncoder" class="org.jasig.cas.authentication.handler.SunPasswordEncoder">
    </bean>


public class SunPasswordEncoder implements PasswordEncoder{

 @Override
 public String encode(String password) {
  String end = Tools.encryptBasedDes(password);
  return end;
 }

}


加密方式:http://blog.csdn.net/s445320/article/details/9897189