其他分享
首页 > 其他分享> > 如何在Spring-Security中重命名表persistent_logins

如何在Spring-Security中重命名表persistent_logins

作者:互联网

Spring Security中管理remember-me身份验证的默认表名是“persistent_logins”.

由于数据库命名约定,我需要将此表“persistent_logins”重命名为“T_PERSISTENT_LOGINS”.

请帮忙.

解决方法:

您需要编写自己的JdbcTokenRepositoryImpl实现

创建一个扩展JdbcDaoSupport并实现PersistentTokenRepository的类

在Spring Application Context Config中将此类配置为bean,然后将其设置为remember-me Spring Security Config的token-repository-ref属性

但坦率地说,我首先要改变你的表命名策略.

标签:security,authentication,spring,remember-me
来源: https://codeday.me/bug/20190623/1269670.html