apereo cas mysql_Apereo CAS 5.0.X 配置数据库认证方式

Apereo CAS 5.0.X 使用Spring Boot的方式重构了项目,配置也发生了很大的变化。配置文件都在cas项目下的WEB-INF/classes目录下面,配置文件较多,后边详细说,这里先说下Apereo CAS 5.0.X行为的配置文件application.properties。

CAS 5.0.X默认使用static

重新编译打包

在cas-overlay-template项目中引入cas-server-support-jdbc依赖,重新打包。

静态认证

CAS 5.0.X默认的认证方式是Static Authentication,也就是在application.properties文件中,有一行配置如下,

cas.authn.accept.users=casuser::Mellon

也就是用casuser作为用户名,Mellon作为密码就能登录系统。如果要使用数据库方式认证的话,首先把这行配置注释掉,然后添加数据库认证相关的配置,就开启只有数据库认证的模式了,这种模式就可以用于生产环境了。这里的相关内容可以参考Authentication Manager相关的文档,地址如下https://apereo.github.io/cas/5.0.x/installation/Configuring-Authentication-Components.html#authentication-handlers。

配置相关参数

配置数据库认证相关的参数有四类,Query、Search、Bind、Encode,这四种的意思可以结合http://www.voidcn.com/article/p-cwkueose-bpc.html这篇文章理解一下。下面已Query方式为例配置。在application.properties文件中添加下面的配置。

cas.authn.jdbc.query[0].sql=SELECT login_pass FROM t_user WHERE username=?

cas.authn.jdbc.query[0].healthQuery=SELECT 1

cas.authn.jdbc.query[0].isolateInternalQueries=false

cas.authn.jdbc.query[0].url=jdbc:mysql://ip:port/castest?createDatabaseIfNotExist=true&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true

cas.authn.jdbc.query[0].failFast=true

cas.authn.jdbc.query[0].isolationLevelName=ISOLATION_READ_COMMITTED

cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect

cas.authn.jdbc.query[0].leakThreshold=10

cas.authn.jdbc.query[0].propagationBehaviorName=PROPAGATION_REQUIRED

cas.authn.jdbc.query[0].batchSize=1

cas.authn.jdbc.query[0].user=database-username

cas.authn.jdbc.query[0].ddlAuto=create-drop

cas.authn.jdbc.query[0].maxAgeDays=180

cas.authn.jdbc.query[0].password=database-password

cas.authn.jdbc.query[0].autocommit=false

cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver

cas.authn.jdbc.query[0].idleTimeout=5000

# cas.authn.jdbc.query[0].credentialCriteria=

# cas.authn.jdbc.query[0].passwordEncoder.type=NONE|DEFAULT|STANDARD|BCRYPT

# cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=

# cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=

# cas.authn.jdbc.query[0].passwordEncoder.secret=

# cas.authn.jdbc.query[0].passwordEncoder.strength=16

# cas.authn.jdbc.query[0].principalTransformation.suffix=

# cas.authn.jdbc.query[0].principalTransformation.caseConversion=NONE|UPPERCASE|LOWERCASE

# cas.authn.jdbc.query[0].principalTransformation.prefix=

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值