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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -