Spring Data Rest user repository BCCrypt password -
i have spring data rest custom user repository in password need encrypted using bccrypt. ui sending plain password, want know convert plain password bccrypt hash before hibernate creates user in db. should use before save interceptor , hash password? or there way can tell spring use password encoder?
you need in registration-service
, following:
@autowired private bcryptpasswordencoder passwordencoder; ... public void registeruser(final user user) { final string encodedpassword = passwordencoder.encode(user.getpassword()); user.setpassword(encodedpassword); userrepo.save(user); }
the password-encoder refer you, org.springframework.security.crypto.bcrypt.bcryptpasswordencoder
encoder automatically generate salt you.
Comments
Post a Comment