Home > Software engineering >  CAS not connected to Mysql for user authentication
CAS not connected to Mysql for user authentication

Time:04-17

I'm new to CAS.

I like to authenticate user to the list of users inside the Mysql database. I have included this line of code in the build.gradle file

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

Here is the table defination in Mysql.

enter image description here

I have setup an instance of CAS 6.4 in Ubuntu server, disabled static user authentication and configure the /etc/cas/config/cas.properties to use Mysql as data source for authentication as config below, all other settings leave as default:

server.name=https://id.example.com 
server.prefix=${cas.server.name}/
server.context-path=/ server.port=443
server.ssl.key-store=file:/etc/cas/theKeystore
server.ssl.key-store-password=theKeystorePassword
server.ssl.key-password=thePassword
 
logging.config=file:/etc/cas/config/log4j2.xml
 
cas.authn.accept.enabled=false
  
cas.authn.jdbc.query[0].driver-class: com.mysql.jdbc.Driver
cas.authn.jdbc.query[0].field-password: password
cas.authn.jdbc.query[0].password: theDBPassword
cas.authn.jdbc.query[0].sql: SELECT * FROM users WHRE uid=?
cas.authn.jdbc.query[0].url: jdbc:mysql://localhost:3306/cas?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
cas.authn.jdbc.query[0].user: theDBUser

I have set global general_log on Mysql to ON to trace any connection attempt. However, it seems the CAS server never try to connect to the Mysql server. On user site, they simply received attempt failed message on login page.

Is there anything I've missed?

CodePudding user response:

It seems that instead of using

com.mysql.jdbc.Driver

I need to use

com.mysql.cs.jdbc.Driver 

as driver-class.

  • Related