cas server 连接mysqlshi'bai

Joey Liao 2020-05-29 07:15:44
之前使用默认账户名密码登录是ok的

然后加上数据库后失败;

新增的配置:
pom.xml:
<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-jdbc</artifactId>
<version>${cas.version}</version>
</dependency>


<dependency>
<groupId>org.apereo.cas</groupId>
<artifactId>cas-server-support-jdbc-drivers</artifactId>
<version>${cas.version}</version>
</dependency>

新增的properties:
#Query Database Authentication 数据库查询校验用户名开始
#查询账号密码sql,必须包含密码字段
cas.authn.jdbc.query[0].sql=select * from casuser where username=?
#指定上面的sql查询字段名(必须)
cas.authn.jdbc.query[0].fieldPassword=password
#数据库驱动
cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver
#数据库连接
cas.authn.jdbc.query[0].url=jdbc:mysql://localhost:3306/cas?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT&allowPublicKeyRetrieval=true
#数据库用户名
cas.authn.jdbc.query[0].user=root
#数据库密码
cas.authn.jdbc.query[0].password=xxxxx

#Query Database Authentication 数据库查询校验用户名结束
数据库和表都是对的
加上这些后输入账密就不能登录了:
WHO: audit:unknown
WHAT: [event=success,timestamp=Fri May 29 18:48:31 CST 2020,source=RankedAuthenticationProviderWebflowEventResolver]
ACTION: AUTHENTICATION_EVENT_TRIGGERED
APPLICATION: CAS
WHEN: Fri May 29 18:48:31 CST 2020
CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1
=============================================================

>
2020-05-29 18:48:41,201 WARN [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authentication has failed. Credentials may be incorrect or CAS cannot find authentication handler that supports [liaozeyu] of type [UsernamePasswordCredential], which suggests a configuration problem.>
2020-05-29 18:48:41,210 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHO: liaozeyu
WHAT: Supplied credentials: [liaozeyu]
ACTION: AUTHENTICATION_FAILED
APPLICATION: CAS
WHEN: Fri May 29 18:48:41 CST 2020
CLIENT IP ADDRESS: 127.0.0.1
SERVER IP ADDRESS: 127.0.0.1
...全文
333 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
王彦彰 2022-11-16
  • 打赏
  • 举报
回复

解决了吗?

ss11s2 2023-01-11
  • 举报
回复
@王彦彰 解决了吗

56,679

社区成员

发帖
与我相关
我的任务
社区描述
MySQL相关内容讨论专区
社区管理员
  • MySQL
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧