Spring Security : Encrypt password

Manish Kumar

I am using spring 3.2.5. Righ now i am hashing password using

        MessageDigest messageDigest = MessageDigest.getInstance("SHA-512");
        messageDigest.update(password.getBytes("UTF-8"));
        byte[] digestBytes = messageDigest.digest();

I want to secure password using methods provided by spring. I searched internet and most of the post are very old. So any example will be fine.

Jeevan Patil

You can use org.springframework.security.crypto.password.StandardPasswordEncoder class. It is a lot less hassle, you don't have to worry about salt and iterations - the details are completely encapsulated within the encoder.

<!-- password encoder -->
<beans:bean id="encoder" class="org.springframework.security.crypto.password.StandardPasswordEncoder" />


<!-- This is the authentication manager -->
<authentication-manager>
   <authentication-provider user-service-ref="authService">
    <password-encoder ref="encoder" />
   </authentication-provider>
</authentication-manager>

Visit this site to know more.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Password encrypt and decrypt using Spring-security

Spring Security - Get clear password on authentication and re-encrypt them

Spring Boot Rest Security Basic Auth Password Encoder does not encrypt password on login

How to encrypt password using Python Flask-Security using bcrypt?

Spring security_Password Encryption

Username Password Authentication in Spring Security

Spring Security 5.2 Password Flow

Spring security: get password in UserDetailsServiceMethod

Recover username and password with spring security

Password is not getting encoded in spring security

Encrypt Password

Java spring boot encrypt admin password before storing it in database?

How to use Spring security without password encoding?

Remove "Using default security password" on Spring Boot

Spring Security BASIC auth - matching password hash

Spring Security Basic Auth Password Rotation Issue

BCrypt: Empty Encoded Password with Spring Security

Read username/password from a file in Spring Security

Spring Security force logout when password change

spring security encode password with bcrypt algorithm

Is there a way to configure password encoder for default spring security password

why spring security gives empty password to password encoder?

Spring Security - Conceptual question around generated security password

flask-security encrypt_password('mypassword') varies every time when i reload the page

Password encoding and decoding using Spring Security, Spring Boot and MongoDB

Spring Boot/ Spring Security, login form, password checking

Encrypt alfresco password

Encrypt password fields in mongodb

Laravel authentication with encrypt password

TOP Ranking

HotTag

Archive