From bed25cd0daa38a14f921ce294c25914ff17327c3 Mon Sep 17 00:00:00 2001 From: Holger Steinhauer Date: Fri, 30 Mar 2018 18:56:40 +0100 Subject: [PATCH] BAEL-1489: Upgrading to Spring Boot 2 GA and using UserBuilder --- spring-5-security/pom.xml | 174 +++++++++--------- .../PasswordStorageWebSecurityConfigurer.java | 8 +- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/spring-5-security/pom.xml b/spring-5-security/pom.xml index ffe6865704..72d2b0133c 100644 --- a/spring-5-security/pom.xml +++ b/spring-5-security/pom.xml @@ -1,22 +1,22 @@ - 4.0.0 - com.baeldung - spring-5-security - 0.0.1-SNAPSHOT - jar + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + com.baeldung + spring-5-security + 0.0.1-SNAPSHOT + jar - spring-5-security - spring 5 security sample project + spring-5-security + spring 5 security sample project - - org.springframework.boot - spring-boot-starter-parent - 2.0.0.RC2 - - + + org.springframework.boot + spring-boot-starter-parent + 2.0.0.RELEASE + + - + org.springframework.boot @@ -35,80 +35,80 @@ thymeleaf-extras-springsecurity4 - - - org.springframework.security - spring-security-oauth2-client - - - org.springframework.security - spring-security-oauth2-jose - + + + org.springframework.security + spring-security-oauth2-client + + + org.springframework.security + spring-security-oauth2-jose + - - org.springframework - spring-test - - - org.springframework.boot - spring-boot-starter-test - test - - - org.springframework.security - spring-security-test - test - - + + org.springframework + spring-test + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.security + spring-security-test + test + + - - - - org.springframework.boot - spring-boot-maven-plugin - + + + + org.springframework.boot + spring-boot-maven-plugin + - - org.apache.maven.plugins - maven-surefire-plugin - - 3 - true - methods - true - - **/*IntegrationTest.java - **/*LiveTest.java - - - - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - - - - spring-milestones - Spring Milestones - https://repo.spring.io/milestone - - false - - - + + org.apache.maven.plugins + maven-surefire-plugin + + 3 + true + methods + true + + **/*IntegrationTest.java + **/*LiveTest.java + + + + + - - UTF-8 - UTF-8 - 1.8 - + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + spring-milestones + Spring Milestones + https://repo.spring.io/milestone + + false + + + + + + UTF-8 + UTF-8 + 1.8 + \ No newline at end of file diff --git a/spring-5-security/src/main/java/com/baeldung/passwordstorage/PasswordStorageWebSecurityConfigurer.java b/spring-5-security/src/main/java/com/baeldung/passwordstorage/PasswordStorageWebSecurityConfigurer.java index 22ef2f0835..0e632fe6fc 100644 --- a/spring-5-security/src/main/java/com/baeldung/passwordstorage/PasswordStorageWebSecurityConfigurer.java +++ b/spring-5-security/src/main/java/com/baeldung/passwordstorage/PasswordStorageWebSecurityConfigurer.java @@ -14,14 +14,12 @@ import org.springframework.security.crypto.password.StandardPasswordEncoder; import org.springframework.security.crypto.scrypt.SCryptPasswordEncoder; import org.springframework.security.provisioning.InMemoryUserDetailsManager; -import java.util.Collections; import java.util.HashMap; import java.util.Map; @Configuration public class PasswordStorageWebSecurityConfigurer extends WebSecurityConfigurerAdapter { - @Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.eraseCredentials(false) // 4 @@ -31,8 +29,10 @@ 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") + .build()); } @Bean