kawhii / sso

cas单点登录系统,其中包括cas认证服务,配置中心,监控平台,服务管理的高可用项目

Home Page:https://kawhii.github.io/sso

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

集成本地数据库密码加盐问题

BinyangChen opened this issue · comments

2018-05-14 16:13:04,599 DEBUG [org.springframework.jdbc.core.JdbcTemplate] -
2018-05-14 16:13:04,599 DEBUG [org.springframework.jdbc.core.JdbcTemplate] - <Executing prepared SQL statement [select * from tb_user where username=?]>
2018-05-14 16:13:04,599 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] -
2018-05-14 16:13:04,776 DEBUG [org.springframework.jdbc.datasource.DataSourceUtils] -
2018-05-14 16:13:04,790 INFO [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <[QueryAndEncodeDatabaseAuthenticationHandler] failed authenticating [475324975@qq.co
m]>
2018-05-14 16:13:04,790 DEBUG [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <[QueryAndEncodeDatabaseAuthenticationHandler] exception details: [Password does not
match value on record.]>
2018-05-14 16:13:04,792 WARN [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authentication has failed. Credentials may be incorrect or CAS cannot find authentic
ation handler that supports [475324975@qq.com] of type [UsernamePasswordSysCredential], which suggests a configuration problem.>
2018-05-14 16:13:04,797 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN

链接我的本地数据库但是我本地的数据库的密码时先加salt 然后 在MD5(passwor+salt),这个在项目里怎么修改配置呢?

我的盐值 是保存在数据库里的 怎么修改你的配置文件 能让密码是 md5(password+盐) 呢 ?
我看配置文件有 :cas.authn.jdbc.encode[0].saltFieldName= 和 cas.authn.jdbc.encode[0].staticSalt= 我这边配置了 还是不行。是我配置错了吗 ?

若是放在字段中,则配置saltFieldName,确认是否加盐规则正确

你好 我数据里的字段 randomKey 是保存盐值的 但是 我把 satlFidleName = randomKey 了 重启config 运行 server 测试还是提示密码值不匹配

cas.authn.jdbc.encode[0].numberOfIterations=2
#\u8BE5\u5217\u540D\u7684\u503C\u53EF\u66FF\u4EE3\u4E0A\u9762\u7684\u503C\uFF0C\u4F46\u5BF9\u5BC6\u7801\u52A0\u5BC6\u65F6\u5FC5\u987B\u53D6\u8BE5\u503C\u8FDB\u884C\u5904\u7406
cas.authn.jdbc.encode[0].numberOfIterationsFieldName=

\u76D0\u503C\u56FA\u5B9A\u5217

cas.authn.jdbc.encode[0].saltFieldName=randomKey
#\u9759\u6001\u76D0\u503C
cas.authn.jdbc.encode[0].staticSalt=
cas.authn.jdbc.encode[0].sql=select * from tb_user where username=?
#\u5BF9\u5904\u7406\u76D0\u503C\u540E\u7684\u7B97\u6CD5
cas.authn.jdbc.encode[0].algorithmName=MD5
cas.authn.jdbc.encode[0].passwordFieldName=password
cas.authn.jdbc.encode[0].expiredFieldName=expired
cas.authn.jdbc.encode[0].disabledFieldName=disabled
cas.authn.jdbc.encode[0].url=jdbc:mysql://localhost:3306/XXXX?useUnicode=true&characterEncoding=utf-8
cas.authn.jdbc.encode[0].dialect=org.hibernate.dialect.MySQL5InnoDBDialect
cas.authn.jdbc.encode[0].user=XXXXX
cas.authn.jdbc.encode[0].password=XXXXXX
cas.authn.jdbc.encode[0].driverClass=com.mysql.jdbc.Driver

numberOfIterations 跟这个配置有关,debug确定cas加密与库中的区别