Spring安全密码哈希+盐
我正在使用一个以明文形式存储密码的遗留应用程序。我已将应用程序移植到 spring 3 mvc + security。我还成功地让 spring security 使用 sha256 + 基于用户名的盐来处理身份验证和授权。这一切都很好,但是作为部署的一部分,我需要迁移现有数据库以使用新的密码架构。我不确定 Spring Security 如何使用盐对密码进行哈希处理,因此我无法编写可用于将旧的明文密码迁移到新的 sha256+salt 模式的 SQL 脚本。我可以使用任何文档或资源来解决这个问题吗?
I am working with a legacy application that stored passwords in plaintext. I have ported the application to spring 3 mvc + security. I have also successfully gotten spring security handling the authentication and authorization using sha256 + a salt based on the username. This all works great, however as part of the deployment, I will need to migrate the existing database to use the new password schema. I am not sure how spring security does it's password hashing with a salt, so i am unable to write a sql script that can be used to migrate the old plaintext passwords to the new sha256+salt schema. Is there any documentation or resources that I can use to figure this out?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这记录在
BasePasswordEncoder
:因此,在您的情况下,您可以使用以下简单的代码计算加盐密码:
注意:
ShaPasswordEncoder
扩展BasePasswordEncoder
。This is documented in
BasePasswordEncoder
:So in your case you can compute the salted password using this simple code:
Note:
ShaPasswordEncoder
extendsBasePasswordEncoder
.