Custom passwordEncoder in CAS 5.1

118 views
Skip to first unread message

Mathieu Plasse

unread,
May 17, 2017, 9:06:25 AM5/17/17
to CAS Community
I'm trying to configure a custom passwordEncoder on CAS 5.0 . My problem is the PolicyBasedAuthenticationManager as completly changed from 4 to 5 so old deployerConfig.xml do not work.
Old 4.0 was like that :
<bean id="authenticationManager" class="org.jasig.cas.authentication.PolicyBasedAuthenticationManager">
<constructor-arg>
<map>
<entry key-ref="primaryAuthenticationHandler" value-ref="dbAuthHandler"/>
</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" />
<bean id="dbAuthHandler" class="org.jasig.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
<property name="dataSource">
   <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/cas?useUnicode=true&amp;characterEncoding=utf-8" />
<property name="username" value="root" />
<property name="password" value="" />
</bean>
</property>
<property name="sql" value="my request" />
<property name=="passwordEncoder">
<bean id="passwordEncoder" class="my.custom.PasswordEncoderClass"/>
</property>
</bean>


I tried to create a 5.0 file like that :
 <bean id="authenticationManager" class="org.apereo.cas.authentication.PolicyBasedAuthenticationManager">
  <constructor-arg>
   <map>
    <entry key-ref="authenticationEventExecutionPlan" value-ref="execPlan"/>
    <entry key-ref="servicesManager" value-ref="serviceMan"/>
   </map>
  </constructor-arg>
 </bean>
 <bean id="execPlan" class="org.apereo.cas.authentication.DefaultAuthenticationEventExecutionPlan">
  <property name="authenticationHandler">
   <bean id="dbAuthHandler" class="org.apereo.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
    <property name="dataSource">
     <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
      <property name="driverClassName" value="com.mysql.jdbc.Driver" />
      <property name="url" value="jdbc:mysql://localhost:3306/cas?useUnicode=true&amp;characterEncoding=utf-8" />
      <property name="username" value="root" />
      <property name="password" value="" />
     </bean>
    </property>
    <property name="sql" value="my resuest" />
    <property name="passwordEncoder">
     <bean id="passwordEncoder" class="my.custom.PasswordEncoderClass"/>
    </property>
   </bean>
  </property>
 </bean>
 <bean id="serviceMan" class= "org.apereo.cas.services.DefaultServicesManagerImpl"/>
</beans>


BUT I can't make it work it just not start without any Log.

Does anyone tried this ?

Mathieu
Reply all
Reply to author
Forward
0 new messages