org.springframework.security.crypto.password.MessageDigestPasswordEncoder Java Examples

The following examples show how to use org.springframework.security.crypto.password.MessageDigestPasswordEncoder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SecurityConfig.java    From Spring-Boot-2.0-Projects with MIT License 5 votes vote down vote up
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
    auth.inMemoryAuthentication()
            .passwordEncoder(new MessageDigestPasswordEncoder("SHA-256"))
            .withUser("user")
            .password("5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8")
            .roles("USER")
            .and()
            .withUser("sysuser")
            .password("5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8")
            .roles("SYSTEM");
}
 
Example #2
Source File: WebSecurityConfiguration.java    From Parrit with MIT License 5 votes vote down vote up
@Bean
public PasswordEncoder passwordEncoder() {
    Map<String, PasswordEncoder> encoders = new HashMap<>();
    encoders.put("bcrypt", new BCryptPasswordEncoder());
    encoders.put("sha256", new MessageDigestPasswordEncoder("SHA-256"));
    return new DelegatingPasswordEncoder("bcrypt", encoders);
}
 
Example #3
Source File: CustomAuthenticationApplication.java    From Spring with Apache License 2.0 4 votes vote down vote up
PasswordEncoder oldPasswordEncoder() {
	String md5 = "MD5";
	return new DelegatingPasswordEncoder(md5,
			Collections.singletonMap(md5, new MessageDigestPasswordEncoder(md5)));
}