cas 4.2.1

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

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

# == Basic database connection pool configuration ==
database.driverClass=com.mysql.jdbc.Driver
database.url=jdbc:mysql://127.0.0.1:3306/admin?useUnicode=true&characterEncoding=utf8
database.user=root
database.password=123456
database.pool.minSize=6
database.pool.maxSize=18

# Maximum amount of time to wait in ms for a connection to become
# available when the pool is exhausted
database.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 health
database.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 true
tgc.secure=false

# The expiration value of the SSO cookie
tgc.maxAge=-1

# The name of the SSO cookie
tgc.name=TGC

# The path to which the SSO cookie will be scoped
tgc.path=/cas

# The expiration value of the SSO cookie for long-term authentications
tgc.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 cookie
warn.cookie.maxAge=-1

# The name of the SSO Warning cookie
warn.cookie.name=CASPRIVACY

# The path to which the SSO Warning cookie will be scoped
warn.cookie.path=/cas
5、最后设置 访问请求 http支持
resources/services/HTTPSandIMAPS-10000001.json
"serviceId" : "^(https|imaps|http)://.*",
加入http支持

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值