How to setup CAS 5.0.x to work with mysql

1,858 views
Skip to first unread message

Adam Waring

unread,
Feb 19, 2017, 4:09:38 PM2/19/17
to CAS Community
Hi all,

I am looking for a comprehensive way to setup CAS with mysql, I have seen many many guides on how to setup previous versions but so far nothing complete on how to setup the newest version. All I get is the annoying message saying static authentication should not be used...


Here is what I have come up with so far extra to that in cas.properties:

 
cas.authn.jdbc.encode[0].sql=SELECT password FROM user WHERE username=?
cas.authn.jdbc.encode[0].url=jdbc:mysql://localhost:3306/CAS
cas.authn.jdbc.encode[0].driverClass=com.mysql.jdbc.Driver
cas.authn.jdbc.encode[0].user=cas_user
cas.authn.jdbc.encode[0].password=password
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-512

And I added this to the pom.xml but other than that it is the blank template supplied by apereo from git.

<!--    <dependency>
            <groupId>org.jasig.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>

Yes I realise the first is commented out but the guides show that I should have it but when i try to compile it fails unless I remove the cas-server-support-jdbc dependency.


After 3 days I am tearing my hair out any sort of input is welcomed!

Maarten Naberink

unread,
Feb 23, 2017, 4:59:44 AM2/23/17
to CAS Community
Maybe you figured it out already but have you tried to disable the static user? 

in application.properties change: cas.authn.accept.users=casuser::Mellon to: cas.authn.accept.users=

Mohamad Anbari

unread,
Feb 23, 2017, 5:27:00 AM2/23/17
to CAS Community
Hi

first of all I think you should move your configurations from cas.properties to application.properties ( src/main/resources/application.properties) then uncomment your cas-server-support-jdbc dependency ( both dependencies need )

Maarten Naberink

unread,
Feb 23, 2017, 6:15:22 AM2/23/17
to CAS Community
Please note that for including the cas-server-support-jdbc you need to change the group from org.jasig.cas to org.apereo.cas (because v.5)

On the other hand I found this: 

On https://apereo.github.io/cas/5.0.x/installation/JDBC-Drivers.html it states: 

<dependency>
   <groupId>org.apereo.cas</groupId>
   <artifactId>cas-server-support-jdbc-drivers</artifactId>
   <version>${cas.version}</version>
</dependency>

Automatic support for database drivers includes:

  1. HSQLDB
  2. MySQL
  3. PostgreSQL
  4. MariaDB
  5. Microsoft SQL Server (JTDS)
  6. Sybase

All other drivers need to be manually added to the build configuration.


This would suggest that only cas-server-support-jdbc-drivers is necessary.

Adam Waring

unread,
Feb 23, 2017, 6:46:11 AM2/23/17
to jasig-cas-user, cas-...@apereo.org, md.a...@gmail.com
cas fails to start if both cas-server-support-jdbc and cas-server-support-jdbc-drivers are included in dependencies??

commenting out this dependency and moving cas.properties to application.properties like you suggested makes the application fail to start also?

assuming what you have said is correct is there anything in the cas.properties file that would make the application fail as that is the only part of this I have changed?

as.server.name: https://<my domain>
cas.server.prefix: https://<my domain>/cas

cas.adminPagesSecurity.ip=127\.0\.0\.1

logging.config: file:/etc/cas/config/log4j2.xml
# cas.serviceRegistry.config.location: classpath:/services




cas.authn.jdbc.encode[0].sql=SELECT password FROM users WHERE username=?
cas.authn.jdbc.encode[0].url=jdbc:mysql://debserver:3306/CAS_db
cas.authn.jdbc.encode[0].driverClass=com.mysql.jdbc.Driver
cas.authn.jdbc.encode[0].user=cas
cas.authn.jdbc.encode[0].password=cas

Adam Waring

unread,
Feb 24, 2017, 4:37:25 AM2/24/17
to jasig-cas-user, cas-...@apereo.org, marti...@gmail.com
So if you look at the next dependancy down after the comment that is what i had included if i compile with both i then get an error in tomcat that cas failed to start - hence why it was commented out in the first place
--
- 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+u...@apereo.org.
To view this discussion on the web visit https://groups.google.com/a/apereo.org/d/msgid/cas-user/da29f6ab-bb78-494e-9359-4de239202978%40apereo.org.
Reply all
Reply to author
Forward
0 new messages