Hello,
I am experiencing issues regarding my Database authentication configuration in my CAS 5.0.1 server. The database I'm connecting with my CAS server uses PostgreSQL, and deploying the overlay build in Tomcat 8.5. First of all, I have enabled Database Authentication in the application.properties, specifically the Encode handler, since the database uses a salt value for hashing the password. As far as I know, I have applied the most basic configuration for the database authentication setup, but if I try to authenticate directly against the CAS server (not redirected from any url), it always end up not being successful. I am very sure that I am using the correct credentials, but I still experience an invalid authentication.
Originally, I am accessing the database from a remote, but I also tried using a local PostgreSQL database with similar unfortunate results. This is the basic configuration I'm using in the application.properties (I purposely used my local setup and some example values here):
cas.authn.jdbc.encode[0].sql=SELECT password FROM public.user WHERE email=?
cas.authn.jdbc.encode[0].url=jdbc:postgresql://localhost:5432/tracking
cas.authn.jdbc.encode[0].driverClass=org.postgresql.Driver
cas.authn.jdbc.encode[0].user=sample_username
cas.authn.jdbc.encode[0].password=sample_password
cas.authn.jdbc.encode[0].saltFieldName=salt
cas.authn.jdbc.encode[0].passwordFieldName=password
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
The password encoder setup should be right since the database uses SHA-1 password encryption.
This is what the tomcat logs says about:
2017-02-03 15:06:33,024 WARN [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authentication has failed. Credentials may be incorrect or CAS cannot find authentication handler that supports [jihad] of type [UsernamePasswordCredential], which suggests a configuration problem.>
2017-02-03 15:06:33,075 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHO: jihad
WHAT: Supplied credentials: [jihad]
ACTION: AUTHENTICATION_FAILED
APPLICATION: CAS
WHEN: Fri Feb 03 15:06:33 PHT 2017
CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1
=============================================================
>
2017-02-03 15:06:33,210 ERROR [org.apereo.cas.web.flow.AuthenticationExceptionHandler] - <Unable to translate handler errors of the authentication exception org.apereo.cas.authentication.AuthenticationException: 1 errors, 0 successes. Returning UNKNOWN by default...>
I am hoping someone could help about this issue. Thank you in advance.
--Jihad