Grails Spring Security Plugin Migrate User Passwords from 1.2.7.3 to 2.0

主宰稳场 提交于 2019-12-07 20:19:19

问题


I am using Grails 2.3.2 and am trying to upgrade my Spring Security Core Plugin from 1.2.7.3 to 2.0.

I made all the import changes and got my app to start, but I was unable to login. One of the changes in 2.0 is that it uses the bcrypt algorithm for passwords, making all my old passwords useless. So, I went through the password reset process in my app and sure enough after that I could log in just fine.

But, I want to keep my old passwords for all my users, so I went and found the documentation for the 1.2.7.3 version of the plugin and looked up what algorithm it used: http://grails-plugins.github.io/grails-spring-security-core/docs/manual.1273/guide/12%20Password%20and%20Account%20Protection.html

According to these docs its default is SHA-256. So, I added that config change, yet I still cannot log in.

So, how can I migrate all my user's passwords to the 2.0 version of the plugin? As of right now it doesn't seem possible...


回答1:


There's another change - the number of hash iterations. In 1.2.x the password was hashed once but in 2.0 it's hashed 10,000 times for password stretching - see http://grails-plugins.github.io/grails-spring-security-core/2.0.x/guide/passwords.html#hashing

Add this to revert to the old behavior:

grails.plugin.springsecurity.password.algorithm = 'SHA-256'
grails.plugin.springsecurity.password.hash.iterations = 1


来源:https://stackoverflow.com/questions/20533477/grails-spring-security-plugin-migrate-user-passwords-from-1-2-7-3-to-2-0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!