cas 自定义数据库用户名、密码验证登录

cas自带QueryDatabaseAuthenticationHandler和SearchModeSearchDatabaseAuthenticationHandler这两个类作为JDBC方式验证用户的处理器。这两个处理类位于cas-server-support-jdbc这个扩展工程下。修改application.properties配置文件如下

 

cas.authn.jdbc.query[0].url=jdbc:mysql://127.0.0.1:3306/springdemo?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&serverTimezone=GMT%2B8
cas.authn.jdbc.query[0].user=root
cas.authn.jdbc.query[0].password=1111
cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver
cas.authn.jdbc.query[0].sql=select password from user where name=?
cas.authn.jdbc.query[0].fieldPassword=password

下面一张图是数据库与配置文件的对应

 

 

底层实现流程:

步骤:进行断点调试,断点所在位置:

 build.cmd debug启动项目,输入登陆信息

 使用idea--run---attache the process 选择当前项目,即可进入断点位置

 流程分析:

实现自定义登录,只需要实现org.jasig.cas.authentication.handler.AuthenticationHandler接口即可,    AuthenticationHandler认证处理程序

在界面输入用户名,密码点击登陆,系统进入以上位置进行验证,此时传输的数值已经对密码进行md5加密

 

转载于:https://www.cnblogs.com/ljangle/p/10077642.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值