Merge pull request #3916 from steinhauer-software/BAEL-1489

BAEL-1489: Password storage in Spring Security 5
This commit is contained in:
José Carlos Valero Sánchez 2018-04-03 08:27:41 +01:00 committed by GitHub
commit 30eeb09828
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 92 additions and 90 deletions

View File

@ -12,7 +12,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.0.RC2</version>
<version>2.0.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

View File

@ -21,7 +21,6 @@ import java.util.Map;
@Configuration
public class PasswordStorageWebSecurityConfigurer extends WebSecurityConfigurerAdapter {
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.eraseCredentials(false) // 4
@ -31,8 +30,11 @@ public class PasswordStorageWebSecurityConfigurer extends WebSecurityConfigurerA
@Bean
public UserDetailsService getUserDefaultDetailsService() {
User testUser = new User("baeldung", "{noop}SpringSecurity5", Collections.emptyList());
return new InMemoryUserDetailsManager(testUser);
return new InMemoryUserDetailsManager(User
.withUsername("baeldung")
.password("{noop}SpringSecurity5")
.authorities(Collections.emptyList())
.build());
}
@Bean