Add noformat blocks around User.withUsername
Find `User.withUsername` calls and protect them against formatting. Issue gh-8945
This commit is contained in:
@@ -114,11 +114,13 @@ public class NamespacePasswordEncoderTests {
|
||||
@Override
|
||||
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
|
||||
BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();
|
||||
// @formatter:off
|
||||
UserDetails user = User.withUsername("user")
|
||||
.passwordEncoder(encoder::encode)
|
||||
.password("password")
|
||||
.roles("USER")
|
||||
.build();
|
||||
// @formatter:on
|
||||
InMemoryUserDetailsManager uds = new InMemoryUserDetailsManager(user);
|
||||
// @formatter:off
|
||||
auth
|
||||
|
||||
@@ -255,10 +255,12 @@ public class EnableWebFluxSecurityTests {
|
||||
static class MapReactiveUserDetailsServiceConfig {
|
||||
@Bean
|
||||
public MapReactiveUserDetailsService userDetailsService() {
|
||||
// @formatter:off
|
||||
return new MapReactiveUserDetailsService(User.withUsername("user")
|
||||
.password("{noop}password")
|
||||
.roles("USER")
|
||||
.build()
|
||||
// @formatter:on
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,11 +92,12 @@ public class UserDetailsResourceFactoryBeanTests {
|
||||
|
||||
private void assertLoaded() throws Exception {
|
||||
Collection<UserDetails> users = factory.getObject();
|
||||
|
||||
// @formatter:off
|
||||
UserDetails expectedUser = User.withUsername("user")
|
||||
.password("password")
|
||||
.authorities("ROLE_USER")
|
||||
.build();
|
||||
// @formatter:on
|
||||
assertThat(users).containsExactly(expectedUser);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user