Solved: I confused
    cas.authn.jdbc.encode[0].algorithmName=SHA-256
with 
    cas.authn.jdbc.encode[0].passwordEncoder.encodingAlgorithm=SHA-256

On Sunday, 24 September 2017 00:28:48 UTC+1, David Bonnes wrote:
>
> Hi, I am stuck on *cas.authn.jdbc.encode*, although I can get 
> *cas.authn.jdbc.query* to work OK.
>
> cas.authn.jdbc.encode throws "*Authentication handler is not configured 
> correctly*", maybe is due to (StringUtils.isBlank(this.sql) || 
> StringUtils.isBlank(this.algorithmName) || getJdbcTemplate() == null) ??
>
> *** Environment ***
>  - CAS Version: 5.2.0-RC4-SNAPSHOT
>  - Java Version: 1.8.0_131
>  - Apache Tomcat Version: Apache Tomcat/8.0.32 (Ubuntu)
>  - Linux Ubuntu Xenial Version: 16.04.3
>
> *** pom.xlm ** *Only relevant changes are:
>
>  <cas.version>5.2.0-RC4-SNAPSHOT</cas.version>
>
>  ...and...
>
>  <dependency>
>     <groupId>org.apereo.cas</groupId>
>     <artifactId>cas-server-support-jdbc</artifactId>
>     <version>${cas.version}</version>
> </dependency>
> <dependency>
>    <groupId>org.apereo.cas</groupId>
>    <artifactId>cas-server-support-jdbc-drivers</artifactId>
>    <version>${cas.version}</version>
> </dependency>
>
> *** cas.properties ***
> Note first, that the following works fine - note the clever trick with 
> *fieldPassword=username*:
>  
>   cas.authn.jdbc.query[0].url=jdbc:mysql:
> //lxc-mysql.home:3306/guacamole_db?useSSL=false
>   cas.authn.jdbc.query[0].driverClass=com.mysql.cj.jdbc.Driver
>   cas.authn.jdbc.query[0].user=guac_username
>   cas.authn.jdbc.query[0].password=guac_password
>
>
>   cas.authn.jdbc.query[0].sql=SELECT * FROM guacamole_user WHERE username
> =?
>   cas.authn.jdbc.query[0].fieldPassword=username
>
>
> However, the following does not work (FWIW, this 
> <https://guacamole.incubator.apache.org/doc/gug/jdbc-auth.html> may be a 
> useful reference):
>   cas.authn.jdbc.encode[0].url=jdbc:mysql:
> //lxc-mysql.home:3306/guacamole_db?useSSL=false
>   cas.authn.jdbc.encode[0].driverClass=com.mysql.cj.jdbc.Driver
>   cas.authn.jdbc.encode[0].dialect=org.hibernate.dialect.MySQL5Dialect
>   cas.authn.jdbc.encode[0].user=guac_username
>   cas.authn.jdbc.encode[0].password=guac_password
>
>
>   cas.authn.jdbc.encode[0].sql=SELECT * FROM guacamole_user WHERE username
> =?
>   cas.authn.jdbc.encode[0].disabledFieldName=disabled
>   cas.authn.jdbc.encode[0].saltFieldName=password_salt
>   cas.authn.jdbc.encode[0].passwordFieldName=password_hash
>   cas.authn.jdbc.encode[0].passwordEncoder.type=DEFAULT
>   cas.authn.jdbc.encode[0].passwordEncoder.characterEncoding=UTF-8
>   cas.authn.jdbc.encode[0].passwordEncoder.encodingAlgorithm=SHA-256
>
>   
> Which throws this error:
> 2017-09-23 23:20:06,446 DEBUG [org.apereo.cas.authentication.
> PolicyBasedAuthenticationManager] - <[
> QueryAndEncodeDatabaseAuthenticationHandler] exception details: [
> Authentication handler is not configured correctly].>
>
>
> I see from QueryAndEncodeDatabaseAuthenticationHandler.java 
> <https://github.com/apereo/cas/blob/master/support/cas-server-support-jdbc-authentication/src/main/java/org/apereo/cas/adaptors/jdbc/QueryAndEncodeDatabaseAuthenticationHandler.java>
>  that:
>  if (StringUtils.isBlank(this.sql) || StringUtils.isBlank(this.
> algorithmName) || getJdbcTemplate() == null) {
>      throw new GeneralSecurityException("Authentication handler is not 
> configured correctly");
>  }
>
> Can anyone suggest a solution, or (heaven forbid) is it a bug?
>
>   
>
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/fd9febe5-45dd-4473-8e61-43864bab9a4b%40apereo.org.

Reply via email to