CAS custom password encoder

509 views
Skip to first unread message

Tuan Nguyen

unread,
Feb 27, 2017, 8:48:02 PM2/27/17
to CAS Community
Hello, I am using CAS Server version 5.0.2. How can I define an authentication handler with a custom password encoder? I can define one in the application.properties file like this:
# cas.authn.jdbc.encode[0].numberOfIterations=0
# cas.authn.jdbc.encode[0].numberOfIterationsFieldName=numIterations
# cas.authn.jdbc.encode[0].saltFieldName=salt
# cas.authn.jdbc.encode[0].staticSalt=
# cas.authn.jdbc.encode[0].sql=
# cas.authn.jdbc.encode[0].algorithmName=
# cas.authn.jdbc.encode[0].passwordFieldName=password
# cas.authn.jdbc.encode[0].healthQuery=SELECT 1 FROM INFORMATION_SCHEMA.SYSTEM_USERS
# cas.authn.jdbc.encode[0].isolateInternalQueries=false
# cas.authn.jdbc.encode[0].url=jdbc:hsqldb:mem:cas-hsql-database
# cas.authn.jdbc.encode[0].failFast=true
# cas.authn.jdbc.encode[0].isolationLevelName=ISOLATION_READ_COMMITTED
# cas.authn.jdbc.encode[0].dialect=org.hibernate.dialect.HSQLDialect
# cas.authn.jdbc.encode[0].leakThreshold=10
# cas.authn.jdbc.encode[0].propagationBehaviorName=PROPAGATION_REQUIRED
# cas.authn.jdbc.encode[0].batchSize=1
# cas.authn.jdbc.encode[0].user=sa
# cas.authn.jdbc.encode[0].ddlAuto=create-drop
# cas.authn.jdbc.encode[0].maxAgeDays=180
# cas.authn.jdbc.encode[0].password=
# cas.authn.jdbc.encode[0].autocommit=false
# cas.authn.jdbc.encode[0].driverClass=org.hsqldb.jdbcDriver
# cas.authn.jdbc.encode[0].idleTimeout=5000
# cas.authn.jdbc.encode[0].credentialCriteria=

# cas.authn.jdbc.encode[0].passwordEncoder.type=NONE|DEFAULT|STANDARD|BCRYPT
# cas.authn.jdbc.encode[0].passwordEncoder.characterEncoding=
# cas.authn.jdbc.encode[0].passwordEncoder.encodingAlgorithm=
# cas.authn.jdbc.encode[0].passwordEncoder.secret=
# cas.authn.jdbc.encode[0].passwordEncoder.strength=16

However, it is not possible to define a custom password encoder.

I declared 2 beans in the deployerConfigContext.xml (in /WEB-INF folder) but they were not picked up by the CAS server
<bean id = "authenticationManager" class = "org.apereo.cas.authentication.PolicyBasedAuthenticationManager">
    <constructor-arg>
        <list>
            <bean id="dbAuthHandler" class="org.apereo.cas.adaptors.jdbc.QueryDatabaseAuthenticationHandler">
                <property name="dataSource" ref="dataSource"/>
                <property name="sql" value="select password from users where lower(username) = lower(?)"/>

            </bean>
        </list>
    </constructor-arg>
</bean>

<!-- MySQL connector -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
    <property name="url" value="jdbc:mysql://localhost:3306/cas"/>
    <property name="username" value="root"/>
    <property name="password" value="password"/>
</bean>

Any ideas?

Tuấn Vũ Anh

unread,
Feb 28, 2017, 3:47:35 AM2/28/17
to cas-...@apereo.org
U need include library encode password (md5, sha, custome,...)

--
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
---
You received this message because you are subscribed to the Google Groups "CAS Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cas-user+unsubscribe@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/edb0ab8a-7c71-4664-8f80-cb15058610a9%40apereo.org.



--

FullName : Vũ Anh Tuấn

Workplace: P.Tư vấn và Triển khai - Trung Tâm Chuyển giao công nghệ - Cục Công nghệ thông tin - Bộ TN&MT.

HandFone: 090.349.4078

Email :       vuanhtu...@gmail.com - vat...@tnmt.vn
Skype :       vuanhtuanbk248

Reply all
Reply to author
Forward
0 new messages