JDBC Authentication Handler
Including the Handler
In the pom.xml file for your CAS webapp (the default is ${project.home}/cas-server-webapp/pom.xml) add the following dependency:
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>cas-server-support-jdbc</artifactId>
<version>${project.version}</version>
</dependency>
Core Classes
Note that all JDBC AuthenticationHandlers have the requirement for a DataSource. Each handler's section will only list additional properties beyond the DataSource.
BindModeSearchDatabaseAuthenticationHandler
This authentication handler attempts to take the provided credentials and open a connection with them.
QueryDatabaseAuthenticationHandler
This authentication handler takes a database query (who's value is a password and one parameter is a username). It will then compare the password from the database with the password provided by the user (after encoding via the PasswordEncoder).
Properties:
- sql - The SQL statement, in the following format: "Select password from table where username = ?"
- passwordEncoder - The PasswordEncoder to use. The default is the PlainTextPasswordEncoder.
SearchModeSearchDatabaseAuthenticationHandler
Given a table, username field and password field, this will query a database table with the provided encryption technique to see if the user exists.
Properties:
- fieldUser - the name of the field containing the username
- fieldPassword - the name of the field containing the password
- tableUsers - the name of the table containing the users