1. It is introduced in pom.xml. Since the ojdbc6.jar package cannot be imported directly in the POM file, Download ojdbc6.jar and import it manually in WEB-INF/lib under the overlays directory
<dependency> <groupId>org.jasig.cas</groupId> <artifactId>cas-server-support-jdbc</artifactId> <version>4.2.7</version> </dependency>
2. Open the connection database configuration in cas.properties
cas.audit.database.show.sql=true cas.audit.database.driverClass=oracle.jdbc.driver.OracleDriver cas.audit.database.url=jdbc:oracle:thin:@101.81.119.120:1521:intelligent cas.audit.database.user=intelligent cas.audit.database.password=123456 cas.audit.database.pool.minSize=6 cas.audit.database.pool.maxSize=18 cas.audit.database.pool.maxIdleTime=120 cas.audit.database.pool.maxWait=10000 cas.audit.database.pool.acquireIncrement=6 cas.audit.database.pool.acquireRetryAttempts=5 cas.audit.database.pool.acquireRetryDelay=2000 cas.audit.database.pool.idleConnectionTestPeriod=30 cas.audit.database.pool.connectionHealthQuery=select 1
3. Find cas.jdbc.authn.query.sql to open the comment, and write the relevant statement according to the user table information
Note: only one parameter of password can be queried
4. According to the encryption of your own password, if the password is encrypted, find
cas.authn.password.encoding.char=UTF-8 cas.authn.password.encoding.alg=MD5
Open the comment and encrypt it according to your password
5. Open the deployerConfigContext.xml configuration file
replace <util:map id="authenticationHandlersResolvers"> <entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver"/> <! -- defau lt profile user authentication mode, can be masked -- > <! -- add database authentication -- > <entry key-ref="databaseAuthenticationHandler" value-ref="primaryPrincipalResolver"/> </util:map>
Newly added
<!-- To configure queryDatabaseAuthenticationHandler alias --> <alias name="queryDatabaseAuthenticationHandler" alias="databaseAuthenticationHandler" /> <!-- To configure dataSource alias --> <alias name="dataSource" alias="queryDatabaseDataSource" /> <!--Database connection pool configuration--> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" p:driverClass="${cas.audit.database.driverClass}" p:jdbcUrl="${cas.audit.database.url}" p:user="${cas.audit.database.user}" p:password="${cas.audit.database.password}" p:initialPoolSize="${cas.audit.database.pool.minSize}" p:minPoolSize="${cas.audit.database.pool.minSize}" p:maxPoolSize="${cas.audit.database.pool.maxSize}" p:maxIdleTimeExcessConnections="${cas.audit.database.pool.maxIdleTime}" p:checkoutTimeout="${cas.audit.database.pool.maxWait}" p:acquireIncrement="${cas.audit.database.pool.acquireIncrement}" p:acquireRetryAttempts="${cas.audit.database.pool.acquireRetryAttempts}" p:acquireRetryDelay="${cas.audit.database.pool.acquireRetryDelay}" p:idleConnectionTestPeriod="${cas.audit.database.pool.idleConnectionTestPeriod}" p:preferredTestQuery="${cas.audit.database.pool.connectionHealthQuery}" /> <alias name="defaultPasswordEncoder" alias="passwordEncoder" /> <alias name="serviceThemeResolver" alias="themeResolver"/> <alias name="jsonServiceRegistryDao" alias="serviceRegistryDao"/> <alias name="defaultTicketRegistry" alias="ticketRegistry"/>