cas用户验证 postgresql 数据库连接方式

cas 数据库验证用户模式,网上几乎都是统一的mysql模式,其实postgresql也差不多,不多说,上干货。

首先是在编译war包前,在pom文件增加一下几个节点即可。

 <dependency>
                    <groupId>org.apereo.cas</groupId>
                    <artifactId>cas-server-webapp${app.server}</artifactId>
                    <version>${cas.version}</version>
                    <type>war</type>
                    <scope>runtime</scope>
                </dependency>

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

				<dependency>
    				<groupId>org.postgresql</groupId>
    				<artifactId>postgresql</artifactId>
					<version>42.1.1</version>
				</dependency>

这其实就是postgresql数据库驱动包打进去。打包生成war包后,同上一个文章一样,放tomcat下解压,然后再修改 application.properties 

这个application.properties文件修改简单,把原来的 cas.authn.accept.users=admin::admin 注释,增加下面一些内容

cas.authn.jdbc.query[0].sql=select * from system_user WHERE username=?
cas.authn.jdbc.query[0].url=jdbc:postgresql://10.212.170.186:5432/afptdb4
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.PostgreSQLDialect
cas.authn.jdbc.query[0].user=postgres
cas.authn.jdbc.query[0].password=#@!_9987AbcCE~
cas.authn.jdbc.query[0].driverClass=org.postgresql.Driver
cas.authn.jdbc.query[0].fieldPassword=password

cas.authn.jdbc.query[0].passwordEncoder.type=DEFAULT
cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8
cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5

上面这些内容相信程序员都能看懂。

最后一句 cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm=MD5 意思是密码 md5 方式加密

 

 

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值