How can I hash passwords and salt them with Spring Security 3?
Programmatic-ally you would do it as follows:
In your application-context.xml (defined in web.xml under
contextConfigLocation) file define the bean (this example uses
<bean class="org.springframework.security.authentication.encoding.Md5PasswordEncoder" id="passwordEncoder" />
Then Autowire the password encoder:
@Autowired PasswordEncoder passwordEncoder;
In your method or wherever you want to hash and salt.
The above call should return a salted hash (as a
That should do it. I'm assuming you can figure out the jar's you'll need.