cas4.10 mysql 配置_CAS配置数据源,数据库用户认证

CAS配置数据源,数据库用户认证

第一步:新建数据和表:CREATE DATABASE /*!32312 IF NOT EXISTS*/`db_sso` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE `db_sso`;

/*Table structure for table `t_cas` */

DROP TABLE IF EXISTS `t_cas`;

CREATE TABLE `t_cas` (

`id` int(11) NOT NULL AUTO_INCREMENT,

`username` varchar(30) DEFAULT NULL,

`password` varchar(100) DEFAULT NULL,

PRIMARY KEY (`id`)

) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;

/*Data for the table `t_cas` */

insert  into `t_cas`(`id`,`username`,`password`) values (1,'java1234','123456');

第二步:修改application.properties配置文件

注释掉写死的认证用户

加上jdbc数据源配置# cas.authn.accept.users=casuser::Mellon

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

cas.authn.jdbc.query[0].url=jdbc:mysql://localhost:3306/db_sso?serverTimezone=GMT

cas.authn.jdbc.query[0].user=root

cas.authn.jdbc.query[0].password=123456

cas.authn.jdbc.query[0].sql=select * from t_cas where username=?

cas.authn.jdbc.query[0].fieldPassword=password

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

第三步:加上jdbc驱动包以及支持jar

0f8b45482b4086e9bd29541516a39c3d.png

第四步:测试OK

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值