cas 4.2.1

来源:互联网 发布:马小丝的淘宝 编辑:程序博客网 时间:2024/05/20 15:58

1、加入cas-server-support-jdbc 引用,配置数据库连接 QueryDatabaseAuthenticationHandler

2、配置数据库看连接池 cas-server-webapp 下的 cas.properties

# == Basic database connection pool configuration ==database.driverClass=com.mysql.jdbc.Driverdatabase.url=jdbc:mysql://127.0.0.1:3306/admin?useUnicode=true&characterEncoding=utf8database.user=rootdatabase.password=123456database.pool.minSize=6database.pool.maxSize=18# Maximum amount of time to wait in ms for a connection to become# available when the pool is exhausteddatabase.pool.maxWait=10000# Amount of time in seconds after which idle connections# in excess of minimum size are pruned.database.pool.maxIdleTime=120# Number of connections to obtain on pool exhaustion condition.# The maximum pool size is always respected when acquiring# new connections.database.pool.acquireIncrement=6# == Connection testing settings ==# Period in s at which a health query will be issued on idle# connections to determine connection liveliness.database.pool.idleConnectionTestPeriod=30# Query executed periodically to test healthdatabase.pool.connectionHealthQuery=select 1# == Database recovery settings ==# Number of times to retry acquiring a _new_ connection# when an error is encountered during acquisition.database.pool.acquireRetryAttempts=5# Amount of time in ms to wait between successive aquire retry attempts.database.pool.acquireRetryDelay=2000

deployConfigContext.xml

<bean id="dataSource"      class="com.mchange.v2.c3p0.ComboPooledDataSource"      p:driverClass="${database.driverClass}"      p:jdbcUrl="${database.url}"      p:user="${database.user}"      p:password="${database.password}"      p:initialPoolSize="${database.pool.minSize}"      p:minPoolSize="${database.pool.minSize}"      p:maxPoolSize="${database.pool.maxSize}"      p:maxIdleTimeExcessConnections="${database.pool.maxIdleTime}"      p:checkoutTimeout="${database.pool.maxWait}"      p:acquireIncrement="${database.pool.acquireIncrement}"      p:acquireRetryAttempts="${database.pool.acquireRetryAttempts}"      p:acquireRetryDelay="${database.pool.acquireRetryDelay}"      p:idleConnectionTestPeriod="${database.pool.idleConnectionTestPeriod}"      p:preferredTestQuery="${database.pool.connectionHealthQuery}" />
可以自定义 druid
加入配置
<alias name="queryDatabaseAuthenticationHandler" alias="primaryAuthenticationHandler" /><alias name="dataSource" alias="queryDatabaseDataSource" /><alias name="dataSource" alias="queryEncodeDatabaseDataSource" />
注释掉
<util:map id="authenticationHandlersResolvers">    <entry key-ref="proxyAuthenticationHandler" value-ref="proxyPrincipalResolver" />    <entry key-ref="primaryAuthenticationHandler" value-ref="primaryPrincipalResolver" />    <!--<entry key-ref="primaryDatabaseAuthenticationHandler" value-ref="primaryPrincipalResolver" />--></util:map>

<!--<alias name="acceptUsersAuthenticationHandler" alias="primaryAuthenticationHandler" />-->
3、数据库查询用户密码
cas.jdbc.authn.query.sql=select password from users where username=?

4、安全验证
# Decides whether SSO cookie should be created only under secure connections. default truetgc.secure=false# The expiration value of the SSO cookietgc.maxAge=-1# The name of the SSO cookietgc.name=TGC# The path to which the SSO cookie will be scopedtgc.path=/cas# The expiration value of the SSO cookie for long-term authenticationstgc.remember.me.maxAge=1209600# Decides whether SSO Warning cookie should be created only under secure connections.warn.cookie.secure=false# The expiration value of the SSO Warning cookiewarn.cookie.maxAge=-1# The name of the SSO Warning cookiewarn.cookie.name=CASPRIVACY# The path to which the SSO Warning cookie will be scopedwarn.cookie.path=/cas
5、最后设置 访问请求 http支持
resources/services/HTTPSandIMAPS-10000001.json
"serviceId" : "^(https|imaps|http)://.*",
加入http支持

0 0