Unable to use MySQL as database authentication

41 views
Skip to first unread message

cheekian yap

unread,
Nov 30, 2020, 2:28:34 AM11/30/20
to CAS Community
#Version
- CAS 6.2.5
- JDK 11

I am new to CAS. Now I'm trying to store all the user credentials in mysql. Below is what I have configure in application.properties:

#cas.authn.accept.users=casuser::Mellon
#cas.authn.accept.name=Static Credentials

cas.authn.jdbc.query[0].user=root
cas.authn.jdbc.query[0].password=123456
cas.authn.jdbc.query[0].driver-class=com.mysql.cj.jdbc.Driver
cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/cas?useUnicode=true&characterEncoding=UTF-8
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect

cas.authn.jdbc.query[0].sql=select * from user_info where username=?
cas.authn.jdbc.query[0].field-password=password

in build.gradle
dependencies {
    implementation "org.apereo.cas:cas-server-support-jdbc:${project.'cas.version'}"
}

However, I got this error when filling up the login form:
2020-11-30 07:21:27,694 ERROR [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authentication has failed. Credentials may be incorrect or CAS cannot find authentication handler that supports [UsernamePasswordCredential(username=yaptest, source=null, customFields={})] of type [UsernamePasswordCredential]. Examine the configuration to ensure a method of authentication is defined and analyze CAS logs at DEBUG level to trace the authentication event.>

2020-11-30 07:21:27,694 ERROR 
[org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <[QueryDatabaseAuthenticationHandler]: [SQL exception while executing query for yaptest / Failed to obtain JDBC Connection; nested exception is java.sql.SQLException: Access denied for user 'root'@'localhost']>

I'm pretty sure the credential for root account is correct.



Kartik Mehta

unread,
Nov 30, 2020, 4:25:23 AM11/30/20
to cas-...@apereo.org
looks like the database user does not have read access to the user_info table.

regards,
Kartik

--
- 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 cas-user+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/917506bd-2123-4344-823a-4fabb3c62bc7n%40apereo.org.
Reply all
Reply to author
Forward
0 new messages