Wednesday, November 3, 2010

Spring Security 3.0.4 and PasswordEncoder

We needed to encode our passwords stored in a simple properties file using SHA 256, and also later base64 encode this hash. A few searches in the Spring documentation, and downloading the sources did the trick.
So, attached below are the configuration changes you need to make for the same:

Add the following entries to your Spring Application Context file:

The property encodeHashAsBase64 if enabled, will give us the base64 encoded string of the hash.  The should now have the username, based 64 encoded password, and all the roles associated to that user.

Simple , easy and elegant.

I will keep posting as and when I discover new things about Spring Security 3.0.4

No comments:

Post a Comment