As of Spring Security 3.1.4.RELEASE, the old org.springframework.security.authentication.encoding.PasswordEncoder
has been deprecated in favour of org.springframework.security.crypto.password.PasswordEncoder
. As my application has not been released to the public yet, I decided to move to the new, not deprecated API.
Until now, I had a ReflectionSaltSource
that automatically used the user's registration date as per-user salt for password.
String encodedPassword = passwordEncoder.encodePassword(rawPassword, saltSource.getSalt(user));
During login process, Spring also used my beans to appropriate verify if the user can or can not sign in. I can't achieve this in the new password encoder, because the default implementation of SHA-1 - StandardPasswordEncoder
has only ability to add a global secret salt during the encoder creation.
Is there any reasonable method of how to set it up with the non-deprecated API?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…