Add noformat blocks around withDefaultPasswordEncoder

Find `withDefaultPasswordEncoder` calls and protect them against
formatting.

Issue gh-8945
This commit is contained in:
Phillip Webb 2020-07-23 13:23:10 -07:00 committed by Rob Winch
parent 6979125ccf
commit 8e092f8d2c
18 changed files with 38 additions and 7 deletions

View File

@ -147,11 +147,13 @@ public class HelloRSocketITests {
@Bean
MapReactiveUserDetailsService uds() {
// @formatter:off
UserDetails rob = User.withDefaultPasswordEncoder()
.username("rob")
.password("password")
.roles("USER", "ADMIN")
.build();
// @formatter:on
return new MapReactiveUserDetailsService(rob);
}
}

View File

@ -268,6 +268,7 @@ public class RSocketMessageHandlerConnectionITests {
@Bean
MapReactiveUserDetailsService uds() {
// @formatter:off
UserDetails admin = User.withDefaultPasswordEncoder()
.username("admin")
.password("password")
@ -278,12 +279,12 @@ public class RSocketMessageHandlerConnectionITests {
.password("password")
.roles("USER", "SETUP")
.build();
UserDetails evil = User.withDefaultPasswordEncoder()
.username("evil")
.password("password")
.roles("EVIL")
.build();
// @formatter:on
return new MapReactiveUserDetailsService(admin, user, evil);
}

View File

@ -237,6 +237,7 @@ public class RSocketMessageHandlerITests {
@Bean
MapReactiveUserDetailsService uds() {
// @formatter:off
UserDetails rob = User.withDefaultPasswordEncoder()
.username("rob")
.password("password")
@ -247,6 +248,7 @@ public class RSocketMessageHandlerITests {
.password("password")
.roles("USER")
.build();
// @formatter:on
return new MapReactiveUserDetailsService(rob, rossen);
}

View File

@ -165,11 +165,13 @@ public class SimpleAuthenticationITests {
@Bean
MapReactiveUserDetailsService uds() {
// @formatter:off
UserDetails rob = User.withDefaultPasswordEncoder()
.username("rob")
.password("password")
.roles("USER", "ADMIN")
.build();
// @formatter:on
return new MapReactiveUserDetailsService(rob);
}
}

View File

@ -251,12 +251,14 @@ public class ExceptionHandlingConfigurerTests {
@Bean
public InMemoryUserDetailsManager userDetailsManager() {
// @formatter:off
return new InMemoryUserDetailsManager(User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()
);
// @formatter:off
}
}

View File

@ -259,11 +259,13 @@ public class HttpBasicConfigurerTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()
// @formatter:on
);
}
}

View File

@ -83,11 +83,13 @@ public class NamespaceHttpBasicTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()
// @formatter:on
);
}
}

View File

@ -170,11 +170,13 @@ public class NamespaceHttpCustomFilterTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build());
// @formatter:on
}
}

View File

@ -188,11 +188,13 @@ public class NamespaceHttpFormLoginTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build());
// @formatter:on
}
}

View File

@ -300,11 +300,13 @@ public class NamespaceHttpOpenIDLoginTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build());
// @formatter:on
}
}
}

View File

@ -499,11 +499,13 @@ public class NamespaceRememberMeTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build());
// @formatter:on
}
}

View File

@ -413,11 +413,13 @@ public class NamespaceSessionManagementTests {
@Bean
UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build());
// @formatter:on
}
}

View File

@ -190,11 +190,13 @@ public class RememberMeConfigurerTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()
// @formatter:on
);
}
}

View File

@ -399,12 +399,14 @@ public class RequestCacheConfigurerTests {
@Bean
public InMemoryUserDetailsManager userDetailsManager() {
// @formatter:off
return new InMemoryUserDetailsManager(User.withDefaultPasswordEncoder()
.username("user")
.password("password")
.roles("USER")
.build()
);
// @formatter:on
}
}

View File

@ -1746,11 +1746,13 @@ public class OAuth2ResourceServerConfigurerTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
org.springframework.security.core.userdetails.User.withDefaultPasswordEncoder()
.username("basic-user")
.password("basic-password")
.roles("USER")
.build());
// @formatter:on
}
}
@ -1819,11 +1821,13 @@ public class OAuth2ResourceServerConfigurerTests {
@Bean
public UserDetailsService userDetailsService() {
return new InMemoryUserDetailsManager(
// @formatter:off
org.springframework.security.core.userdetails.User.withDefaultPasswordEncoder()
.username("basic-user")
.password("basic-password")
.roles("USER")
.build());
// @formatter:on
}
}

View File

@ -100,13 +100,13 @@ public class SecurityMockMvcResultMatchersTests {
@EnableWebMvc
static class Config extends WebSecurityConfigurerAdapter {
// @formatter:off
@Bean
public UserDetailsService userDetailsService() {
// @formatter:off
UserDetails user = User.withDefaultPasswordEncoder().username("user").password("password").roles("USER", "SELLER").build();
// @formatter:on
return new InMemoryUserDetailsManager(user);
}
// @formatter:on
@RestController
static class Controller {

View File

@ -80,13 +80,13 @@ public class SecurityMockWithAuthoritiesMvcResultMatchersTests {
@EnableWebMvc
static class Config extends WebSecurityConfigurerAdapter {
// @formatter:off
@Bean
public UserDetailsService userDetailsService() {
// @formatter:off
UserDetails user = User.withDefaultPasswordEncoder().username("user").password("password").roles("ADMIN", "SELLER").build();
return new InMemoryUserDetailsManager(user);
}
// @formatter:on
}
@RestController
static class Controller {

View File

@ -90,12 +90,12 @@ public class AuthenticationTests {
@EnableWebSecurity
@EnableWebMvc
static class Config extends WebSecurityConfigurerAdapter {
// @formatter:off
@Bean
public UserDetailsService userDetailsService() {
// @formatter:off
UserDetails user = User.withDefaultPasswordEncoder().username("user").password("password").roles("USER").build();
return new InMemoryUserDetailsManager(user);
}
// @formatter:on
}
}
}