I am attempting to use the Shiro JdbcRealm and SHA256 hashedcredentialsMatcher. I need to update a legacy database and assign the appropriate salt for each user (via a batch routine).
how do I get/set the salt for a given account using the Shiro framework?
Maybe a bit late:
Have a look at this tutorial.
Meri, the guy who owns the blog, describes exactly how to create an own salted JDBC Realm.
This is also an acknowledged improvement in the community for version 1.3.0 .
Hope this helpes, have Fun!
With Shiro 1.2.3 all you need to do is:
Extend
JdbcRealm
and set salt style.Update
shiro.ini
to use extended realm and to get salt column from DBHash & salt current / new user passwords. This should be done for all existing users as well as on new user registrations.
I hope my answer is clear and understandable.