瀏覽代碼

Apply Checkstyle WhitespaceAfterCheck module

Johnny Lim 7 年之前
父節點
當前提交
b6895e6359
共有 88 個文件被更改,包括 811 次插入808 次删除
  1. 2 2
      acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java
  2. 1 1
      cas/src/test/java/org/springframework/security/cas/jackson2/CasAuthenticationTokenMixinTests.java
  3. 1 1
      config/src/main/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurer.java
  4. 2 2
      config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityMetadataSourceAdvisorRegistrar.java
  5. 2 2
      config/src/main/java/org/springframework/security/config/annotation/web/configurers/JeeConfigurer.java
  6. 2 2
      config/src/main/java/org/springframework/security/config/annotation/web/configurers/X509Configurer.java
  7. 1 1
      config/src/main/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBean.java
  8. 1 1
      config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java
  9. 3 3
      config/src/main/java/org/springframework/security/config/web/server/ServerHttpSecurity.java
  10. 1 1
      config/src/test/groovy/org/springframework/security/config/annotation/web/builders/DisableUseExpressionsConfig.java
  11. 1 1
      config/src/test/groovy/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurerConfigs.java
  12. 2 2
      config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java
  13. 2 2
      config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java
  14. 1 1
      config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterPowermockTests.java
  15. 1 1
      config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java
  16. 6 6
      config/src/test/java/org/springframework/security/config/annotation/web/reactive/EnableWebFluxSecurityTests.java
  17. 1 1
      config/src/test/java/org/springframework/security/config/authentication/JdbcUserServiceBeanDefinitionParserTests.java
  18. 1 1
      config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java
  19. 2 2
      config/src/test/java/org/springframework/security/config/http/customconfigurer/CustomConfigurer.java
  20. 1 1
      config/src/test/java/org/springframework/security/config/web/server/HeaderSpecTests.java
  21. 5 5
      config/src/test/java/org/springframework/security/htmlunit/server/HtmlUnitWebTestClient.java
  22. 1 1
      core/src/main/java/org/springframework/security/core/context/ReactiveSecurityContextHolder.java
  23. 1 1
      core/src/main/java/org/springframework/security/core/session/SessionRegistryImpl.java
  24. 2 2
      core/src/main/java/org/springframework/security/core/userdetails/MapReactiveUserDetailsService.java
  25. 2 2
      core/src/main/java/org/springframework/security/core/userdetails/User.java
  26. 511 511
      core/src/main/java/org/springframework/security/provisioning/JdbcUserDetailsManager.java
  27. 1 1
      core/src/test/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSourceTests.java
  28. 1 1
      core/src/test/java/org/springframework/security/access/expression/method/MethodExpressionVoterTests.java
  29. 12 12
      core/src/test/java/org/springframework/security/core/SpringSecurityCoreVersionTests.java
  30. 2 2
      core/src/test/java/org/springframework/security/core/userdetails/PasswordEncodedUser.java
  31. 2 2
      core/src/test/java/org/springframework/security/core/userdetails/UserTests.java
  32. 2 2
      core/src/test/java/org/springframework/security/jackson2/RememberMeAuthenticationTokenMixinTests.java
  33. 1 1
      core/src/test/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenMixinTests.java
  34. 1 1
      crypto/src/main/java/org/springframework/security/crypto/factory/PasswordEncoderFactories.java
  35. 1 1
      crypto/src/main/java/org/springframework/security/crypto/password/DelegatingPasswordEncoder.java
  36. 1 1
      crypto/src/test/java/org/springframework/security/crypto/codec/HexTests.java
  37. 1 1
      crypto/src/test/java/org/springframework/security/crypto/password/DelegatingPasswordEncoderTests.java
  38. 1 1
      crypto/src/test/java/org/springframework/security/crypto/password/LdapShaPasswordEncoderTests.java
  39. 120 120
      crypto/src/test/java/org/springframework/security/crypto/scrypt/SCryptPasswordEncoderTests.java
  40. 3 0
      etc/checkstyle/checkstyle.xml
  41. 1 1
      itest/web/src/integration-test/java/org/springframework/security/integration/ConcurrentSessionManagementTests.java
  42. 1 1
      ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java
  43. 1 1
      ldap/src/test/java/org/springframework/security/ldap/LdapUtilsTests.java
  44. 1 1
      oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestRedirectFilter.java
  45. 2 2
      oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilter.java
  46. 3 3
      oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProviderTests.java
  47. 3 3
      oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java
  48. 1 1
      oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserServiceTests.java
  49. 1 1
      oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserServiceTests.java
  50. 1 1
      oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestUriBuilderTests.java
  51. 2 2
      oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ClaimAccessor.java
  52. 3 3
      oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AccessTokenResponse.java
  53. 3 3
      oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequest.java
  54. 6 6
      oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/oidc/DefaultAddressStandardClaim.java
  55. 2 2
      samples/javaconfig/hellowebflux-method/src/integration-test/java/sample/HelloWebfluxMethodApplicationITests.java
  56. 1 1
      samples/javaconfig/hellowebflux-method/src/main/java/sample/SecurityConfig.java
  57. 2 2
      samples/javaconfig/hellowebflux-method/src/test/java/sample/HelloWebfluxMethodApplicationTests.java
  58. 2 2
      samples/javaconfig/hellowebflux/src/integration-test/java/sample/HelloWebfluxApplicationITests.java
  59. 2 2
      samples/javaconfig/hellowebflux/src/main/java/sample/HelloUserController.java
  60. 2 2
      samples/javaconfig/hellowebflux/src/test/java/sample/HelloWebfluxApplicationTests.java
  61. 2 2
      samples/javaconfig/hellowebfluxfn/src/integration-test/java/sample/HelloWebfluxFnApplicationITests.java
  62. 2 2
      samples/javaconfig/hellowebfluxfn/src/test/java/sample/HelloWebfluxFnApplicationTests.java
  63. 2 2
      samples/javaconfig/preauth/src/main/java/org/springframework/security/samples/config/SecurityConfig.java
  64. 1 1
      samples/javaconfig/x509/src/main/java/org/springframework/security/samples/config/SecurityConfig.java
  65. 1 1
      samples/xml/contacts/src/main/java/sample/contact/ClientApplication.java
  66. 2 2
      taglibs/src/test/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTagTests.java
  67. 5 5
      test/src/test/java/org/springframework/security/test/web/servlet/request/Sec2935Tests.java
  68. 1 1
      test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfTests.java
  69. 1 1
      test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithAdminRob.java
  70. 2 2
      test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsAuthenticationTests.java
  71. 2 2
      test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsClassLevelAuthenticationTests.java
  72. 2 2
      web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLoginPageGeneratingFilter.java
  73. 1 1
      web/src/main/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverter.java
  74. 1 1
      web/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java
  75. 2 2
      web/src/main/java/org/springframework/security/web/server/authentication/AuthenticationWebFilter.java
  76. 1 1
      web/src/main/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilter.java
  77. 3 3
      web/src/main/java/org/springframework/security/web/server/authorization/AuthorizationContext.java
  78. 4 4
      web/src/main/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepository.java
  79. 2 2
      web/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java
  80. 3 3
      web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcher.java
  81. 1 1
      web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthUtilsTests.java
  82. 1 1
      web/src/test/java/org/springframework/security/web/jackson2/SavedCookieMixinTests.java
  83. 1 1
      web/src/test/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverterTests.java
  84. 5 5
      web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java
  85. 7 7
      web/src/test/java/org/springframework/security/web/server/authorization/AuthorizationWebFilterTests.java
  86. 2 2
      web/src/test/java/org/springframework/security/web/server/context/ReactorContextWebFilterTests.java
  87. 2 2
      web/src/test/java/org/springframework/security/web/server/context/SecurityContextServerWebExchangeWebFilterTests.java
  88. 7 7
      web/src/test/java/org/springframework/security/web/util/OnCommittedResponseWrapperTests.java

+ 2 - 2
acl/src/test/java/org/springframework/security/acls/domain/AclImplTests.java

@@ -495,7 +495,7 @@ public class AclImplTests {
 		assertThat(acl.isSidLoaded(Arrays.asList(new GrantedAuthoritySid("ROLE_IGNORED"),
 				new PrincipalSid("ben"))))
 			.isTrue();
-		assertThat(acl.isSidLoaded(Arrays.asList((Sid)new GrantedAuthoritySid(
+		assertThat(acl.isSidLoaded(Arrays.asList((Sid) new GrantedAuthoritySid(
 				"ROLE_IGNORED"))))
 			.isTrue();
 		assertThat(acl.isSidLoaded(BEN)).isTrue();
@@ -507,7 +507,7 @@ public class AclImplTests {
 		assertThat(acl.isSidLoaded(Arrays.asList((Sid) new GrantedAuthoritySid(
 				"ROLE_GENERAL"), new GrantedAuthoritySid("ROLE_IGNORED"))))
 			.isFalse();
-		assertThat(acl.isSidLoaded(Arrays.asList((Sid)new GrantedAuthoritySid(
+		assertThat(acl.isSidLoaded(Arrays.asList((Sid) new GrantedAuthoritySid(
 				"ROLE_IGNORED"), new GrantedAuthoritySid("ROLE_GENERAL"))))
 			.isFalse();
 	}

+ 1 - 1
cas/src/test/java/org/springframework/security/cas/jackson2/CasAuthenticationTokenMixinTests.java

@@ -124,7 +124,7 @@ public class CasAuthenticationTokenMixinTests {
 	@Test
 	public void deserializeCasAuthenticationTestAfterEraseCredentialInvoked() throws Exception {
 		CasAuthenticationToken token = mapper.readValue(CAS_TOKEN_CLEARED_JSON, CasAuthenticationToken.class);
-		assertThat(((UserDetails)token.getPrincipal()).getPassword()).isNull();
+		assertThat(((UserDetails) token.getPrincipal()).getPassword()).isNull();
 	}
 
 	@Test

+ 1 - 1
config/src/main/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurer.java

@@ -64,7 +64,7 @@ public class LdapAuthenticationProviderConfigurer<B extends ProviderManagerBuild
 	private String groupSearchFilter = "(uniqueMember={0})";
 	private String rolePrefix = "ROLE_";
 	private String userSearchBase = ""; // only for search
-	private String userSearchFilter = null;// "uid={0}"; // only for search
+	private String userSearchFilter = null; // "uid={0}"; // only for search
 	private String[] userDnPatterns;
 	private BaseLdapPathContextSource contextSource;
 	private ContextSourceBuilder contextSourceBuilder = new ContextSourceBuilder();

+ 2 - 2
config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityMetadataSourceAdvisorRegistrar.java

@@ -50,7 +50,7 @@ class MethodSecurityMetadataSourceAdvisorRegistrar implements
 		advisor.addConstructorArgReference("methodSecurityMetadataSource");
 		advisor.addConstructorArgValue("methodSecurityMetadataSource");
 
-		MultiValueMap<String,Object> attributes = importingClassMetadata.getAllAnnotationAttributes(EnableGlobalMethodSecurity.class.getName());
+		MultiValueMap<String, Object> attributes = importingClassMetadata.getAllAnnotationAttributes(EnableGlobalMethodSecurity.class.getName());
 		Integer order = (Integer) attributes.getFirst("order");
 		if(order != null) {
 			advisor.addPropertyValue("order", order);
@@ -59,4 +59,4 @@ class MethodSecurityMetadataSourceAdvisorRegistrar implements
 		registry.registerBeanDefinition("metaDataSourceAdvisor",
 				advisor.getBeanDefinition());
 	}
-}
+}

+ 2 - 2
config/src/main/java/org/springframework/security/config/annotation/web/configurers/JeeConfigurer.java

@@ -201,7 +201,7 @@ public final class JeeConfigurer<H extends HttpSecurityBuilder<H>> extends
 		// @formatter:off
 		http
 			.authenticationProvider(authenticationProvider)
-			.setSharedObject(AuthenticationEntryPoint.class,new Http403ForbiddenEntryPoint());
+			.setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
 		// @formatter:on
 	}
 
@@ -259,4 +259,4 @@ public final class JeeConfigurer<H extends HttpSecurityBuilder<H>> extends
 		detailsSource = postProcess(detailsSource);
 		return detailsSource;
 	}
-}
+}

+ 2 - 2
config/src/main/java/org/springframework/security/config/annotation/web/configurers/X509Configurer.java

@@ -163,7 +163,7 @@ public final class X509Configurer<H extends HttpSecurityBuilder<H>> extends
 
 		http
 			.authenticationProvider(authenticationProvider)
-			.setSharedObject(AuthenticationEntryPoint.class,new Http403ForbiddenEntryPoint());
+			.setSharedObject(AuthenticationEntryPoint.class, new Http403ForbiddenEntryPoint());
 	}
 	// @formatter:on
 
@@ -201,4 +201,4 @@ public final class X509Configurer<H extends HttpSecurityBuilder<H>> extends
 		return authenticationUserDetailsService;
 	}
 
-}
+}

+ 1 - 1
config/src/main/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBean.java

@@ -57,7 +57,7 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact
 
 	@Override
 	public void setResourceLoader(ResourceLoader resourceLoader) {
-		Assert.notNull(resourceLoader,"resourceLoader cannot be null");
+		Assert.notNull(resourceLoader, "resourceLoader cannot be null");
 		this.resourceLoader = resourceLoader;
 	}
 

+ 1 - 1
config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java

@@ -836,7 +836,7 @@ final class AuthenticationConfigBuilder {
 	}
 
 	private static class CsrfTokenHiddenInputFunction implements
-		Function<HttpServletRequest,Map<String,String>> {
+		Function<HttpServletRequest, Map<String, String>> {
 
 		@Override
 		public Map<String, String> apply(HttpServletRequest request) {

+ 3 - 3
config/src/main/java/org/springframework/security/config/web/server/ServerHttpSecurity.java

@@ -261,7 +261,7 @@ public class ServerHttpSecurity {
 		List<WebFilter> sortedWebFilters = new ArrayList<>();
 		this.webFilters.forEach( f -> {
 			if(f instanceof OrderedWebFilter) {
-				f = ((OrderedWebFilter)f).webFilter;
+				f = ((OrderedWebFilter) f).webFilter;
 			}
 			sortedWebFilters.add(f);
 		});
@@ -354,11 +354,11 @@ public class ServerHttpSecurity {
 		public final class Access {
 
 			public AuthorizeExchangeSpec permitAll() {
-				return access( (a,e) -> Mono.just(new AuthorizationDecision(true)));
+				return access( (a, e) -> Mono.just(new AuthorizationDecision(true)));
 			}
 
 			public AuthorizeExchangeSpec denyAll() {
-				return access( (a,e) -> Mono.just(new AuthorizationDecision(false)));
+				return access( (a, e) -> Mono.just(new AuthorizationDecision(false)));
 			}
 
 			public AuthorizeExchangeSpec hasRole(String role) {

+ 1 - 1
config/src/test/groovy/org/springframework/security/config/annotation/web/builders/DisableUseExpressionsConfig.java

@@ -26,7 +26,7 @@ public class DisableUseExpressionsConfig extends BaseWebConfig {
 		// This config is also on UrlAuthorizationConfigurer javadoc
 		http
 			.apply(new UrlAuthorizationConfigurer<HttpSecurity>(getApplicationContext())).getRegistry()
-				.antMatchers("/users**","/sessions/**").hasRole("USER")
+				.antMatchers("/users**", "/sessions/**").hasRole("USER")
 				.antMatchers("/signup").hasRole("ANONYMOUS")
 				.anyRequest().hasRole("USER");
 	}

+ 1 - 1
config/src/test/groovy/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurerConfigs.java

@@ -59,7 +59,7 @@ public class ExpressionUrlAuthorizationConfigurerConfigs {
 					.expressionHandler(handler)
 					.accessDecisionManager(adm)
 					.filterSecurityInterceptorOncePerRequest(true)
-					.antMatchers("/a","/b").hasRole("ADMIN")
+					.antMatchers("/a", "/b").hasRole("ADMIN")
 					.anyRequest().permitAll()
 					.and()
 				.formLogin();

+ 2 - 2
config/src/test/java/org/springframework/security/config/annotation/method/configuration/EnableReactiveMethodSecurityTests.java

@@ -47,8 +47,8 @@ public class EnableReactiveMethodSecurityTests {
 	ReactiveMessageService delegate;
 	TestPublisher<String> result = TestPublisher.create();
 
-	Context withAdmin = ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("admin","password","ROLE_USER", "ROLE_ADMIN"));
-	Context withUser = ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("user","password","ROLE_USER"));
+	Context withAdmin = ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("admin", "password", "ROLE_USER", "ROLE_ADMIN"));
+	Context withUser = ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("user", "password", "ROLE_USER"));
 
 	@After
 	public void cleanup() {

+ 2 - 2
config/src/test/java/org/springframework/security/config/annotation/web/HttpSecurityHeadersTests.java

@@ -70,7 +70,7 @@ public class HttpSecurityHeadersTests {
 	public void headerWhenSpringMvcResourceThenCacheRelatedHeadersReset() throws Exception {
 		mockMvc.perform(get("/resources/file.js"))
 			.andExpect(status().isOk())
-			.andExpect(header().string(HttpHeaders.CACHE_CONTROL,"max-age=12345"))
+			.andExpect(header().string(HttpHeaders.CACHE_CONTROL, "max-age=12345"))
 			.andExpect(header().string(HttpHeaders.PRAGMA, ""))
 			.andExpect(header().string(HttpHeaders.EXPIRES, ""));
 	}
@@ -78,7 +78,7 @@ public class HttpSecurityHeadersTests {
 	@Test
 	public void headerWhenNotSpringResourceThenCacheRelatedHeadersSet() throws Exception {
 		mockMvc.perform(get("/notresource"))
-			.andExpect(header().string(HttpHeaders.CACHE_CONTROL,"no-cache, no-store, max-age=0, must-revalidate"))
+			.andExpect(header().string(HttpHeaders.CACHE_CONTROL, "no-cache, no-store, max-age=0, must-revalidate"))
 			.andExpect(header().string(HttpHeaders.PRAGMA, "no-cache"))
 			.andExpect(header().string(HttpHeaders.EXPIRES, "0"));
 	}

+ 1 - 1
config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterPowermockTests.java

@@ -79,7 +79,7 @@ public class WebSecurityConfigurerAdapterPowermockTests {
 		}
 	}
 
-	static class DefaultConfigurer extends AbstractHttpConfigurer<DefaultConfigurer,HttpSecurity> {
+	static class DefaultConfigurer extends AbstractHttpConfigurer<DefaultConfigurer, HttpSecurity> {
 		boolean init;
 		boolean configure;
 

+ 1 - 1
config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java

@@ -70,7 +70,7 @@ public class HttpSecurityLogoutTests {
 		loadConfig(ClearAuthenticationFalseConfig.class);
 
 		SecurityContext currentContext = SecurityContextHolder.createEmptyContext();
-		currentContext.setAuthentication(new TestingAuthenticationToken("user", "password","ROLE_USER"));
+		currentContext.setAuthentication(new TestingAuthenticationToken("user", "password", "ROLE_USER"));
 
 		request.getSession().setAttribute(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY, currentContext);
 		request.setMethod("POST");

+ 6 - 6
config/src/test/java/org/springframework/security/config/annotation/web/reactive/EnableWebFluxSecurityTests.java

@@ -134,7 +134,7 @@ public class EnableWebFluxSecurityTests {
 				.switchIfEmpty(chain.filter(exchange))
 				.flatMap(e -> chain.filter(exchange)),
 			this.springSecurityFilterChain,
-			(exchange,chain) ->
+			(exchange, chain) ->
 				ReactiveSecurityContextHolder.getContext()
 					.map(SecurityContext::getAuthentication)
 					.flatMap( principal -> exchange.getResponse()
@@ -154,7 +154,7 @@ public class EnableWebFluxSecurityTests {
 		this.spring.register(Config.class).autowire();
 		WebTestClient client = WebTestClientBuilder.bindToWebFilters(
 			this.springSecurityFilterChain,
-			(exchange,chain) ->
+			(exchange, chain) ->
 				ReactiveSecurityContextHolder.getContext()
 					.map(SecurityContext::getAuthentication)
 					.flatMap( principal -> exchange.getResponse()
@@ -166,7 +166,7 @@ public class EnableWebFluxSecurityTests {
 		client
 			.get()
 			.uri("/")
-			.attributes(basicAuthenticationCredentials("user","password"))
+			.attributes(basicAuthenticationCredentials("user", "password"))
 			.exchange()
 			.expectStatus().isOk()
 			.expectBody(String.class).consumeWith( result -> assertThat(result.getResponseBody()).isEqualTo("user"));
@@ -191,7 +191,7 @@ public class EnableWebFluxSecurityTests {
 		this.spring.register(CustomPasswordEncoderConfig.class).autowire();
 		WebTestClient client = WebTestClientBuilder.bindToWebFilters(
 			this.springSecurityFilterChain,
-			(exchange,chain) ->
+			(exchange, chain) ->
 				ReactiveSecurityContextHolder.getContext()
 					.map(SecurityContext::getAuthentication)
 					.flatMap( principal -> exchange.getResponse()
@@ -203,7 +203,7 @@ public class EnableWebFluxSecurityTests {
 		client
 			.get()
 			.uri("/")
-			.attributes(basicAuthenticationCredentials("user","password"))
+			.attributes(basicAuthenticationCredentials("user", "password"))
 			.exchange()
 			.expectStatus().isOk()
 			.expectBody(String.class).consumeWith( result -> assertThat(result.getResponseBody()).isEqualTo("user"));
@@ -231,7 +231,7 @@ public class EnableWebFluxSecurityTests {
 		this.spring.register(Config.class).autowire();
 		WebTestClient client = WebTestClientBuilder.bindToWebFilters(
 			this.springSecurityFilterChain,
-			(exchange,chain) ->
+			(exchange, chain) ->
 				Mono.subscriberContext()
 					.flatMap( c -> c.<Mono<Principal>>get(Authentication.class))
 					.flatMap( principal -> exchange.getResponse()

+ 1 - 1
config/src/test/java/org/springframework/security/config/authentication/JdbcUserServiceBeanDefinitionParserTests.java

@@ -91,7 +91,7 @@ public class JdbcUserServiceBeanDefinitionParserTests {
 				+ "'/>" + DATA_SOURCE);
 		JdbcUserDetailsManager mgr = (JdbcUserDetailsManager) appContext
 				.getBean("myUserService");
-		assertThat(FieldUtils.getFieldValue(mgr,"usersByUsernameQuery")).isEqualTo(userQuery);
+		assertThat(FieldUtils.getFieldValue(mgr, "usersByUsernameQuery")).isEqualTo(userQuery);
 		assertThat(FieldUtils.getFieldValue(mgr, "authoritiesByUsernameQuery")).isEqualTo(authoritiesQuery);
 		assertThat(mgr.loadUserByUsername("rod") != null).isTrue();
 	}

+ 1 - 1
config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java

@@ -57,7 +57,7 @@ public class HttpInterceptUrlTests {
 	}
 
 	private void loadConfig(String... configLocations) {
-		for(int i=0;i<configLocations.length;i++) {
+		for(int i=0; i<configLocations.length; i++) {
 			configLocations[i] = getClass().getName().replaceAll("\\.", "/") + "-" + configLocations[i];
 		}
 		XmlWebApplicationContext context = new XmlWebApplicationContext();

+ 2 - 2
config/src/test/java/org/springframework/security/config/http/customconfigurer/CustomConfigurer.java

@@ -26,7 +26,7 @@ import org.springframework.security.web.DefaultSecurityFilterChain;
  * @author Rob Winch
  *
  */
-public class CustomConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain,HttpSecurity> {
+public class CustomConfigurer extends SecurityConfigurerAdapter<DefaultSecurityFilterChain, HttpSecurity> {
 
 	@Value("${permitAllPattern}")
 	private String permitAllPattern;
@@ -64,4 +64,4 @@ public class CustomConfigurer extends SecurityConfigurerAdapter<DefaultSecurityF
 	public static CustomConfigurer customConfigurer() {
 		return new CustomConfigurer();
 	}
-}
+}

+ 1 - 1
config/src/test/java/org/springframework/security/config/web/server/HeaderSpecTests.java

@@ -134,7 +134,7 @@ public class HeaderSpecTests {
 			.exchange()
 			.returnResult(String.class);
 
-		Map<String,List<String>> responseHeaders = response.getResponseHeaders();
+		Map<String, List<String>> responseHeaders = response.getResponseHeaders();
 		this.ignoredHeaderNames.stream().forEach(responseHeaders::remove);
 
 		assertThat(responseHeaders).describedAs(response.toString()).isEqualTo(

+ 5 - 5
config/src/test/java/org/springframework/security/htmlunit/server/HtmlUnitWebTestClient.java

@@ -85,8 +85,8 @@ final class HtmlUnitWebTestClient {
 		return request.body(BodyInserters.fromObject(requestBody));
 	}
 
-	private MultiValueMap<String,String> formData(List<NameValuePair> params) {
-		MultiValueMap<String,String> result = new LinkedMultiValueMap<>(params.size());
+	private MultiValueMap<String, String> formData(List<NameValuePair> params) {
+		MultiValueMap<String, String> result = new LinkedMultiValueMap<>(params.size());
 		params.forEach( pair -> result.add(pair.getName(), pair.getValue()));
 		return result;
 	}
@@ -129,7 +129,7 @@ final class HtmlUnitWebTestClient {
 	}
 
 	private void headers(WebTestClient.RequestBodySpec request, WebRequest webRequest) {
-		webRequest.getAdditionalHeaders().forEach( (name,value) -> request.header(name, value));
+		webRequest.getAdditionalHeaders().forEach( (name, value) -> request.header(name, value));
 	}
 
 	private HttpMethod httpMethod(WebRequest webRequest) {
@@ -191,8 +191,8 @@ final class HtmlUnitWebTestClient {
 				}).build();
 		}
 
-		private MultiValueMap<String,String> clientCookies() {
-			MultiValueMap<String,String> result = new LinkedMultiValueMap<>(this.cookies.size());
+		private MultiValueMap<String, String> clientCookies() {
+			MultiValueMap<String, String> result = new LinkedMultiValueMap<>(this.cookies.size());
 			this.cookies.values().forEach( cookie ->
 				result.add(cookie.getName(), cookie.getValue())
 			);

+ 1 - 1
core/src/main/java/org/springframework/security/core/context/ReactiveSecurityContextHolder.java

@@ -47,7 +47,7 @@ public class ReactiveSecurityContextHolder {
 	 * @return Return a {@code Mono<Void>} which only replays complete and error signals
 	 * from clearing the context.
 	 */
-	public static Function<Context,Context> clearContext() {
+	public static Function<Context, Context> clearContext() {
 		return context -> context.delete(SECURITY_CONTEXT_KEY);
 	}
 

+ 1 - 1
core/src/main/java/org/springframework/security/core/session/SessionRegistryImpl.java

@@ -60,7 +60,7 @@ public class SessionRegistryImpl implements SessionRegistry,
 		this.sessionIds = new ConcurrentHashMap<String, SessionInformation>();
 	}
 
-	public SessionRegistryImpl(ConcurrentMap<Object, Set<String>> principals,Map<String, SessionInformation> sessionIds) {
+	public SessionRegistryImpl(ConcurrentMap<Object, Set<String>> principals, Map<String, SessionInformation> sessionIds) {
 		this.principals=principals;
 		this.sessionIds=sessionIds;
 	}

+ 2 - 2
core/src/main/java/org/springframework/security/core/userdetails/MapReactiveUserDetailsService.java

@@ -31,9 +31,9 @@ import reactor.core.publisher.Mono;
  * @since 5.0
  */
 public class MapReactiveUserDetailsService implements ReactiveUserDetailsService {
-	private final Map<String,UserDetails> users;
+	private final Map<String, UserDetails> users;
 
-	public MapReactiveUserDetailsService(Map<String,UserDetails> users) {
+	public MapReactiveUserDetailsService(Map<String, UserDetails> users) {
 		this.users = users;
 	}
 

+ 2 - 2
core/src/main/java/org/springframework/security/core/userdetails/User.java

@@ -293,7 +293,7 @@ public class User implements UserDetails, CredentialsContainer {
 		private boolean accountLocked;
 		private boolean credentialsExpired;
 		private boolean disabled;
-		private Function<String,String> passwordEncoder = password -> password;
+		private Function<String, String> passwordEncoder = password -> password;
 
 		/**
 		 * Creates a new instance
@@ -335,7 +335,7 @@ public class User implements UserDetails, CredentialsContainer {
 		 * @return the {@link UserBuilder} for method chaining (i.e. to populate
 		 * additional attributes for this user)
 		 */
-		public UserBuilder passwordEncoder(Function<String,String> encoder) {
+		public UserBuilder passwordEncoder(Function<String, String> encoder) {
 			Assert.notNull(encoder, "encoder cannot be null");
 			this.passwordEncoder = encoder;
 			return this;

+ 511 - 511
core/src/main/java/org/springframework/security/provisioning/JdbcUserDetailsManager.java

@@ -13,514 +13,514 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.springframework.security.provisioning;
-
-import org.springframework.security.access.AccessDeniedException;
-import org.springframework.security.authentication.AuthenticationManager;
-import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
-import org.springframework.security.core.Authentication;
-import org.springframework.security.core.AuthenticationException;
-import org.springframework.security.core.GrantedAuthority;
-import org.springframework.security.core.authority.AuthorityUtils;
-import org.springframework.security.core.authority.SimpleGrantedAuthority;
-import org.springframework.security.core.context.SecurityContextHolder;
-import org.springframework.security.core.userdetails.UserCache;
-import org.springframework.security.core.userdetails.UserDetails;
-import org.springframework.security.core.userdetails.cache.NullUserCache;
-import org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl;
-import org.springframework.context.ApplicationContextException;
-import org.springframework.dao.IncorrectResultSizeDataAccessException;
-import org.springframework.jdbc.core.PreparedStatementSetter;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.util.Assert;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Jdbc user management service, based on the same table structure as its parent class,
- * <tt>JdbcDaoImpl</tt>.
- * <p>
- * Provides CRUD operations for both users and groups. Note that if the
- * {@link #setEnableAuthorities(boolean) enableAuthorities} property is set to false,
- * calls to createUser, updateUser and deleteUser will not store the authorities from the
- * <tt>UserDetails</tt> or delete authorities for the user. Since this class cannot
- * differentiate between authorities which were loaded for an individual or for a group of
- * which the individual is a member, it's important that you take this into account when
- * using this implementation for managing your users.
- *
- * @author Luke Taylor
- * @since 2.0
- */
-public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsManager,
-		GroupManager {
-	// ~ Static fields/initializers
-	// =====================================================================================
-
-	// UserDetailsManager SQL
-	public static final String DEF_CREATE_USER_SQL = "insert into users (username, password, enabled) values (?,?,?)";
-	public static final String DEF_DELETE_USER_SQL = "delete from users where username = ?";
-	public static final String DEF_UPDATE_USER_SQL = "update users set password = ?, enabled = ? where username = ?";
-	public static final String DEF_INSERT_AUTHORITY_SQL = "insert into authorities (username, authority) values (?,?)";
-	public static final String DEF_DELETE_USER_AUTHORITIES_SQL = "delete from authorities where username = ?";
-	public static final String DEF_USER_EXISTS_SQL = "select username from users where username = ?";
-	public static final String DEF_CHANGE_PASSWORD_SQL = "update users set password = ? where username = ?";
-
-	// GroupManager SQL
-	public static final String DEF_FIND_GROUPS_SQL = "select group_name from groups";
-	public static final String DEF_FIND_USERS_IN_GROUP_SQL = "select username from group_members gm, groups g "
-			+ "where gm.group_id = g.id" + " and g.group_name = ?";
-	public static final String DEF_INSERT_GROUP_SQL = "insert into groups (group_name) values (?)";
-	public static final String DEF_FIND_GROUP_ID_SQL = "select id from groups where group_name = ?";
-	public static final String DEF_INSERT_GROUP_AUTHORITY_SQL = "insert into group_authorities (group_id, authority) values (?,?)";
-	public static final String DEF_DELETE_GROUP_SQL = "delete from groups where id = ?";
-	public static final String DEF_DELETE_GROUP_AUTHORITIES_SQL = "delete from group_authorities where group_id = ?";
-	public static final String DEF_DELETE_GROUP_MEMBERS_SQL = "delete from group_members where group_id = ?";
-	public static final String DEF_RENAME_GROUP_SQL = "update groups set group_name = ? where group_name = ?";
-	public static final String DEF_INSERT_GROUP_MEMBER_SQL = "insert into group_members (group_id, username) values (?,?)";
-	public static final String DEF_DELETE_GROUP_MEMBER_SQL = "delete from group_members where group_id = ? and username = ?";
-	public static final String DEF_GROUP_AUTHORITIES_QUERY_SQL = "select g.id, g.group_name, ga.authority "
-			+ "from groups g, group_authorities ga "
-			+ "where g.group_name = ? "
-			+ "and g.id = ga.group_id ";
-	public static final String DEF_DELETE_GROUP_AUTHORITY_SQL = "delete from group_authorities where group_id = ? and authority = ?";
-
-	// ~ Instance fields
-	// ================================================================================================
-
-	protected final Log logger = LogFactory.getLog(getClass());
-
-	private String createUserSql = DEF_CREATE_USER_SQL;
-	private String deleteUserSql = DEF_DELETE_USER_SQL;
-	private String updateUserSql = DEF_UPDATE_USER_SQL;
-	private String createAuthoritySql = DEF_INSERT_AUTHORITY_SQL;
-	private String deleteUserAuthoritiesSql = DEF_DELETE_USER_AUTHORITIES_SQL;
-	private String userExistsSql = DEF_USER_EXISTS_SQL;
-	private String changePasswordSql = DEF_CHANGE_PASSWORD_SQL;
-
-	private String findAllGroupsSql = DEF_FIND_GROUPS_SQL;
-	private String findUsersInGroupSql = DEF_FIND_USERS_IN_GROUP_SQL;
-	private String insertGroupSql = DEF_INSERT_GROUP_SQL;
-	private String findGroupIdSql = DEF_FIND_GROUP_ID_SQL;
-	private String insertGroupAuthoritySql = DEF_INSERT_GROUP_AUTHORITY_SQL;
-	private String deleteGroupSql = DEF_DELETE_GROUP_SQL;
-	private String deleteGroupAuthoritiesSql = DEF_DELETE_GROUP_AUTHORITIES_SQL;
-	private String deleteGroupMembersSql = DEF_DELETE_GROUP_MEMBERS_SQL;
-	private String renameGroupSql = DEF_RENAME_GROUP_SQL;
-	private String insertGroupMemberSql = DEF_INSERT_GROUP_MEMBER_SQL;
-	private String deleteGroupMemberSql = DEF_DELETE_GROUP_MEMBER_SQL;
-	private String groupAuthoritiesSql = DEF_GROUP_AUTHORITIES_QUERY_SQL;
-	private String deleteGroupAuthoritySql = DEF_DELETE_GROUP_AUTHORITY_SQL;
-
-	private AuthenticationManager authenticationManager;
-
-	private UserCache userCache = new NullUserCache();
-
-	// ~ Methods
-	// ========================================================================================================
-
-	protected void initDao() throws ApplicationContextException {
-		if (authenticationManager == null) {
-			logger.info("No authentication manager set. Reauthentication of users when changing passwords will "
-					+ "not be performed.");
-		}
-
-		super.initDao();
-	}
-
-	// ~ UserDetailsManager implementation
-	// ==============================================================================
-
-	public void createUser(final UserDetails user) {
-		validateUserDetails(user);
-		getJdbcTemplate().update(createUserSql, new PreparedStatementSetter() {
-			public void setValues(PreparedStatement ps) throws SQLException {
-				ps.setString(1, user.getUsername());
-				ps.setString(2, user.getPassword());
-				ps.setBoolean(3, user.isEnabled());
-			}
-
-		});
-
-		if (getEnableAuthorities()) {
-			insertUserAuthorities(user);
-		}
-	}
-
-	public void updateUser(final UserDetails user) {
-		validateUserDetails(user);
-		getJdbcTemplate().update(updateUserSql, new PreparedStatementSetter() {
-			public void setValues(PreparedStatement ps) throws SQLException {
-				ps.setString(1, user.getPassword());
-				ps.setBoolean(2, user.isEnabled());
-				ps.setString(3, user.getUsername());
-			}
-		});
-
-		if (getEnableAuthorities()) {
-			deleteUserAuthorities(user.getUsername());
-			insertUserAuthorities(user);
-		}
-
-		userCache.removeUserFromCache(user.getUsername());
-	}
-
-	private void insertUserAuthorities(UserDetails user) {
-		for (GrantedAuthority auth : user.getAuthorities()) {
-			getJdbcTemplate().update(createAuthoritySql, user.getUsername(),
-					auth.getAuthority());
-		}
-	}
-
-	public void deleteUser(String username) {
-		if (getEnableAuthorities()) {
-			deleteUserAuthorities(username);
-		}
-		getJdbcTemplate().update(deleteUserSql, username);
-		userCache.removeUserFromCache(username);
-	}
-
-	private void deleteUserAuthorities(String username) {
-		getJdbcTemplate().update(deleteUserAuthoritiesSql, username);
-	}
-
-	public void changePassword(String oldPassword, String newPassword)
-			throws AuthenticationException {
-		Authentication currentUser = SecurityContextHolder.getContext()
-				.getAuthentication();
-
-		if (currentUser == null) {
-			// This would indicate bad coding somewhere
-			throw new AccessDeniedException(
-					"Can't change password as no Authentication object found in context "
-							+ "for current user.");
-		}
-
-		String username = currentUser.getName();
-
-		// If an authentication manager has been set, re-authenticate the user with the
-		// supplied password.
-		if (authenticationManager != null) {
-			logger.debug("Reauthenticating user '" + username
-					+ "' for password change request.");
-
-			authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(
-					username, oldPassword));
-		}
-		else {
-			logger.debug("No authentication manager set. Password won't be re-checked.");
-		}
-
-		logger.debug("Changing password for user '" + username + "'");
-
-		getJdbcTemplate().update(changePasswordSql, newPassword, username);
-
-		SecurityContextHolder.getContext().setAuthentication(
-				createNewAuthentication(currentUser, newPassword));
-
-		userCache.removeUserFromCache(username);
-	}
-
-	protected Authentication createNewAuthentication(Authentication currentAuth,
-			String newPassword) {
-		UserDetails user = loadUserByUsername(currentAuth.getName());
-
-		UsernamePasswordAuthenticationToken newAuthentication = new UsernamePasswordAuthenticationToken(
-				user, null, user.getAuthorities());
-		newAuthentication.setDetails(currentAuth.getDetails());
-
-		return newAuthentication;
-	}
-
-	public boolean userExists(String username) {
-		List<String> users = getJdbcTemplate().queryForList(userExistsSql,
-				new String[] { username }, String.class);
-
-		if (users.size() > 1) {
-			throw new IncorrectResultSizeDataAccessException(
-					"More than one user found with name '" + username + "'", 1);
-		}
-
-		return users.size() == 1;
-	}
-
-	// ~ GroupManager implementation
-	// ====================================================================================
-
-	public List<String> findAllGroups() {
-		return getJdbcTemplate().queryForList(findAllGroupsSql, String.class);
-	}
-
-	public List<String> findUsersInGroup(String groupName) {
-		Assert.hasText(groupName, "groupName should have text");
-		return getJdbcTemplate().queryForList(findUsersInGroupSql,
-				new String[] { groupName }, String.class);
-	}
-
-	public void createGroup(final String groupName,
-			final List<GrantedAuthority> authorities) {
-		Assert.hasText(groupName, "groupName should have text");
-		Assert.notNull(authorities, "authorities cannot be null");
-
-		logger.debug("Creating new group '" + groupName + "' with authorities "
-				+ AuthorityUtils.authorityListToSet(authorities));
-
-		getJdbcTemplate().update(insertGroupSql, groupName);
-
-		final int groupId = findGroupId(groupName);
-
-		for (GrantedAuthority a : authorities) {
-			final String authority = a.getAuthority();
-			getJdbcTemplate().update(insertGroupAuthoritySql,
-					new PreparedStatementSetter() {
-						public void setValues(PreparedStatement ps) throws SQLException {
-							ps.setInt(1, groupId);
-							ps.setString(2, authority);
-						}
-					});
-		}
-	}
-
-	public void deleteGroup(String groupName) {
-		logger.debug("Deleting group '" + groupName + "'");
-		Assert.hasText(groupName, "groupName should have text");
-
-		final int id = findGroupId(groupName);
-		PreparedStatementSetter groupIdPSS = new PreparedStatementSetter() {
-			public void setValues(PreparedStatement ps) throws SQLException {
-				ps.setInt(1, id);
-			}
-		};
-		getJdbcTemplate().update(deleteGroupMembersSql, groupIdPSS);
-		getJdbcTemplate().update(deleteGroupAuthoritiesSql, groupIdPSS);
-		getJdbcTemplate().update(deleteGroupSql, groupIdPSS);
-	}
-
-	public void renameGroup(String oldName, String newName) {
-		logger.debug("Changing group name from '" + oldName + "' to '" + newName + "'");
-		Assert.hasText(oldName,"oldName should have text");;
-		Assert.hasText(newName,"newName should have text");;
-
-		getJdbcTemplate().update(renameGroupSql, newName, oldName);
-	}
-
-	public void addUserToGroup(final String username, final String groupName) {
-		logger.debug("Adding user '" + username + "' to group '" + groupName + "'");
-		Assert.hasText(username,"username should have text");;
-		Assert.hasText(groupName,"groupName should have text");;
-
-		final int id = findGroupId(groupName);
-		getJdbcTemplate().update(insertGroupMemberSql, new PreparedStatementSetter() {
-			public void setValues(PreparedStatement ps) throws SQLException {
-				ps.setInt(1, id);
-				ps.setString(2, username);
-			}
-		});
-
-		userCache.removeUserFromCache(username);
-	}
-
-	public void removeUserFromGroup(final String username, final String groupName) {
-		logger.debug("Removing user '" + username + "' to group '" + groupName + "'");
-		Assert.hasText(username,"username should have text");;
-		Assert.hasText(groupName,"groupName should have text");;
-
-		final int id = findGroupId(groupName);
-
-		getJdbcTemplate().update(deleteGroupMemberSql, new PreparedStatementSetter() {
-			public void setValues(PreparedStatement ps) throws SQLException {
-				ps.setInt(1, id);
-				ps.setString(2, username);
-			}
-		});
-
-		userCache.removeUserFromCache(username);
-	}
-
-	public List<GrantedAuthority> findGroupAuthorities(String groupName) {
-		logger.debug("Loading authorities for group '" + groupName + "'");
-		Assert.hasText(groupName,"groupName should have text");;
-
-		return getJdbcTemplate().query(groupAuthoritiesSql, new String[] { groupName },
-				new RowMapper<GrantedAuthority>() {
-					public GrantedAuthority mapRow(ResultSet rs, int rowNum)
-							throws SQLException {
-						String roleName = getRolePrefix() + rs.getString(3);
-
-						return new SimpleGrantedAuthority(roleName);
-					}
-				});
-	}
-
-	public void removeGroupAuthority(String groupName, final GrantedAuthority authority) {
-		logger.debug("Removing authority '" + authority + "' from group '" + groupName
-				+ "'");
-		Assert.hasText(groupName,"groupName should have text");
-		Assert.notNull(authority, "authority cannot be null");
-
-		final int id = findGroupId(groupName);
-
-		getJdbcTemplate().update(deleteGroupAuthoritySql, new PreparedStatementSetter() {
-
-			public void setValues(PreparedStatement ps) throws SQLException {
-				ps.setInt(1, id);
-				ps.setString(2, authority.getAuthority());
-			}
-		});
-	}
-
-	public void addGroupAuthority(final String groupName, final GrantedAuthority authority) {
-		logger.debug("Adding authority '" + authority + "' to group '" + groupName + "'");
-		Assert.hasText(groupName,"groupName should have text");;
-		Assert.notNull(authority, "authority cannot be null");
-
-		final int id = findGroupId(groupName);
-		getJdbcTemplate().update(insertGroupAuthoritySql, new PreparedStatementSetter() {
-			public void setValues(PreparedStatement ps) throws SQLException {
-				ps.setInt(1, id);
-				ps.setString(2, authority.getAuthority());
-			}
-		});
-	}
-
-	private int findGroupId(String group) {
-		return getJdbcTemplate().queryForObject(findGroupIdSql, Integer.class, group);
-	}
-
-	public void setAuthenticationManager(AuthenticationManager authenticationManager) {
-		this.authenticationManager = authenticationManager;
-	}
-
-	public void setCreateUserSql(String createUserSql) {
-		Assert.hasText(createUserSql,"createUserSql should have text");;
-		this.createUserSql = createUserSql;
-	}
-
-	public void setDeleteUserSql(String deleteUserSql) {
-		Assert.hasText(deleteUserSql,"deleteUserSql should have text");;
-		this.deleteUserSql = deleteUserSql;
-	}
-
-	public void setUpdateUserSql(String updateUserSql) {
-		Assert.hasText(updateUserSql,"updateUserSql should have text");;
-		this.updateUserSql = updateUserSql;
-	}
-
-	public void setCreateAuthoritySql(String createAuthoritySql) {
-		Assert.hasText(createAuthoritySql,"createAuthoritySql should have text");;
-		this.createAuthoritySql = createAuthoritySql;
-	}
-
-	public void setDeleteUserAuthoritiesSql(String deleteUserAuthoritiesSql) {
-		Assert.hasText(deleteUserAuthoritiesSql,"deleteUserAuthoritiesSql should have text");;
-		this.deleteUserAuthoritiesSql = deleteUserAuthoritiesSql;
-	}
-
-	public void setUserExistsSql(String userExistsSql) {
-		Assert.hasText(userExistsSql,"userExistsSql should have text");;
-		this.userExistsSql = userExistsSql;
-	}
-
-	public void setChangePasswordSql(String changePasswordSql) {
-		Assert.hasText(changePasswordSql,"changePasswordSql should have text");;
-		this.changePasswordSql = changePasswordSql;
-	}
-
-	public void setFindAllGroupsSql(String findAllGroupsSql) {
-		Assert.hasText(findAllGroupsSql,"findAllGroupsSql should have text");;
-		this.findAllGroupsSql = findAllGroupsSql;
-	}
-
-	public void setFindUsersInGroupSql(String findUsersInGroupSql) {
-		Assert.hasText(findUsersInGroupSql,"findUsersInGroupSql should have text");;
-		this.findUsersInGroupSql = findUsersInGroupSql;
-	}
-
-	public void setInsertGroupSql(String insertGroupSql) {
-		Assert.hasText(insertGroupSql,"insertGroupSql should have text");;
-		this.insertGroupSql = insertGroupSql;
-	}
-
-	public void setFindGroupIdSql(String findGroupIdSql) {
-		Assert.hasText(findGroupIdSql,"findGroupIdSql should have text");;
-		this.findGroupIdSql = findGroupIdSql;
-	}
-
-	public void setInsertGroupAuthoritySql(String insertGroupAuthoritySql) {
-		Assert.hasText(insertGroupAuthoritySql,"insertGroupAuthoritySql should have text");;
-		this.insertGroupAuthoritySql = insertGroupAuthoritySql;
-	}
-
-	public void setDeleteGroupSql(String deleteGroupSql) {
-		Assert.hasText(deleteGroupSql,"deleteGroupSql should have text");;
-		this.deleteGroupSql = deleteGroupSql;
-	}
-
-	public void setDeleteGroupAuthoritiesSql(String deleteGroupAuthoritiesSql) {
-		Assert.hasText(deleteGroupAuthoritiesSql,"deleteGroupAuthoritiesSql should have text");;
-		this.deleteGroupAuthoritiesSql = deleteGroupAuthoritiesSql;
-	}
-
-	public void setDeleteGroupMembersSql(String deleteGroupMembersSql) {
-		Assert.hasText(deleteGroupMembersSql,"deleteGroupMembersSql should have text");;
-		this.deleteGroupMembersSql = deleteGroupMembersSql;
-	}
-
-	public void setRenameGroupSql(String renameGroupSql) {
-		Assert.hasText(renameGroupSql,"renameGroupSql should have text");;
-		this.renameGroupSql = renameGroupSql;
-	}
-
-	public void setInsertGroupMemberSql(String insertGroupMemberSql) {
-		Assert.hasText(insertGroupMemberSql,"insertGroupMemberSql should have text");;
-		this.insertGroupMemberSql = insertGroupMemberSql;
-	}
-
-	public void setDeleteGroupMemberSql(String deleteGroupMemberSql) {
-		Assert.hasText(deleteGroupMemberSql,"deleteGroupMemberSql should have text");;
-		this.deleteGroupMemberSql = deleteGroupMemberSql;
-	}
-
-	public void setGroupAuthoritiesSql(String groupAuthoritiesSql) {
-		Assert.hasText(groupAuthoritiesSql,"groupAuthoritiesSql should have text");;
-		this.groupAuthoritiesSql = groupAuthoritiesSql;
-	}
-
-	public void setDeleteGroupAuthoritySql(String deleteGroupAuthoritySql) {
-		Assert.hasText(deleteGroupAuthoritySql,"deleteGroupAuthoritySql should have text");;
-		this.deleteGroupAuthoritySql = deleteGroupAuthoritySql;
-	}
-
-	/**
-	 * Optionally sets the UserCache if one is in use in the application. This allows the
-	 * user to be removed from the cache after updates have taken place to avoid stale
-	 * data.
-	 *
-	 * @param userCache the cache used by the AuthenticationManager.
-	 */
-	public void setUserCache(UserCache userCache) {
-		Assert.notNull(userCache, "userCache cannot be null");
-		this.userCache = userCache;
-	}
-
-	private void validateUserDetails(UserDetails user) {
-		Assert.hasText(user.getUsername(), "Username may not be empty or null");
-		validateAuthorities(user.getAuthorities());
-	}
-
-	private void validateAuthorities(Collection<? extends GrantedAuthority> authorities) {
-		Assert.notNull(authorities, "Authorities list must not be null");
-
-		for (GrantedAuthority authority : authorities) {
-			Assert.notNull(authority, "Authorities list contains a null entry");
-			Assert.hasText(authority.getAuthority(),
-					"getAuthority() method must return a non-empty string");
-		}
-	}
-}
+package org.springframework.security.provisioning;
+
+import org.springframework.security.access.AccessDeniedException;
+import org.springframework.security.authentication.AuthenticationManager;
+import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
+import org.springframework.security.core.Authentication;
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.AuthorityUtils;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.core.context.SecurityContextHolder;
+import org.springframework.security.core.userdetails.UserCache;
+import org.springframework.security.core.userdetails.UserDetails;
+import org.springframework.security.core.userdetails.cache.NullUserCache;
+import org.springframework.security.core.userdetails.jdbc.JdbcDaoImpl;
+import org.springframework.context.ApplicationContextException;
+import org.springframework.dao.IncorrectResultSizeDataAccessException;
+import org.springframework.jdbc.core.PreparedStatementSetter;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.util.Assert;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Jdbc user management service, based on the same table structure as its parent class,
+ * <tt>JdbcDaoImpl</tt>.
+ * <p>
+ * Provides CRUD operations for both users and groups. Note that if the
+ * {@link #setEnableAuthorities(boolean) enableAuthorities} property is set to false,
+ * calls to createUser, updateUser and deleteUser will not store the authorities from the
+ * <tt>UserDetails</tt> or delete authorities for the user. Since this class cannot
+ * differentiate between authorities which were loaded for an individual or for a group of
+ * which the individual is a member, it's important that you take this into account when
+ * using this implementation for managing your users.
+ *
+ * @author Luke Taylor
+ * @since 2.0
+ */
+public class JdbcUserDetailsManager extends JdbcDaoImpl implements UserDetailsManager,
+		GroupManager {
+	// ~ Static fields/initializers
+	// =====================================================================================
+
+	// UserDetailsManager SQL
+	public static final String DEF_CREATE_USER_SQL = "insert into users (username, password, enabled) values (?,?,?)";
+	public static final String DEF_DELETE_USER_SQL = "delete from users where username = ?";
+	public static final String DEF_UPDATE_USER_SQL = "update users set password = ?, enabled = ? where username = ?";
+	public static final String DEF_INSERT_AUTHORITY_SQL = "insert into authorities (username, authority) values (?,?)";
+	public static final String DEF_DELETE_USER_AUTHORITIES_SQL = "delete from authorities where username = ?";
+	public static final String DEF_USER_EXISTS_SQL = "select username from users where username = ?";
+	public static final String DEF_CHANGE_PASSWORD_SQL = "update users set password = ? where username = ?";
+
+	// GroupManager SQL
+	public static final String DEF_FIND_GROUPS_SQL = "select group_name from groups";
+	public static final String DEF_FIND_USERS_IN_GROUP_SQL = "select username from group_members gm, groups g "
+			+ "where gm.group_id = g.id" + " and g.group_name = ?";
+	public static final String DEF_INSERT_GROUP_SQL = "insert into groups (group_name) values (?)";
+	public static final String DEF_FIND_GROUP_ID_SQL = "select id from groups where group_name = ?";
+	public static final String DEF_INSERT_GROUP_AUTHORITY_SQL = "insert into group_authorities (group_id, authority) values (?,?)";
+	public static final String DEF_DELETE_GROUP_SQL = "delete from groups where id = ?";
+	public static final String DEF_DELETE_GROUP_AUTHORITIES_SQL = "delete from group_authorities where group_id = ?";
+	public static final String DEF_DELETE_GROUP_MEMBERS_SQL = "delete from group_members where group_id = ?";
+	public static final String DEF_RENAME_GROUP_SQL = "update groups set group_name = ? where group_name = ?";
+	public static final String DEF_INSERT_GROUP_MEMBER_SQL = "insert into group_members (group_id, username) values (?,?)";
+	public static final String DEF_DELETE_GROUP_MEMBER_SQL = "delete from group_members where group_id = ? and username = ?";
+	public static final String DEF_GROUP_AUTHORITIES_QUERY_SQL = "select g.id, g.group_name, ga.authority "
+			+ "from groups g, group_authorities ga "
+			+ "where g.group_name = ? "
+			+ "and g.id = ga.group_id ";
+	public static final String DEF_DELETE_GROUP_AUTHORITY_SQL = "delete from group_authorities where group_id = ? and authority = ?";
+
+	// ~ Instance fields
+	// ================================================================================================
+
+	protected final Log logger = LogFactory.getLog(getClass());
+
+	private String createUserSql = DEF_CREATE_USER_SQL;
+	private String deleteUserSql = DEF_DELETE_USER_SQL;
+	private String updateUserSql = DEF_UPDATE_USER_SQL;
+	private String createAuthoritySql = DEF_INSERT_AUTHORITY_SQL;
+	private String deleteUserAuthoritiesSql = DEF_DELETE_USER_AUTHORITIES_SQL;
+	private String userExistsSql = DEF_USER_EXISTS_SQL;
+	private String changePasswordSql = DEF_CHANGE_PASSWORD_SQL;
+
+	private String findAllGroupsSql = DEF_FIND_GROUPS_SQL;
+	private String findUsersInGroupSql = DEF_FIND_USERS_IN_GROUP_SQL;
+	private String insertGroupSql = DEF_INSERT_GROUP_SQL;
+	private String findGroupIdSql = DEF_FIND_GROUP_ID_SQL;
+	private String insertGroupAuthoritySql = DEF_INSERT_GROUP_AUTHORITY_SQL;
+	private String deleteGroupSql = DEF_DELETE_GROUP_SQL;
+	private String deleteGroupAuthoritiesSql = DEF_DELETE_GROUP_AUTHORITIES_SQL;
+	private String deleteGroupMembersSql = DEF_DELETE_GROUP_MEMBERS_SQL;
+	private String renameGroupSql = DEF_RENAME_GROUP_SQL;
+	private String insertGroupMemberSql = DEF_INSERT_GROUP_MEMBER_SQL;
+	private String deleteGroupMemberSql = DEF_DELETE_GROUP_MEMBER_SQL;
+	private String groupAuthoritiesSql = DEF_GROUP_AUTHORITIES_QUERY_SQL;
+	private String deleteGroupAuthoritySql = DEF_DELETE_GROUP_AUTHORITY_SQL;
+
+	private AuthenticationManager authenticationManager;
+
+	private UserCache userCache = new NullUserCache();
+
+	// ~ Methods
+	// ========================================================================================================
+
+	protected void initDao() throws ApplicationContextException {
+		if (authenticationManager == null) {
+			logger.info("No authentication manager set. Reauthentication of users when changing passwords will "
+					+ "not be performed.");
+		}
+
+		super.initDao();
+	}
+
+	// ~ UserDetailsManager implementation
+	// ==============================================================================
+
+	public void createUser(final UserDetails user) {
+		validateUserDetails(user);
+		getJdbcTemplate().update(createUserSql, new PreparedStatementSetter() {
+			public void setValues(PreparedStatement ps) throws SQLException {
+				ps.setString(1, user.getUsername());
+				ps.setString(2, user.getPassword());
+				ps.setBoolean(3, user.isEnabled());
+			}
+
+		});
+
+		if (getEnableAuthorities()) {
+			insertUserAuthorities(user);
+		}
+	}
+
+	public void updateUser(final UserDetails user) {
+		validateUserDetails(user);
+		getJdbcTemplate().update(updateUserSql, new PreparedStatementSetter() {
+			public void setValues(PreparedStatement ps) throws SQLException {
+				ps.setString(1, user.getPassword());
+				ps.setBoolean(2, user.isEnabled());
+				ps.setString(3, user.getUsername());
+			}
+		});
+
+		if (getEnableAuthorities()) {
+			deleteUserAuthorities(user.getUsername());
+			insertUserAuthorities(user);
+		}
+
+		userCache.removeUserFromCache(user.getUsername());
+	}
+
+	private void insertUserAuthorities(UserDetails user) {
+		for (GrantedAuthority auth : user.getAuthorities()) {
+			getJdbcTemplate().update(createAuthoritySql, user.getUsername(),
+					auth.getAuthority());
+		}
+	}
+
+	public void deleteUser(String username) {
+		if (getEnableAuthorities()) {
+			deleteUserAuthorities(username);
+		}
+		getJdbcTemplate().update(deleteUserSql, username);
+		userCache.removeUserFromCache(username);
+	}
+
+	private void deleteUserAuthorities(String username) {
+		getJdbcTemplate().update(deleteUserAuthoritiesSql, username);
+	}
+
+	public void changePassword(String oldPassword, String newPassword)
+			throws AuthenticationException {
+		Authentication currentUser = SecurityContextHolder.getContext()
+				.getAuthentication();
+
+		if (currentUser == null) {
+			// This would indicate bad coding somewhere
+			throw new AccessDeniedException(
+					"Can't change password as no Authentication object found in context "
+							+ "for current user.");
+		}
+
+		String username = currentUser.getName();
+
+		// If an authentication manager has been set, re-authenticate the user with the
+		// supplied password.
+		if (authenticationManager != null) {
+			logger.debug("Reauthenticating user '" + username
+					+ "' for password change request.");
+
+			authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(
+					username, oldPassword));
+		}
+		else {
+			logger.debug("No authentication manager set. Password won't be re-checked.");
+		}
+
+		logger.debug("Changing password for user '" + username + "'");
+
+		getJdbcTemplate().update(changePasswordSql, newPassword, username);
+
+		SecurityContextHolder.getContext().setAuthentication(
+				createNewAuthentication(currentUser, newPassword));
+
+		userCache.removeUserFromCache(username);
+	}
+
+	protected Authentication createNewAuthentication(Authentication currentAuth,
+			String newPassword) {
+		UserDetails user = loadUserByUsername(currentAuth.getName());
+
+		UsernamePasswordAuthenticationToken newAuthentication = new UsernamePasswordAuthenticationToken(
+				user, null, user.getAuthorities());
+		newAuthentication.setDetails(currentAuth.getDetails());
+
+		return newAuthentication;
+	}
+
+	public boolean userExists(String username) {
+		List<String> users = getJdbcTemplate().queryForList(userExistsSql,
+				new String[] { username }, String.class);
+
+		if (users.size() > 1) {
+			throw new IncorrectResultSizeDataAccessException(
+					"More than one user found with name '" + username + "'", 1);
+		}
+
+		return users.size() == 1;
+	}
+
+	// ~ GroupManager implementation
+	// ====================================================================================
+
+	public List<String> findAllGroups() {
+		return getJdbcTemplate().queryForList(findAllGroupsSql, String.class);
+	}
+
+	public List<String> findUsersInGroup(String groupName) {
+		Assert.hasText(groupName, "groupName should have text");
+		return getJdbcTemplate().queryForList(findUsersInGroupSql,
+				new String[] { groupName }, String.class);
+	}
+
+	public void createGroup(final String groupName,
+			final List<GrantedAuthority> authorities) {
+		Assert.hasText(groupName, "groupName should have text");
+		Assert.notNull(authorities, "authorities cannot be null");
+
+		logger.debug("Creating new group '" + groupName + "' with authorities "
+				+ AuthorityUtils.authorityListToSet(authorities));
+
+		getJdbcTemplate().update(insertGroupSql, groupName);
+
+		final int groupId = findGroupId(groupName);
+
+		for (GrantedAuthority a : authorities) {
+			final String authority = a.getAuthority();
+			getJdbcTemplate().update(insertGroupAuthoritySql,
+					new PreparedStatementSetter() {
+						public void setValues(PreparedStatement ps) throws SQLException {
+							ps.setInt(1, groupId);
+							ps.setString(2, authority);
+						}
+					});
+		}
+	}
+
+	public void deleteGroup(String groupName) {
+		logger.debug("Deleting group '" + groupName + "'");
+		Assert.hasText(groupName, "groupName should have text");
+
+		final int id = findGroupId(groupName);
+		PreparedStatementSetter groupIdPSS = new PreparedStatementSetter() {
+			public void setValues(PreparedStatement ps) throws SQLException {
+				ps.setInt(1, id);
+			}
+		};
+		getJdbcTemplate().update(deleteGroupMembersSql, groupIdPSS);
+		getJdbcTemplate().update(deleteGroupAuthoritiesSql, groupIdPSS);
+		getJdbcTemplate().update(deleteGroupSql, groupIdPSS);
+	}
+
+	public void renameGroup(String oldName, String newName) {
+		logger.debug("Changing group name from '" + oldName + "' to '" + newName + "'");
+		Assert.hasText(oldName, "oldName should have text");;
+		Assert.hasText(newName, "newName should have text");;
+
+		getJdbcTemplate().update(renameGroupSql, newName, oldName);
+	}
+
+	public void addUserToGroup(final String username, final String groupName) {
+		logger.debug("Adding user '" + username + "' to group '" + groupName + "'");
+		Assert.hasText(username, "username should have text");;
+		Assert.hasText(groupName, "groupName should have text");;
+
+		final int id = findGroupId(groupName);
+		getJdbcTemplate().update(insertGroupMemberSql, new PreparedStatementSetter() {
+			public void setValues(PreparedStatement ps) throws SQLException {
+				ps.setInt(1, id);
+				ps.setString(2, username);
+			}
+		});
+
+		userCache.removeUserFromCache(username);
+	}
+
+	public void removeUserFromGroup(final String username, final String groupName) {
+		logger.debug("Removing user '" + username + "' to group '" + groupName + "'");
+		Assert.hasText(username, "username should have text");;
+		Assert.hasText(groupName, "groupName should have text");;
+
+		final int id = findGroupId(groupName);
+
+		getJdbcTemplate().update(deleteGroupMemberSql, new PreparedStatementSetter() {
+			public void setValues(PreparedStatement ps) throws SQLException {
+				ps.setInt(1, id);
+				ps.setString(2, username);
+			}
+		});
+
+		userCache.removeUserFromCache(username);
+	}
+
+	public List<GrantedAuthority> findGroupAuthorities(String groupName) {
+		logger.debug("Loading authorities for group '" + groupName + "'");
+		Assert.hasText(groupName, "groupName should have text");;
+
+		return getJdbcTemplate().query(groupAuthoritiesSql, new String[] { groupName },
+				new RowMapper<GrantedAuthority>() {
+					public GrantedAuthority mapRow(ResultSet rs, int rowNum)
+							throws SQLException {
+						String roleName = getRolePrefix() + rs.getString(3);
+
+						return new SimpleGrantedAuthority(roleName);
+					}
+				});
+	}
+
+	public void removeGroupAuthority(String groupName, final GrantedAuthority authority) {
+		logger.debug("Removing authority '" + authority + "' from group '" + groupName
+				+ "'");
+		Assert.hasText(groupName, "groupName should have text");
+		Assert.notNull(authority, "authority cannot be null");
+
+		final int id = findGroupId(groupName);
+
+		getJdbcTemplate().update(deleteGroupAuthoritySql, new PreparedStatementSetter() {
+
+			public void setValues(PreparedStatement ps) throws SQLException {
+				ps.setInt(1, id);
+				ps.setString(2, authority.getAuthority());
+			}
+		});
+	}
+
+	public void addGroupAuthority(final String groupName, final GrantedAuthority authority) {
+		logger.debug("Adding authority '" + authority + "' to group '" + groupName + "'");
+		Assert.hasText(groupName, "groupName should have text");;
+		Assert.notNull(authority, "authority cannot be null");
+
+		final int id = findGroupId(groupName);
+		getJdbcTemplate().update(insertGroupAuthoritySql, new PreparedStatementSetter() {
+			public void setValues(PreparedStatement ps) throws SQLException {
+				ps.setInt(1, id);
+				ps.setString(2, authority.getAuthority());
+			}
+		});
+	}
+
+	private int findGroupId(String group) {
+		return getJdbcTemplate().queryForObject(findGroupIdSql, Integer.class, group);
+	}
+
+	public void setAuthenticationManager(AuthenticationManager authenticationManager) {
+		this.authenticationManager = authenticationManager;
+	}
+
+	public void setCreateUserSql(String createUserSql) {
+		Assert.hasText(createUserSql, "createUserSql should have text");;
+		this.createUserSql = createUserSql;
+	}
+
+	public void setDeleteUserSql(String deleteUserSql) {
+		Assert.hasText(deleteUserSql, "deleteUserSql should have text");;
+		this.deleteUserSql = deleteUserSql;
+	}
+
+	public void setUpdateUserSql(String updateUserSql) {
+		Assert.hasText(updateUserSql, "updateUserSql should have text");;
+		this.updateUserSql = updateUserSql;
+	}
+
+	public void setCreateAuthoritySql(String createAuthoritySql) {
+		Assert.hasText(createAuthoritySql, "createAuthoritySql should have text");;
+		this.createAuthoritySql = createAuthoritySql;
+	}
+
+	public void setDeleteUserAuthoritiesSql(String deleteUserAuthoritiesSql) {
+		Assert.hasText(deleteUserAuthoritiesSql, "deleteUserAuthoritiesSql should have text");;
+		this.deleteUserAuthoritiesSql = deleteUserAuthoritiesSql;
+	}
+
+	public void setUserExistsSql(String userExistsSql) {
+		Assert.hasText(userExistsSql, "userExistsSql should have text");;
+		this.userExistsSql = userExistsSql;
+	}
+
+	public void setChangePasswordSql(String changePasswordSql) {
+		Assert.hasText(changePasswordSql, "changePasswordSql should have text");;
+		this.changePasswordSql = changePasswordSql;
+	}
+
+	public void setFindAllGroupsSql(String findAllGroupsSql) {
+		Assert.hasText(findAllGroupsSql, "findAllGroupsSql should have text");;
+		this.findAllGroupsSql = findAllGroupsSql;
+	}
+
+	public void setFindUsersInGroupSql(String findUsersInGroupSql) {
+		Assert.hasText(findUsersInGroupSql, "findUsersInGroupSql should have text");;
+		this.findUsersInGroupSql = findUsersInGroupSql;
+	}
+
+	public void setInsertGroupSql(String insertGroupSql) {
+		Assert.hasText(insertGroupSql, "insertGroupSql should have text");;
+		this.insertGroupSql = insertGroupSql;
+	}
+
+	public void setFindGroupIdSql(String findGroupIdSql) {
+		Assert.hasText(findGroupIdSql, "findGroupIdSql should have text");;
+		this.findGroupIdSql = findGroupIdSql;
+	}
+
+	public void setInsertGroupAuthoritySql(String insertGroupAuthoritySql) {
+		Assert.hasText(insertGroupAuthoritySql, "insertGroupAuthoritySql should have text");;
+		this.insertGroupAuthoritySql = insertGroupAuthoritySql;
+	}
+
+	public void setDeleteGroupSql(String deleteGroupSql) {
+		Assert.hasText(deleteGroupSql, "deleteGroupSql should have text");;
+		this.deleteGroupSql = deleteGroupSql;
+	}
+
+	public void setDeleteGroupAuthoritiesSql(String deleteGroupAuthoritiesSql) {
+		Assert.hasText(deleteGroupAuthoritiesSql, "deleteGroupAuthoritiesSql should have text");;
+		this.deleteGroupAuthoritiesSql = deleteGroupAuthoritiesSql;
+	}
+
+	public void setDeleteGroupMembersSql(String deleteGroupMembersSql) {
+		Assert.hasText(deleteGroupMembersSql, "deleteGroupMembersSql should have text");;
+		this.deleteGroupMembersSql = deleteGroupMembersSql;
+	}
+
+	public void setRenameGroupSql(String renameGroupSql) {
+		Assert.hasText(renameGroupSql, "renameGroupSql should have text");;
+		this.renameGroupSql = renameGroupSql;
+	}
+
+	public void setInsertGroupMemberSql(String insertGroupMemberSql) {
+		Assert.hasText(insertGroupMemberSql, "insertGroupMemberSql should have text");;
+		this.insertGroupMemberSql = insertGroupMemberSql;
+	}
+
+	public void setDeleteGroupMemberSql(String deleteGroupMemberSql) {
+		Assert.hasText(deleteGroupMemberSql, "deleteGroupMemberSql should have text");;
+		this.deleteGroupMemberSql = deleteGroupMemberSql;
+	}
+
+	public void setGroupAuthoritiesSql(String groupAuthoritiesSql) {
+		Assert.hasText(groupAuthoritiesSql, "groupAuthoritiesSql should have text");;
+		this.groupAuthoritiesSql = groupAuthoritiesSql;
+	}
+
+	public void setDeleteGroupAuthoritySql(String deleteGroupAuthoritySql) {
+		Assert.hasText(deleteGroupAuthoritySql, "deleteGroupAuthoritySql should have text");;
+		this.deleteGroupAuthoritySql = deleteGroupAuthoritySql;
+	}
+
+	/**
+	 * Optionally sets the UserCache if one is in use in the application. This allows the
+	 * user to be removed from the cache after updates have taken place to avoid stale
+	 * data.
+	 *
+	 * @param userCache the cache used by the AuthenticationManager.
+	 */
+	public void setUserCache(UserCache userCache) {
+		Assert.notNull(userCache, "userCache cannot be null");
+		this.userCache = userCache;
+	}
+
+	private void validateUserDetails(UserDetails user) {
+		Assert.hasText(user.getUsername(), "Username may not be empty or null");
+		validateAuthorities(user.getAuthorities());
+	}
+
+	private void validateAuthorities(Collection<? extends GrantedAuthority> authorities) {
+		Assert.notNull(authorities, "Authorities list must not be null");
+
+		for (GrantedAuthority authority : authorities) {
+			Assert.notNull(authority, "Authorities list contains a null entry");
+			Assert.hasText(authority.getAuthority(),
+					"getAuthority() method must return a non-empty string");
+		}
+	}
+}

+ 1 - 1
core/src/test/java/org/springframework/security/access/annotation/SecuredAnnotationSecurityMetadataSourceTests.java

@@ -248,7 +248,7 @@ public class SecuredAnnotationSecurityMetadataSourceTests {
 	class CustomAnnotatedServiceImpl implements CustomAnnotatedService {
 	}
 
-	enum SecurityEnum implements ConfigAttribute,GrantedAuthority {
+	enum SecurityEnum implements ConfigAttribute, GrantedAuthority {
 		ADMIN, USER;
 
 		public String getAttribute() {

+ 1 - 1
core/src/test/java/org/springframework/security/access/expression/method/MethodExpressionVoterTests.java

@@ -88,7 +88,7 @@ public class MethodExpressionVoterTests {
 		am.vote(joe, mi, createAttributes(new PreInvocationExpressionAttribute(
 				"(filterObject == 'joe' or filterObject == 'sam')", "collection",
 				"permitAll")));
-		assertThat(arg).containsExactly("joe","sam");
+		assertThat(arg).containsExactly("joe", "sam");
 	}
 
 	@Test(expected = IllegalArgumentException.class)

+ 12 - 12
core/src/test/java/org/springframework/security/core/SpringSecurityCoreVersionTests.java

@@ -85,8 +85,8 @@ public class SpringSecurityCoreVersionTests {
 		String version = "1";
 		spy(SpringSecurityCoreVersion.class);
 		spy(SpringVersion.class);
-		doReturn(version).when(SpringSecurityCoreVersion.class,"getVersion");
-		doReturn(version).when(SpringVersion.class,"getVersion");
+		doReturn(version).when(SpringSecurityCoreVersion.class, "getVersion");
+		doReturn(version).when(SpringVersion.class, "getVersion");
 
 		performChecks();
 
@@ -97,8 +97,8 @@ public class SpringSecurityCoreVersionTests {
 	public void noLoggingIfSpringVersionNull() throws Exception {
 		spy(SpringSecurityCoreVersion.class);
 		spy(SpringVersion.class);
-		doReturn("1").when(SpringSecurityCoreVersion.class,"getVersion");
-		doReturn(null).when(SpringVersion.class,"getVersion");
+		doReturn("1").when(SpringSecurityCoreVersion.class, "getVersion");
+		doReturn(null).when(SpringVersion.class, "getVersion");
 
 		performChecks();
 
@@ -109,8 +109,8 @@ public class SpringSecurityCoreVersionTests {
 	public void warnIfSpringVersionTooSmall() throws Exception {
 		spy(SpringSecurityCoreVersion.class);
 		spy(SpringVersion.class);
-		doReturn("3").when(SpringSecurityCoreVersion.class,"getVersion");
-		doReturn("2").when(SpringVersion.class,"getVersion");
+		doReturn("3").when(SpringSecurityCoreVersion.class, "getVersion");
+		doReturn("2").when(SpringVersion.class, "getVersion");
 
 		performChecks();
 
@@ -121,8 +121,8 @@ public class SpringSecurityCoreVersionTests {
 	public void noWarnIfSpringVersionLarger() throws Exception {
 		spy(SpringSecurityCoreVersion.class);
 		spy(SpringVersion.class);
-		doReturn("4.0.0.RELEASE").when(SpringSecurityCoreVersion.class,"getVersion");
-		doReturn("4.0.0.RELEASE").when(SpringVersion.class,"getVersion");
+		doReturn("4.0.0.RELEASE").when(SpringSecurityCoreVersion.class, "getVersion");
+		doReturn("4.0.0.RELEASE").when(SpringVersion.class, "getVersion");
 
 		performChecks();
 
@@ -135,8 +135,8 @@ public class SpringSecurityCoreVersionTests {
 		String minSpringVersion = "3.2.8.RELEASE";
 		spy(SpringSecurityCoreVersion.class);
 		spy(SpringVersion.class);
-		doReturn("3.2.0.RELEASE").when(SpringSecurityCoreVersion.class,"getVersion");
-		doReturn("3.2.10.RELEASE").when(SpringVersion.class,"getVersion");
+		doReturn("3.2.0.RELEASE").when(SpringSecurityCoreVersion.class, "getVersion");
+		doReturn("3.2.10.RELEASE").when(SpringVersion.class, "getVersion");
 
 		performChecks(minSpringVersion);
 
@@ -147,8 +147,8 @@ public class SpringSecurityCoreVersionTests {
 	public void noLoggingIfPropertySet() throws Exception {
 		spy(SpringSecurityCoreVersion.class);
 		spy(SpringVersion.class);
-		doReturn("3").when(SpringSecurityCoreVersion.class,"getVersion");
-		doReturn("2").when(SpringVersion.class,"getVersion");
+		doReturn("3").when(SpringSecurityCoreVersion.class, "getVersion");
+		doReturn("2").when(SpringVersion.class, "getVersion");
 		System.setProperty(getDisableChecksProperty(), Boolean.TRUE.toString());
 
 		performChecks();

+ 2 - 2
core/src/test/java/org/springframework/security/core/userdetails/PasswordEncodedUser.java

@@ -25,7 +25,7 @@ import java.util.function.Function;
 public class PasswordEncodedUser {
 	private static final UserDetails USER = withUsername("user").password("password").roles("USER").build();
 
-	private static final UserDetails ADMIN = withUsername("admin").password("password").roles("USER","ADMIN").build();
+	private static final UserDetails ADMIN = withUsername("admin").password("password").roles("USER", "ADMIN").build();
 
 	public static UserDetails user() {
 		return User.withUserDetails(USER).build();
@@ -48,7 +48,7 @@ public class PasswordEncodedUser {
 			.passwordEncoder(passwordEncoder());
 	}
 
-	private static Function<String,String> passwordEncoder() {
+	private static Function<String, String> passwordEncoder() {
 		return rawPassword -> "{noop}" + rawPassword;
 	}
 

+ 2 - 2
core/src/test/java/org/springframework/security/core/userdetails/UserTests.java

@@ -150,7 +150,7 @@ public class UserTests {
 
 	@Test
 	public void withUserDetailsWhenAllEnabled() throws Exception {
-		User expected = new User("rob","pass", true, true, true, true, ROLE_12);
+		User expected = new User("rob", "pass", true, true, true, true, ROLE_12);
 
 		UserDetails actual = User.withUserDetails(expected).build();
 
@@ -166,7 +166,7 @@ public class UserTests {
 
 	@Test
 	public void withUserDetailsWhenAllDisabled() throws Exception {
-		User expected = new User("rob","pass", false, false, false, false, ROLE_12);
+		User expected = new User("rob", "pass", false, false, false, false, ROLE_12);
 
 		UserDetails actual = User.withUserDetails(expected).build();
 

+ 2 - 2
core/src/test/java/org/springframework/security/jackson2/RememberMeAuthenticationTokenMixinTests.java

@@ -107,8 +107,8 @@ public class RememberMeAuthenticationTokenMixinTests extends AbstractMixinTests
 				.readValue(String.format(REMEMBERME_AUTH_JSON, "\"password\""), RememberMeAuthenticationToken.class);
 		assertThat(token).isNotNull();
 		assertThat(token.getPrincipal()).isNotNull().isInstanceOf(User.class);
-		assertThat(((User)token.getPrincipal()).getUsername()).isEqualTo("admin");
-		assertThat(((User)token.getPrincipal()).getPassword()).isEqualTo("1234");
+		assertThat(((User) token.getPrincipal()).getUsername()).isEqualTo("admin");
+		assertThat(((User) token.getPrincipal()).getPassword()).isEqualTo("1234");
 		assertThat(((User) token.getPrincipal()).getAuthorities()).hasSize(1).contains(new SimpleGrantedAuthority("ROLE_USER"));
 		assertThat(token.getAuthorities()).hasSize(1).contains(new SimpleGrantedAuthority("ROLE_USER"));
 		assertThat(((User) token.getPrincipal()).isEnabled()).isEqualTo(true);

+ 1 - 1
core/src/test/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenMixinTests.java

@@ -120,7 +120,7 @@ public class UsernamePasswordAuthenticationTokenMixinTests extends AbstractMixin
 				.readValue(AUTHENTICATED_JSON, UsernamePasswordAuthenticationToken.class);
 		assertThat(token).isNotNull();
 		assertThat(token.getPrincipal()).isNotNull().isInstanceOf(User.class);
-		assertThat(((User)token.getPrincipal()).getAuthorities()).isNotNull().hasSize(1).contains(new SimpleGrantedAuthority("ROLE_USER"));
+		assertThat(((User) token.getPrincipal()).getAuthorities()).isNotNull().hasSize(1).contains(new SimpleGrantedAuthority("ROLE_USER"));
 		assertThat(token.isAuthenticated()).isEqualTo(true);
 		assertThat(token.getAuthorities()).hasSize(1).contains(new SimpleGrantedAuthority("ROLE_USER"));
 	}

+ 1 - 1
crypto/src/main/java/org/springframework/security/crypto/factory/PasswordEncoderFactories.java

@@ -60,7 +60,7 @@ public class PasswordEncoderFactories {
 	 */
 	public static PasswordEncoder createDelegatingPasswordEncoder() {
 		String encodingId = "bcrypt";
-		Map<String,PasswordEncoder> encoders = new HashMap<>();
+		Map<String, PasswordEncoder> encoders = new HashMap<>();
 		encoders.put(encodingId, new BCryptPasswordEncoder());
 		encoders.put("ldap", new LdapShaPasswordEncoder());
 		encoders.put("MD4", new Md4PasswordEncoder());

+ 1 - 1
crypto/src/main/java/org/springframework/security/crypto/password/DelegatingPasswordEncoder.java

@@ -123,7 +123,7 @@ public class DelegatingPasswordEncoder implements PasswordEncoder {
 	private static final String SUFFIX = "}";
 	private final String idForEncode;
 	private final PasswordEncoder passwordEncoderForEncode;
-	private final Map<String,PasswordEncoder> idToPasswordEncoder;
+	private final Map<String, PasswordEncoder> idToPasswordEncoder;
 	private PasswordEncoder defaultPasswordEncoderForMatches = new UnmappedIdPasswordEncoder();
 
 	/**

+ 1 - 1
crypto/src/test/java/org/springframework/security/crypto/codec/HexTests.java

@@ -34,7 +34,7 @@ public class HexTests {
 	@Test
 	public void encode() {
 		assertThat(Hex.encode(new byte[] { (byte) 'A', (byte) 'B', (byte) 'C',
-				(byte) 'D' })).isEqualTo(new char[] {'4','1','4','2','4','3','4','4'});
+				(byte) 'D' })).isEqualTo(new char[] {'4', '1', '4', '2', '4', '3', '4', '4'});
 	}
 
 	@Test

+ 1 - 1
crypto/src/test/java/org/springframework/security/crypto/password/DelegatingPasswordEncoderTests.java

@@ -55,7 +55,7 @@ public class DelegatingPasswordEncoderTests {
 
 	private String noopEncodedPassword = "{noop}" + this.encodedPassword;
 
-	private Map<String,PasswordEncoder> delegates;
+	private Map<String, PasswordEncoder> delegates;
 
 	private DelegatingPasswordEncoder passwordEncoder;
 

+ 1 - 1
crypto/src/test/java/org/springframework/security/crypto/password/LdapShaPasswordEncoderTests.java

@@ -100,7 +100,7 @@ public class LdapShaPasswordEncoderTests {
 
 	@Test(expected = IllegalArgumentException.class)
 	public void invalidPrefixIsRejected() {
-		this.sha.matches("somepassword","{MD9}xxxxxxxxxx");
+		this.sha.matches("somepassword", "{MD9}xxxxxxxxxx");
 	}
 
 	@Test(expected = IllegalArgumentException.class)

+ 120 - 120
crypto/src/test/java/org/springframework/security/crypto/scrypt/SCryptPasswordEncoderTests.java

@@ -1,120 +1,120 @@
-/*
- * Copyright 2002-2017 the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.springframework.security.crypto.scrypt;
-
-import static org.assertj.core.api.Assertions.*;
-
-import org.junit.Test;
-
-/**
- * @author Shazin Sadakath
- *
- */
-public class SCryptPasswordEncoderTests {
-
-	@Test
-	public void matches() {
-		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
-		String result = encoder.encode("password");
-		assertThat(result).isNotEqualTo("password");
-		assertThat(encoder.matches("password", result)).isTrue();
-	}
-
-	@Test
-	public void unicode() {
-		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
-		String result = encoder.encode("passw\u9292rd");
-		assertThat(encoder.matches("pass\u9292\u9292rd", result)).isFalse();
-		assertThat(encoder.matches("passw\u9292rd", result)).isTrue();
-	}
-
-	@Test
-	public void notMatches() {
-		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
-		String result = encoder.encode("password");
-		assertThat(encoder.matches("bogus", result)).isFalse();
-	}
-
-	@Test
-	public void customParameters() {
-		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder(512, 8, 4, 32, 16);
-		String result = encoder.encode("password");
-		assertThat(result).isNotEqualTo("password");
-		assertThat(encoder.matches("password", result)).isTrue();
-	}
-
-	@Test
-	public void differentPasswordHashes() {
-		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
-		String password = "secret";
-		assertThat(encoder.encode(password)).isNotEqualTo(encoder.encode(password));
-	}
-
-	@Test
-	public void samePasswordWithDifferentParams() {
-		SCryptPasswordEncoder oldEncoder = new SCryptPasswordEncoder(16384, 8, 1, 32,64);
-		SCryptPasswordEncoder newEncoder = new SCryptPasswordEncoder();
-
-		String password = "secret";
-		String oldEncodedPassword = oldEncoder.encode(password);
-		assertThat(newEncoder.matches(password, oldEncodedPassword)).isTrue();
-	}
-
-	@Test
-	public void doesntMatchNullEncodedValue() {
-		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
-		assertThat(encoder.matches("password", null)).isFalse();
-	}
-
-	@Test
-	public void doesntMatchEmptyEncodedValue() {
-		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
-		assertThat(encoder.matches("password", "")).isFalse();
-	}
-
-	@Test
-	public void doesntMatchBogusEncodedValue() {
-		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
-		assertThat(encoder.matches("password", "012345678901234567890123456789")).isFalse();
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void invalidCpuCostParameter() {
-		new SCryptPasswordEncoder(Integer.MIN_VALUE, 16, 2, 32, 16);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void invalidMemoryCostParameter() {
-		new SCryptPasswordEncoder(2, Integer.MAX_VALUE, 2, 32, 16);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void invalidParallelizationParameter() {
-		new SCryptPasswordEncoder(2, 8, Integer.MAX_VALUE, 32, 16);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void invalidSaltLengthParameter() {
-		new SCryptPasswordEncoder(2, 8, 1, 16, -1);
-	}
-
-	@Test(expected = IllegalArgumentException.class)
-	public void invalidKeyLengthParameter() {
-		new SCryptPasswordEncoder(2, 8, 1, -1, 16);
-	}
-
-}
-
+/*
+ * Copyright 2002-2017 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.springframework.security.crypto.scrypt;
+
+import static org.assertj.core.api.Assertions.*;
+
+import org.junit.Test;
+
+/**
+ * @author Shazin Sadakath
+ *
+ */
+public class SCryptPasswordEncoderTests {
+
+	@Test
+	public void matches() {
+		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
+		String result = encoder.encode("password");
+		assertThat(result).isNotEqualTo("password");
+		assertThat(encoder.matches("password", result)).isTrue();
+	}
+
+	@Test
+	public void unicode() {
+		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
+		String result = encoder.encode("passw\u9292rd");
+		assertThat(encoder.matches("pass\u9292\u9292rd", result)).isFalse();
+		assertThat(encoder.matches("passw\u9292rd", result)).isTrue();
+	}
+
+	@Test
+	public void notMatches() {
+		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
+		String result = encoder.encode("password");
+		assertThat(encoder.matches("bogus", result)).isFalse();
+	}
+
+	@Test
+	public void customParameters() {
+		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder(512, 8, 4, 32, 16);
+		String result = encoder.encode("password");
+		assertThat(result).isNotEqualTo("password");
+		assertThat(encoder.matches("password", result)).isTrue();
+	}
+
+	@Test
+	public void differentPasswordHashes() {
+		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
+		String password = "secret";
+		assertThat(encoder.encode(password)).isNotEqualTo(encoder.encode(password));
+	}
+
+	@Test
+	public void samePasswordWithDifferentParams() {
+		SCryptPasswordEncoder oldEncoder = new SCryptPasswordEncoder(16384, 8, 1, 32, 64);
+		SCryptPasswordEncoder newEncoder = new SCryptPasswordEncoder();
+
+		String password = "secret";
+		String oldEncodedPassword = oldEncoder.encode(password);
+		assertThat(newEncoder.matches(password, oldEncodedPassword)).isTrue();
+	}
+
+	@Test
+	public void doesntMatchNullEncodedValue() {
+		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
+		assertThat(encoder.matches("password", null)).isFalse();
+	}
+
+	@Test
+	public void doesntMatchEmptyEncodedValue() {
+		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
+		assertThat(encoder.matches("password", "")).isFalse();
+	}
+
+	@Test
+	public void doesntMatchBogusEncodedValue() {
+		SCryptPasswordEncoder encoder = new SCryptPasswordEncoder();
+		assertThat(encoder.matches("password", "012345678901234567890123456789")).isFalse();
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void invalidCpuCostParameter() {
+		new SCryptPasswordEncoder(Integer.MIN_VALUE, 16, 2, 32, 16);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void invalidMemoryCostParameter() {
+		new SCryptPasswordEncoder(2, Integer.MAX_VALUE, 2, 32, 16);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void invalidParallelizationParameter() {
+		new SCryptPasswordEncoder(2, 8, Integer.MAX_VALUE, 32, 16);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void invalidSaltLengthParameter() {
+		new SCryptPasswordEncoder(2, 8, 1, 16, -1);
+	}
+
+	@Test(expected = IllegalArgumentException.class)
+	public void invalidKeyLengthParameter() {
+		new SCryptPasswordEncoder(2, 8, 1, -1, 16);
+	}
+
+}
+

+ 3 - 0
etc/checkstyle/checkstyle.xml

@@ -40,5 +40,8 @@
 			<property name="illegalPattern" value="true"/>
 			<property name="message" value="Trailing whitespace"/>
 		</module>
+
+		<!-- Whitespace -->
+		<module name="WhitespaceAfterCheck" />
 	</module>
 </module>

+ 1 - 1
itest/web/src/integration-test/java/org/springframework/security/integration/ConcurrentSessionManagementTests.java

@@ -47,7 +47,7 @@ public class ConcurrentSessionManagementTests extends AbstractWebServerIntegrati
 		final MockHttpSession session1 = new MockHttpSession();
 		final MockHttpSession session2 = new MockHttpSession();
 
-		MockMvc mockMvc = createMockMvc("classpath:/spring/http-security-concurrency.xml","classpath:/spring/in-memory-provider.xml", "classpath:/spring/testapp-servlet.xml");
+		MockMvc mockMvc = createMockMvc("classpath:/spring/http-security-concurrency.xml", "classpath:/spring/in-memory-provider.xml", "classpath:/spring/testapp-servlet.xml");
 
 		mockMvc.perform(get("secure/index").session(session1))
 			.andExpect(status().is3xxRedirection());

+ 1 - 1
ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java

@@ -127,7 +127,7 @@ public final class PasswordComparisonAuthenticator extends AbstractLdapAuthentic
 			return null;
 		}
 		if(passwordAttrValue instanceof byte[]) {
-			return new String((byte[])passwordAttrValue);
+			return new String((byte[]) passwordAttrValue);
 		}
 		return String.valueOf(passwordAttrValue);
 	}

+ 1 - 1
ldap/src/test/java/org/springframework/security/ldap/LdapUtilsTests.java

@@ -49,7 +49,7 @@ public class LdapUtilsTests {
 
 		when(mockCtx.getNameInNamespace()).thenReturn("dc=springframework,dc=org");
 
-		assertThat(LdapUtils.getRelativeName("dc=springframework,dc=org",mockCtx)).isEqualTo("");
+		assertThat(LdapUtils.getRelativeName("dc=springframework,dc=org", mockCtx)).isEqualTo("");
 	}
 
 	@Test

+ 1 - 1
oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestRedirectFilter.java

@@ -125,7 +125,7 @@ public class OAuth2AuthorizationRequestRedirectFilter extends OncePerRequestFilt
 
 		String redirectUriStr = this.expandRedirectUri(request, clientRegistration);
 
-		Map<String,Object> additionalParameters = new HashMap<>();
+		Map<String, Object> additionalParameters = new HashMap<>();
 		additionalParameters.put(OAuth2ParameterNames.REGISTRATION_ID, clientRegistration.getRegistrationId());
 
 		OAuth2AuthorizationRequest.Builder builder;

+ 2 - 2
oauth2/oauth2-client/src/main/java/org/springframework/security/oauth2/client/web/OAuth2LoginAuthenticationFilter.java

@@ -117,7 +117,7 @@ public class OAuth2LoginAuthenticationFilter extends AbstractAuthenticationProce
 		}
 		this.authorizationRequestRepository.removeAuthorizationRequest(request);
 
-		String registrationId = (String)authorizationRequest.getAdditionalParameters().get(OAuth2ParameterNames.REGISTRATION_ID);
+		String registrationId = (String) authorizationRequest.getAdditionalParameters().get(OAuth2ParameterNames.REGISTRATION_ID);
 		ClientRegistration clientRegistration = this.clientRegistrationRepository.findByRegistrationId(registrationId);
 
 		OAuth2LoginAuthenticationToken authenticationRequest = new OAuth2LoginAuthenticationToken(
@@ -125,7 +125,7 @@ public class OAuth2LoginAuthenticationFilter extends AbstractAuthenticationProce
 		authenticationRequest.setDetails(this.authenticationDetailsSource.buildDetails(request));
 
 		OAuth2LoginAuthenticationToken authenticationResult =
-			(OAuth2LoginAuthenticationToken)this.getAuthenticationManager().authenticate(authenticationRequest);
+			(OAuth2LoginAuthenticationToken) this.getAuthenticationManager().authenticate(authenticationRequest);
 
 		OAuth2AuthenticationToken oauth2Authentication = new OAuth2AuthenticationToken(
 			authenticationResult.getPrincipal(),

+ 3 - 3
oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/authentication/OAuth2LoginAuthenticationProviderTests.java

@@ -119,7 +119,7 @@ public class OAuth2LoginAuthenticationProviderTests {
 		when(this.authorizationRequest.getScopes()).thenReturn(new LinkedHashSet<>(Collections.singleton("openid")));
 
 		OAuth2LoginAuthenticationToken authentication =
-			(OAuth2LoginAuthenticationToken)this.authenticationProvider.authenticate(
+			(OAuth2LoginAuthenticationToken) this.authenticationProvider.authenticate(
 				new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange));
 
 		assertThat(authentication).isNull();
@@ -175,7 +175,7 @@ public class OAuth2LoginAuthenticationProviderTests {
 		when(this.userService.loadUser(any())).thenReturn(principal);
 
 		OAuth2LoginAuthenticationToken authentication =
-			(OAuth2LoginAuthenticationToken)this.authenticationProvider.authenticate(
+			(OAuth2LoginAuthenticationToken) this.authenticationProvider.authenticate(
 				new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange));
 
 		assertThat(authentication.isAuthenticated()).isTrue();
@@ -207,7 +207,7 @@ public class OAuth2LoginAuthenticationProviderTests {
 		this.authenticationProvider.setAuthoritiesMapper(authoritiesMapper);
 
 		OAuth2LoginAuthenticationToken authentication =
-			(OAuth2LoginAuthenticationToken)this.authenticationProvider.authenticate(
+			(OAuth2LoginAuthenticationToken) this.authenticationProvider.authenticate(
 				new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange));
 
 		assertThat(authentication.getAuthorities()).isEqualTo(mappedAuthorities);

+ 3 - 3
oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/authentication/OidcAuthorizationCodeAuthenticationProviderTests.java

@@ -143,7 +143,7 @@ public class OidcAuthorizationCodeAuthenticationProviderTests {
 		when(this.authorizationRequest.getScopes()).thenReturn(new LinkedHashSet<>(Collections.singleton("scope1")));
 
 		OAuth2LoginAuthenticationToken authentication =
-			(OAuth2LoginAuthenticationToken)this.authenticationProvider.authenticate(
+			(OAuth2LoginAuthenticationToken) this.authenticationProvider.authenticate(
 				new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange));
 
 		assertThat(authentication).isNull();
@@ -355,7 +355,7 @@ public class OidcAuthorizationCodeAuthenticationProviderTests {
 		when(this.userService.loadUser(any())).thenReturn(principal);
 
 		OAuth2LoginAuthenticationToken authentication =
-			(OAuth2LoginAuthenticationToken)this.authenticationProvider.authenticate(
+			(OAuth2LoginAuthenticationToken) this.authenticationProvider.authenticate(
 				new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange));
 
 		assertThat(authentication.isAuthenticated()).isTrue();
@@ -389,7 +389,7 @@ public class OidcAuthorizationCodeAuthenticationProviderTests {
 		this.authenticationProvider.setAuthoritiesMapper(authoritiesMapper);
 
 		OAuth2LoginAuthenticationToken authentication =
-			(OAuth2LoginAuthenticationToken)this.authenticationProvider.authenticate(
+			(OAuth2LoginAuthenticationToken) this.authenticationProvider.authenticate(
 				new OAuth2LoginAuthenticationToken(this.clientRegistration, this.authorizationExchange));
 
 		assertThat(authentication.getAuthorities()).isEqualTo(mappedAuthorities);

+ 1 - 1
oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/oidc/userinfo/OidcUserServiceTests.java

@@ -159,7 +159,7 @@ public class OidcUserServiceTests {
 
 		assertThat(user.getAuthorities().size()).isEqualTo(1);
 		assertThat(user.getAuthorities().iterator().next()).isInstanceOf(OidcUserAuthority.class);
-		OidcUserAuthority userAuthority = (OidcUserAuthority)user.getAuthorities().iterator().next();
+		OidcUserAuthority userAuthority = (OidcUserAuthority) user.getAuthorities().iterator().next();
 		assertThat(userAuthority.getAuthority()).isEqualTo("ROLE_USER");
 		assertThat(userAuthority.getIdToken()).isEqualTo(user.getIdToken());
 		assertThat(userAuthority.getUserInfo()).isEqualTo(user.getUserInfo());

+ 1 - 1
oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/userinfo/DefaultOAuth2UserServiceTests.java

@@ -121,7 +121,7 @@ public class DefaultOAuth2UserServiceTests {
 
 		assertThat(user.getAuthorities().size()).isEqualTo(1);
 		assertThat(user.getAuthorities().iterator().next()).isInstanceOf(OAuth2UserAuthority.class);
-		OAuth2UserAuthority userAuthority = (OAuth2UserAuthority)user.getAuthorities().iterator().next();
+		OAuth2UserAuthority userAuthority = (OAuth2UserAuthority) user.getAuthorities().iterator().next();
 		assertThat(userAuthority.getAuthority()).isEqualTo("ROLE_USER");
 		assertThat(userAuthority.getAttributes()).isEqualTo(user.getAttributes());
 	}

+ 1 - 1
oauth2/oauth2-client/src/test/java/org/springframework/security/oauth2/client/web/OAuth2AuthorizationRequestUriBuilderTests.java

@@ -43,7 +43,7 @@ public class OAuth2AuthorizationRequestUriBuilderTests {
 	@Test
 	public void buildWhenScopeMultiThenSeparatedByEncodedSpace() {
 		OAuth2AuthorizationRequest request = OAuth2AuthorizationRequest.implicit()
-			.additionalParameters(Collections.singletonMap("foo","bar"))
+			.additionalParameters(Collections.singletonMap("foo", "bar"))
 			.authorizationUri("https://idp.example.com/oauth2/v2/auth")
 			.clientId("client-id")
 			.state("thestate")

+ 2 - 2
oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/ClaimAccessor.java

@@ -75,7 +75,7 @@ public interface ClaimAccessor {
 			return null;
 		}
 		Map<String, Object> claimValues = new HashMap<>();
-		((Map<?, ?>)this.getClaims().get(claim)).forEach((k, v) -> claimValues.put(k.toString(), v));
+		((Map<?, ?>) this.getClaims().get(claim)).forEach((k, v) -> claimValues.put(k.toString(), v));
 		return claimValues;
 	}
 
@@ -84,7 +84,7 @@ public interface ClaimAccessor {
 			return null;
 		}
 		List<String> claimValues = new ArrayList<>();
-		((List<?>)this.getClaims().get(claim)).forEach(e -> claimValues.add(e.toString()));
+		((List<?>) this.getClaims().get(claim)).forEach(e -> claimValues.add(e.toString()));
 		return claimValues;
 	}
 }

+ 3 - 3
oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AccessTokenResponse.java

@@ -33,7 +33,7 @@ import java.util.Set;
  */
 public final class OAuth2AccessTokenResponse {
 	private OAuth2AccessToken accessToken;
-	private Map<String,Object> additionalParameters;
+	private Map<String, Object> additionalParameters;
 
 	private OAuth2AccessTokenResponse() {
 	}
@@ -55,7 +55,7 @@ public final class OAuth2AccessTokenResponse {
 		private OAuth2AccessToken.TokenType tokenType;
 		private long expiresIn;
 		private Set<String> scopes;
-		private Map<String,Object> additionalParameters;
+		private Map<String, Object> additionalParameters;
 
 		private Builder(String tokenValue) {
 			this.tokenValue = tokenValue;
@@ -76,7 +76,7 @@ public final class OAuth2AccessTokenResponse {
 			return this;
 		}
 
-		public Builder additionalParameters(Map<String,Object> additionalParameters) {
+		public Builder additionalParameters(Map<String, Object> additionalParameters) {
 			this.additionalParameters = additionalParameters;
 			return this;
 		}

+ 3 - 3
oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/endpoint/OAuth2AuthorizationRequest.java

@@ -49,7 +49,7 @@ public final class OAuth2AuthorizationRequest implements Serializable {
 	private String redirectUri;
 	private Set<String> scopes;
 	private String state;
-	private Map<String,Object> additionalParameters;
+	private Map<String, Object> additionalParameters;
 
 	private OAuth2AuthorizationRequest() {
 	}
@@ -102,7 +102,7 @@ public final class OAuth2AuthorizationRequest implements Serializable {
 		private String redirectUri;
 		private Set<String> scopes;
 		private String state;
-		private Map<String,Object> additionalParameters;
+		private Map<String, Object> additionalParameters;
 
 		private Builder(AuthorizationGrantType authorizationGrantType) {
 			Assert.notNull(authorizationGrantType, "authorizationGrantType cannot be null");
@@ -147,7 +147,7 @@ public final class OAuth2AuthorizationRequest implements Serializable {
 			return this;
 		}
 
-		public Builder additionalParameters(Map<String,Object> additionalParameters) {
+		public Builder additionalParameters(Map<String, Object> additionalParameters) {
 			this.additionalParameters = additionalParameters;
 			return this;
 		}

+ 6 - 6
oauth2/oauth2-core/src/main/java/org/springframework/security/oauth2/core/oidc/DefaultAddressStandardClaim.java

@@ -123,12 +123,12 @@ public final class DefaultAddressStandardClaim implements AddressStandardClaim {
 		}
 
 		public Builder(Map<String, Object> addressFields) {
-			this.formatted((String)addressFields.get(FORMATTED_FIELD_NAME));
-			this.streetAddress((String)addressFields.get(STREET_ADDRESS_FIELD_NAME));
-			this.locality((String)addressFields.get(LOCALITY_FIELD_NAME));
-			this.region((String)addressFields.get(REGION_FIELD_NAME));
-			this.postalCode((String)addressFields.get(POSTAL_CODE_FIELD_NAME));
-			this.country((String)addressFields.get(COUNTRY_FIELD_NAME));
+			this.formatted((String) addressFields.get(FORMATTED_FIELD_NAME));
+			this.streetAddress((String) addressFields.get(STREET_ADDRESS_FIELD_NAME));
+			this.locality((String) addressFields.get(LOCALITY_FIELD_NAME));
+			this.region((String) addressFields.get(REGION_FIELD_NAME));
+			this.postalCode((String) addressFields.get(POSTAL_CODE_FIELD_NAME));
+			this.country((String) addressFields.get(COUNTRY_FIELD_NAME));
 		}
 
 		public Builder formatted(String formatted) {

+ 2 - 2
samples/javaconfig/hellowebflux-method/src/integration-test/java/sample/HelloWebfluxMethodApplicationITests.java

@@ -87,11 +87,11 @@ public class HelloWebfluxMethodApplicationITests {
 	}
 
 	private Consumer<Map<String, Object>> robsCredentials() {
-		return basicAuthenticationCredentials("rob","rob");
+		return basicAuthenticationCredentials("rob", "rob");
 	}
 
 	private Consumer<Map<String, Object>> adminCredentials() {
-		return basicAuthenticationCredentials("admin","admin");
+		return basicAuthenticationCredentials("admin", "admin");
 	}
 
 	private String base64Encode(String value) {

+ 1 - 1
samples/javaconfig/hellowebflux-method/src/main/java/sample/SecurityConfig.java

@@ -49,7 +49,7 @@ public class SecurityConfig {
 	public MapReactiveUserDetailsService userDetailsRepository() {
 		User.UserBuilder userBuilder = User.withDefaultPasswordEncoder();
 		UserDetails rob = userBuilder.username("rob").password("rob").roles("USER").build();
-		UserDetails admin = userBuilder.username("admin").password("admin").roles("USER","ADMIN").build();
+		UserDetails admin = userBuilder.username("admin").password("admin").roles("USER", "ADMIN").build();
 		return new MapReactiveUserDetailsService(rob, admin);
 	}
 

+ 2 - 2
samples/javaconfig/hellowebflux-method/src/test/java/sample/HelloWebfluxMethodApplicationTests.java

@@ -138,10 +138,10 @@ public class HelloWebfluxMethodApplicationTests {
 	}
 
 	private Consumer<Map<String, Object>> robsCredentials() {
-		return basicAuthenticationCredentials("rob","rob");
+		return basicAuthenticationCredentials("rob", "rob");
 	}
 
 	private Consumer<Map<String, Object>> adminCredentials() {
-		return basicAuthenticationCredentials("admin","admin");
+		return basicAuthenticationCredentials("admin", "admin");
 	}
 }

+ 2 - 2
samples/javaconfig/hellowebflux/src/integration-test/java/sample/HelloWebfluxApplicationITests.java

@@ -87,10 +87,10 @@ public class HelloWebfluxApplicationITests {
 	}
 
 	private Consumer<Map<String, Object>> userCredentials() {
-		return basicAuthenticationCredentials("user","user");
+		return basicAuthenticationCredentials("user", "user");
 	}
 
 	private Consumer<Map<String, Object>> invalidCredentials() {
-		return basicAuthenticationCredentials("user","INVALID");
+		return basicAuthenticationCredentials("user", "INVALID");
 	}
 }

+ 2 - 2
samples/javaconfig/hellowebflux/src/main/java/sample/HelloUserController.java

@@ -32,13 +32,13 @@ import reactor.core.publisher.Mono;
 public class HelloUserController {
 
 	@GetMapping("/")
-	public Mono<Map<String,String>> hello(Mono<Principal> principal) {
+	public Mono<Map<String, String>> hello(Mono<Principal> principal) {
 		return principal
 			.map(Principal::getName)
 			.map(this::helloMessage);
 	}
 
-	private Map<String,String> helloMessage(String username) {
+	private Map<String, String> helloMessage(String username) {
 		return Collections.singletonMap("message", "Hello " + username + "!");
 	}
 }

+ 2 - 2
samples/javaconfig/hellowebflux/src/test/java/sample/HelloWebfluxApplicationTests.java

@@ -112,10 +112,10 @@ public class HelloWebfluxApplicationTests {
 	}
 
 	private Consumer<Map<String, Object>> userCredentials() {
-		return basicAuthenticationCredentials("user","user");
+		return basicAuthenticationCredentials("user", "user");
 	}
 
 	private Consumer<Map<String, Object>> invalidCredentials() {
-		return basicAuthenticationCredentials("user","INVALID");
+		return basicAuthenticationCredentials("user", "INVALID");
 	}
 }

+ 2 - 2
samples/javaconfig/hellowebfluxfn/src/integration-test/java/sample/HelloWebfluxFnApplicationITests.java

@@ -86,10 +86,10 @@ public class HelloWebfluxFnApplicationITests {
 	}
 
 	private Consumer<Map<String, Object>> userCredentials() {
-		return basicAuthenticationCredentials("user","user");
+		return basicAuthenticationCredentials("user", "user");
 	}
 
 	private Consumer<Map<String, Object>> invalidCredentials() {
-		return basicAuthenticationCredentials("user","INVALID");
+		return basicAuthenticationCredentials("user", "INVALID");
 	}
 }

+ 2 - 2
samples/javaconfig/hellowebfluxfn/src/test/java/sample/HelloWebfluxFnApplicationTests.java

@@ -115,10 +115,10 @@ public class HelloWebfluxFnApplicationTests {
 	}
 
 	private Consumer<Map<String, Object>> userCredentials() {
-		return basicAuthenticationCredentials("user","user");
+		return basicAuthenticationCredentials("user", "user");
 	}
 
 	private Consumer<Map<String, Object>> invalidCredentials() {
-		return basicAuthenticationCredentials("user","INVALID");
+		return basicAuthenticationCredentials("user", "INVALID");
 	}
 }

+ 2 - 2
samples/javaconfig/preauth/src/main/java/org/springframework/security/samples/config/SecurityConfig.java

@@ -27,11 +27,11 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
 	protected void configure(HttpSecurity http) throws Exception {
 		http
 			.authorizeRequests()
-				.antMatchers("/login","/resources/**").permitAll()
+				.antMatchers("/login", "/resources/**").permitAll()
 				.anyRequest().authenticated()
 				.and()
 			.jee()
-				.mappableRoles("USER","ADMIN");
+				.mappableRoles("USER", "ADMIN");
 	}
 	// @formatter:on
 }

+ 1 - 1
samples/javaconfig/x509/src/main/java/org/springframework/security/samples/config/SecurityConfig.java

@@ -31,7 +31,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
 		auth.
 			inMemoryAuthentication()
 				.withUser("dianne").password("password").roles("USER").and()
-				.withUser("rod").password("password").roles("USER","ADMIN").and()
+				.withUser("rod").password("password").roles("USER", "ADMIN").and()
 				.withUser("scott").password("password").roles("USER");
 	}
 	// @formatter:on

+ 1 - 1
samples/xml/contacts/src/main/java/sample/contact/ClientApplication.java

@@ -58,7 +58,7 @@ public class ClientApplication {
 
 		SecurityContextHolder.getContext().setAuthentication(authentication);
 
-		for (Map.Entry<String,ContactManager> entry : contactServices.entrySet()) {
+		for (Map.Entry<String, ContactManager> entry : contactServices.entrySet()) {
 			String beanName = entry.getKey();
 			ContactManager remoteContactManager = entry.getValue();
 			Object object = this.beanFactory.getBean("&" + beanName);

+ 2 - 2
taglibs/src/test/java/org/springframework/security/taglibs/authz/AbstractAuthorizeTagTests.java

@@ -98,11 +98,11 @@ public class AbstractAuthorizeTagTests {
 	@Test
 	@SuppressWarnings("rawtypes")
 	public void expressionFromChildContext() throws IOException {
-		SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken("user", "pass","USER"));
+		SecurityContextHolder.getContext().setAuthentication(new TestingAuthenticationToken("user", "pass", "USER"));
 		DefaultWebSecurityExpressionHandler expected = new DefaultWebSecurityExpressionHandler();
 		tag.setAccess("permitAll");
 		WebApplicationContext wac = mock(WebApplicationContext.class);
-		when(wac.getBeansOfType(SecurityExpressionHandler.class)).thenReturn(Collections.<String,SecurityExpressionHandler>singletonMap("wipe", expected));
+		when(wac.getBeansOfType(SecurityExpressionHandler.class)).thenReturn(Collections.<String, SecurityExpressionHandler>singletonMap("wipe", expected));
 		servletContext.setAttribute("org.springframework.web.servlet.FrameworkServlet.CONTEXT.dispatcher", wac);
 
 		assertThat(tag.authorize()).isTrue();

+ 5 - 5
test/src/test/java/org/springframework/security/test/web/servlet/request/Sec2935Tests.java

@@ -66,7 +66,7 @@ public class Sec2935Tests {
 	@Test
 	public void postProcessorUserNoUser() throws Exception {
 		mvc
-			.perform(get("/admin/abc").with(user("user").roles("ADMIN","USER")))
+			.perform(get("/admin/abc").with(user("user").roles("ADMIN", "USER")))
 			.andExpect(status().isNotFound())
 			.andExpect(authenticated().withUsername("user"));
 
@@ -79,7 +79,7 @@ public class Sec2935Tests {
 	@Test
 	public void postProcessorUserOtherUser() throws Exception {
 		mvc
-			.perform(get("/admin/abc").with(user("user1").roles("ADMIN","USER")))
+			.perform(get("/admin/abc").with(user("user1").roles("ADMIN", "USER")))
 			.andExpect(status().isNotFound())
 			.andExpect(authenticated().withUsername("user1"));
 
@@ -93,7 +93,7 @@ public class Sec2935Tests {
 	@Test
 	public void postProcessorUserWithMockUser() throws Exception {
 		mvc
-			.perform(get("/admin/abc").with(user("user1").roles("ADMIN","USER")))
+			.perform(get("/admin/abc").with(user("user1").roles("ADMIN", "USER")))
 			.andExpect(status().isNotFound())
 			.andExpect(authenticated().withUsername("user1"));
 
@@ -112,7 +112,7 @@ public class Sec2935Tests {
 				.build();
 
 		mvc
-			.perform(get("/admin/abc").with(user("user1").roles("ADMIN","USER")))
+			.perform(get("/admin/abc").with(user("user1").roles("ADMIN", "USER")))
 			.andExpect(status().isNotFound())
 			.andExpect(authenticated().withUsername("user1"));
 
@@ -132,7 +132,7 @@ public class Sec2935Tests {
 				.build();
 
 		mvc
-			.perform(get("/admin/abc").with(user("user1").roles("ADMIN","USER")))
+			.perform(get("/admin/abc").with(user("user1").roles("ADMIN", "USER")))
 			.andExpect(status().isNotFound())
 			.andExpect(authenticated().withUsername("user1"));
 

+ 1 - 1
test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestPostProcessorsCsrfTests.java

@@ -159,7 +159,7 @@ public class SecurityMockMvcRequestPostProcessorsCsrfTests {
 
 		MockHttpServletRequestBuilder requestWithCsrf = post("/")
 			.param(token.getParameterName(), token.getToken())
-			.session((MockHttpSession)request.getSession());
+			.session((MockHttpSession) request.getSession());
 		this.mockMvc.perform(requestWithCsrf)
 			.andExpect(status().isOk());
 		// @formatter:on

+ 1 - 1
test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithAdminRob.java

@@ -28,6 +28,6 @@ import org.springframework.security.test.context.support.WithMockUser;
 @Retention(RetentionPolicy.RUNTIME)
 @Inherited
 @Documented
-@WithMockUser(value="rob",roles="ADMIN")
+@WithMockUser(value="rob", roles="ADMIN")
 public @interface WithAdminRob {
 }

+ 2 - 2
test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsAuthenticationTests.java

@@ -103,8 +103,8 @@ public class WithUserDetailsAuthenticationTests {
 			auth
 				.inMemoryAuthentication()
 					.withUser("user").password("password").roles("USER").and()
-					.withUser("admin").password("password").roles("USER","ADMIN");
+					.withUser("admin").password("password").roles("USER", "ADMIN");
 		}
 		// @formatter:on
 	}
-}
+}

+ 2 - 2
test/src/test/java/org/springframework/security/test/web/servlet/showcase/secured/WithUserDetailsClassLevelAuthenticationTests.java

@@ -103,8 +103,8 @@ public class WithUserDetailsClassLevelAuthenticationTests {
 			auth
 				.inMemoryAuthentication()
 					.withUser("user").password("password").roles("USER").and()
-					.withUser("admin").password("password").roles("USER","ADMIN");
+					.withUser("admin").password("password").roles("USER", "ADMIN");
 		}
 		// @formatter:on
 	}
-}
+}

+ 2 - 2
web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLoginPageGeneratingFilter.java

@@ -62,7 +62,7 @@ public class DefaultLoginPageGeneratingFilter extends GenericFilterBean {
 	private String openIDusernameParameter;
 	private String openIDrememberMeParameter;
 	private Map<String, String> oauth2AuthenticationUrlToClientName;
-	private Function<HttpServletRequest,Map<String,String>> resolveHiddenInputs = request -> Collections
+	private Function<HttpServletRequest, Map<String, String>> resolveHiddenInputs = request -> Collections
 		.emptyMap();
 
 
@@ -298,7 +298,7 @@ public class DefaultLoginPageGeneratingFilter extends GenericFilterBean {
 	}
 
 	private void renderHiddenInputs(StringBuilder sb, HttpServletRequest request) {
-		for(Map.Entry<String,String> input : this.resolveHiddenInputs.apply(request).entrySet()) {
+		for(Map.Entry<String, String> input : this.resolveHiddenInputs.apply(request).entrySet()) {
 			sb.append("	<input name=\"" + input.getKey()
 					+ "\" type=\"hidden\" value=\"" + input.getValue() + "\" />\n");
 		}

+ 1 - 1
web/src/main/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverter.java

@@ -32,7 +32,7 @@ import org.springframework.web.server.ServerWebExchange;
  * @author Rob Winch
  * @since 5.0
  */
-public class ServerFormLoginAuthenticationConverter implements Function<ServerWebExchange,Mono<Authentication>> {
+public class ServerFormLoginAuthenticationConverter implements Function<ServerWebExchange, Mono<Authentication>> {
 
 	private String usernameParameter = "username";
 

+ 1 - 1
web/src/main/java/org/springframework/security/web/server/ServerHttpBasicAuthenticationConverter.java

@@ -31,7 +31,7 @@ import reactor.core.publisher.Mono;
  * @author Rob Winch
  * @since 5.0
  */
-public class ServerHttpBasicAuthenticationConverter implements Function<ServerWebExchange,Mono<Authentication>> {
+public class ServerHttpBasicAuthenticationConverter implements Function<ServerWebExchange, Mono<Authentication>> {
 
 	public static final String BASIC = "Basic ";
 

+ 2 - 2
web/src/main/java/org/springframework/security/web/server/authentication/AuthenticationWebFilter.java

@@ -46,7 +46,7 @@ public class AuthenticationWebFilter implements WebFilter {
 
 	private ServerAuthenticationSuccessHandler authenticationSuccessHandler = new WebFilterChainServerAuthenticationSuccessHandler();
 
-	private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter = new ServerHttpBasicAuthenticationConverter();
+	private Function<ServerWebExchange, Mono<Authentication>> authenticationConverter = new ServerHttpBasicAuthenticationConverter();
 
 	private ServerAuthenticationFailureHandler authenticationFailureHandler = new ServerAuthenticationEntryPointFailureHandler(new HttpBasicServerAuthenticationEntryPoint());
 
@@ -97,7 +97,7 @@ public class AuthenticationWebFilter implements WebFilter {
 		this.authenticationSuccessHandler = authenticationSuccessHandler;
 	}
 
-	public void setAuthenticationConverter(Function<ServerWebExchange,Mono<Authentication>> authenticationConverter) {
+	public void setAuthenticationConverter(Function<ServerWebExchange, Mono<Authentication>> authenticationConverter) {
 		this.authenticationConverter = authenticationConverter;
 	}
 

+ 1 - 1
web/src/main/java/org/springframework/security/web/server/authentication/logout/LogoutWebFilter.java

@@ -57,7 +57,7 @@ public class LogoutWebFilter implements WebFilter {
 			.map(result -> exchange)
 			.flatMap(this::flatMapAuthentication)
 			.flatMap( authentication -> {
-				WebFilterExchange webFilterExchange = new WebFilterExchange(exchange,chain);
+				WebFilterExchange webFilterExchange = new WebFilterExchange(exchange, chain);
 				return logout(webFilterExchange, authentication);
 			});
 	}

+ 3 - 3
web/src/main/java/org/springframework/security/web/server/authorization/AuthorizationContext.java

@@ -27,13 +27,13 @@ import java.util.Map;
  */
 public class AuthorizationContext {
 	private final ServerWebExchange exchange;
-	private final Map<String,Object> variables;
+	private final Map<String, Object> variables;
 
 	public AuthorizationContext(ServerWebExchange exchange) {
 		this(exchange, Collections.emptyMap());
 	}
 
-	public AuthorizationContext(ServerWebExchange exchange, Map<String,Object> variables) {
+	public AuthorizationContext(ServerWebExchange exchange, Map<String, Object> variables) {
 		this.exchange = exchange;
 		this.variables = variables;
 	}
@@ -42,7 +42,7 @@ public class AuthorizationContext {
 		return exchange;
 	}
 
-	public Map<String,Object> getVariables() {
+	public Map<String, Object> getVariables() {
 		return Collections.unmodifiableMap(variables);
 	}
 }

+ 4 - 4
web/src/main/java/org/springframework/security/web/server/csrf/WebSessionServerCsrfTokenRepository.java

@@ -64,14 +64,14 @@ public class WebSessionServerCsrfTokenRepository
 			.flatMap( attrs -> save(attrs, token));
 	}
 
-	private Mono<CsrfToken> save(Map<String,Object> attributes, CsrfToken token) {
+	private Mono<CsrfToken> save(Map<String, Object> attributes, CsrfToken token) {
 		return Mono.defer(() -> {
 			putToken(attributes, token);
 			return Mono.justOrEmpty(token);
 		});
 	}
 
-	private void putToken(Map<String,Object> attributes, CsrfToken token) {
+	private void putToken(Map<String, Object> attributes, CsrfToken token) {
 		if(token == null) {
 			attributes.remove(this.sessionAttributeName);
 		} else {
@@ -118,7 +118,7 @@ public class WebSessionServerCsrfTokenRepository
 	}
 
 
-	private CsrfToken createCsrfToken(Map<String,Object> attributes) {
+	private CsrfToken createCsrfToken(Map<String, Object> attributes) {
 		return new LazyCsrfToken(attributes, createCsrfToken());
 	}
 
@@ -131,7 +131,7 @@ public class WebSessionServerCsrfTokenRepository
 	}
 
 	private class LazyCsrfToken implements CsrfToken {
-		private final Map<String,Object> attributes;
+		private final Map<String, Object> attributes;
 		private final CsrfToken delegate;
 
 		private LazyCsrfToken(Map<String, Object> attributes, CsrfToken delegate) {

+ 2 - 2
web/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java

@@ -68,8 +68,8 @@ public final class PathPatternParserServerWebExchangeMatcher implements ServerWe
 		if(!match) {
 			return MatchResult.notMatch();
 		}
-		Map<String,String> pathVariables = this.pattern.matchAndExtract(path).getUriVariables();
-		Map<String,Object> variables = new HashMap<>(pathVariables);
+		Map<String, String> pathVariables = this.pattern.matchAndExtract(path).getUriVariables();
+		Map<String, Object> variables = new HashMap<>(pathVariables);
 		return MatchResult.match(variables);
 	}
 

+ 3 - 3
web/src/main/java/org/springframework/security/web/server/util/matcher/ServerWebExchangeMatcher.java

@@ -32,7 +32,7 @@ public interface ServerWebExchangeMatcher {
 
 	class MatchResult {
 		private final boolean match;
-		private final Map<String,Object> variables;
+		private final Map<String, Object> variables;
 
 		private MatchResult(boolean match, Map<String, Object> variables) {
 			this.match = match;
@@ -43,7 +43,7 @@ public interface ServerWebExchangeMatcher {
 			return match;
 		}
 
-		public Map<String,Object> getVariables() {
+		public Map<String, Object> getVariables() {
 			return variables;
 		}
 
@@ -51,7 +51,7 @@ public interface ServerWebExchangeMatcher {
 			return match(Collections.emptyMap());
 		}
 
-		public static Mono<MatchResult> match(Map<String,Object> variables) {
+		public static Mono<MatchResult> match(Map<String, Object> variables) {
 			return Mono.just(new MatchResult(true, variables));
 		}
 

+ 1 - 1
web/src/test/java/org/springframework/security/web/authentication/www/DigestAuthUtilsTests.java

@@ -90,7 +90,7 @@ public class DigestAuthUtilsTests {
 	public void testSplitNormalOperation() {
 		String unsplit = "username=\"rod==\"";
 		assertThat(DigestAuthUtils.split(unsplit, "=")[0]).isEqualTo("username");
-		assertThat(DigestAuthUtils.split(unsplit, "=")[1]).isEqualTo("\"rod==\"");// should
+		assertThat(DigestAuthUtils.split(unsplit, "=")[1]).isEqualTo("\"rod==\""); // should
 																					// not
 																					// remove
 																					// quotes

+ 1 - 1
web/src/test/java/org/springframework/security/web/jackson2/SavedCookieMixinTests.java

@@ -84,7 +84,7 @@ public class SavedCookieMixinTests extends AbstractMixinTests {
 	@Test
 	@SuppressWarnings("unchecked")
 	public void deserializeSavedCookieWithList() throws IOException, JSONException {
-		List<SavedCookie> savedCookies = (List<SavedCookie>)mapper.readValue(COOKIES_JSON, Object.class);
+		List<SavedCookie> savedCookies = (List<SavedCookie>) mapper.readValue(COOKIES_JSON, Object.class);
 		assertThat(savedCookies).isNotNull().hasSize(1);
 		assertThat(savedCookies.get(0).getName()).isEqualTo("SESSION");
 		assertThat(savedCookies.get(0).getValue()).isEqualTo("123456789");

+ 1 - 1
web/src/test/java/org/springframework/security/web/server/ServerFormLoginAuthenticationConverterTests.java

@@ -39,7 +39,7 @@ public class ServerFormLoginAuthenticationConverterTests {
 	@Mock
 	private ServerWebExchange exchange;
 
-	private MultiValueMap<String,String> data = new LinkedMultiValueMap<>();
+	private MultiValueMap<String, String> data = new LinkedMultiValueMap<>();
 
 	private ServerFormLoginAuthenticationConverter converter = new ServerFormLoginAuthenticationConverter();
 

+ 5 - 5
web/src/test/java/org/springframework/security/web/server/authentication/AuthenticationWebFilterTests.java

@@ -56,7 +56,7 @@ public class AuthenticationWebFilterTests {
 	@Mock
 	private ServerAuthenticationSuccessHandler successHandler;
 	@Mock
-	private Function<ServerWebExchange,Mono<Authentication>> authenticationConverter;
+	private Function<ServerWebExchange, Mono<Authentication>> authenticationConverter;
 	@Mock
 	private ReactiveAuthenticationManager authenticationManager;
 	@Mock
@@ -96,7 +96,7 @@ public class AuthenticationWebFilterTests {
 
 	@Test
 	public void filterWhenDefaultsAndAuthenticationSuccessThenContinues() {
-		when(this.authenticationManager.authenticate(any())).thenReturn(Mono.just(new TestingAuthenticationToken("test","this", "ROLE")));
+		when(this.authenticationManager.authenticate(any())).thenReturn(Mono.just(new TestingAuthenticationToken("test", "this", "ROLE")));
 		this.filter = new AuthenticationWebFilter(this.authenticationManager);
 
 		WebTestClient client = WebTestClientBuilder
@@ -185,7 +185,7 @@ public class AuthenticationWebFilterTests {
 		when(this.authenticationConverter.apply(any())).thenReturn(authentication);
 		when(this.authenticationManager.authenticate(any())).thenReturn(authentication);
 		when(this.successHandler.onAuthenticationSuccess(any(), any())).thenReturn(Mono.empty());
-		when(this.securityContextRepository.save(any(),any())).thenAnswer( a -> Mono.just(a.getArguments()[0]));
+		when(this.securityContextRepository.save(any(), any())).thenAnswer( a -> Mono.just(a.getArguments()[0]));
 
 		WebTestClient client = WebTestClientBuilder
 			.bindToWebFilters(this.filter)
@@ -231,7 +231,7 @@ public class AuthenticationWebFilterTests {
 		Mono<Authentication> authentication = Mono.just(new TestingAuthenticationToken("test", "this", "ROLE_USER"));
 		when(this.authenticationConverter.apply(any())).thenReturn(authentication);
 		when(this.authenticationManager.authenticate(any())).thenReturn(Mono.error(new BadCredentialsException("Failed")));
-		when(this.failureHandler.onAuthenticationFailure(any(),any())).thenReturn(Mono.empty());
+		when(this.failureHandler.onAuthenticationFailure(any(), any())).thenReturn(Mono.empty());
 
 		WebTestClient client = WebTestClientBuilder
 			.bindToWebFilters(this.filter)
@@ -244,7 +244,7 @@ public class AuthenticationWebFilterTests {
 			.expectStatus().isOk()
 			.expectBody().isEmpty();
 
-		verify(this.failureHandler).onAuthenticationFailure(any(),any());
+		verify(this.failureHandler).onAuthenticationFailure(any(), any());
 		verify(this.securityContextRepository, never()).save(any(), any());
 		verifyZeroInteractions(this.successHandler);
 	}

+ 7 - 7
web/src/test/java/org/springframework/security/web/server/authorization/AuthorizationWebFilterTests.java

@@ -50,7 +50,7 @@ public class AuthorizationWebFilterTests {
 	@Test
 	public void filterWhenNoSecurityContextThenThrowsAccessDenied() {
 		when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
-		AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
+		AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
 
 		Mono<Void> result = filter.filter(this.exchange, this.chain);
 
@@ -63,7 +63,7 @@ public class AuthorizationWebFilterTests {
 	@Test
 	public void filterWhenNoAuthenticationThenThrowsAccessDenied() {
 		when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
-		AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
+		AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
 
 		Mono<Void> result = filter
 			.filter(this.exchange, this.chain)
@@ -78,11 +78,11 @@ public class AuthorizationWebFilterTests {
 	@Test
 	public void filterWhenAuthenticationThenThrowsAccessDenied() {
 		when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
-		AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
+		AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
 
 		Mono<Void> result = filter
 			.filter(this.exchange, this.chain)
-			.subscriberContext(ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("a","b", "R")));
+			.subscriberContext(ReactiveSecurityContextHolder.withAuthentication(new TestingAuthenticationToken("a", "b", "R")));
 
 		StepVerifier.create(result)
 			.expectError(AccessDeniedException.class)
@@ -94,7 +94,7 @@ public class AuthorizationWebFilterTests {
 	public void filterWhenDoesNotAccessAuthenticationThenSecurityContextNotSubscribed() {
 		PublisherProbe<SecurityContext> context = PublisherProbe.empty();
 		when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
-		AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.error(new AccessDeniedException("Denied")));
+		AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.error(new AccessDeniedException("Denied")));
 
 		Mono<Void> result = filter
 			.filter(this.exchange, this.chain)
@@ -111,7 +111,7 @@ public class AuthorizationWebFilterTests {
 	public void filterWhenGrantedAndDoesNotAccessAuthenticationThenChainSubscribedAndSecurityContextNotSubscribed() {
 		PublisherProbe<SecurityContext> context = PublisherProbe.empty();
 		when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
-		AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> Mono.just(new AuthorizationDecision(true)));
+		AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> Mono.just(new AuthorizationDecision(true)));
 
 		Mono<Void> result = filter
 			.filter(this.exchange, this.chain)
@@ -127,7 +127,7 @@ public class AuthorizationWebFilterTests {
 	public void filterWhenGrantedAndDoeAccessAuthenticationThenChainSubscribedAndSecurityContextSubscribed() {
 		PublisherProbe<SecurityContext> context = PublisherProbe.empty();
 		when(this.chain.filter(this.exchange)).thenReturn(this.chainResult.mono());
-		AuthorizationWebFilter filter = new AuthorizationWebFilter((a,e) -> a
+		AuthorizationWebFilter filter = new AuthorizationWebFilter((a, e) -> a
 			.map( auth -> new AuthorizationDecision(true))
 			.defaultIfEmpty(new AuthorizationDecision(true))
 		);

+ 2 - 2
web/src/test/java/org/springframework/security/web/server/context/ReactorContextWebFilterTests.java

@@ -74,7 +74,7 @@ public class ReactorContextWebFilterTests {
 
 	@Test
 	public void filterWhenGetPrincipalMonoThenNoInteractions() {
-		this.handler = WebTestHandler.bindToWebFilters(this.filter, (e,c) -> {
+		this.handler = WebTestHandler.bindToWebFilters(this.filter, (e, c) -> {
 			ReactiveSecurityContextHolder.getContext();
 			return c.filter(e);
 		});
@@ -88,7 +88,7 @@ public class ReactorContextWebFilterTests {
 	public void filterWhenPrincipalAndGetPrincipalThenInteractAndUseOriginalPrincipal() {
 		SecurityContextImpl context = new SecurityContextImpl(this.principal);
 		when(this.repository.load(any())).thenReturn(Mono.just(context));
-		this.handler = WebTestHandler.bindToWebFilters(this.filter, (e,c) ->
+		this.handler = WebTestHandler.bindToWebFilters(this.filter, (e, c) ->
 			ReactiveSecurityContextHolder.getContext()
 				.map(SecurityContext::getAuthentication)
 				.doOnSuccess( p -> assertThat(p).isSameAs(this.principal))

+ 2 - 2
web/src/test/java/org/springframework/security/web/server/context/SecurityContextServerWebExchangeWebFilterTests.java

@@ -36,7 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 public class SecurityContextServerWebExchangeWebFilterTests {
 	SecurityContextServerWebExchangeWebFilter filter = new SecurityContextServerWebExchangeWebFilter();
 
-	Authentication principal = new TestingAuthenticationToken("user","password", "ROLE_USER");
+	Authentication principal = new TestingAuthenticationToken("user", "password", "ROLE_USER");
 
 	ServerWebExchange exchange = MockServerWebExchange.from(MockServerHttpRequest.get("/").build());
 
@@ -73,7 +73,7 @@ public class SecurityContextServerWebExchangeWebFilterTests {
 
 	@Test
 	public void filterWhenPrincipalNullThenContextEmpty() {
-		Authentication defaultAuthentication = new TestingAuthenticationToken("anonymouse","anonymous", "TEST");
+		Authentication defaultAuthentication = new TestingAuthenticationToken("anonymouse", "anonymous", "TEST");
 		Mono<Void> result = this.filter.filter(this.exchange, new DefaultWebFilterChain( e ->
 				e.getPrincipal()
 					.defaultIfEmpty(defaultAuthentication)

+ 7 - 7
web/src/test/java/org/springframework/security/web/util/OnCommittedResponseWrapperTests.java

@@ -94,9 +94,9 @@ public class OnCommittedResponseWrapperTests {
 		int off = 2;
 		int len = 3;
 
-		response.getWriter().write(buff,off,len);
+		response.getWriter().write(buff, off, len);
 
-		verify(writer).write(buff,off,len);
+		verify(writer).write(buff, off, len);
 	}
 
 	@Test
@@ -114,9 +114,9 @@ public class OnCommittedResponseWrapperTests {
 		int off = 2;
 		int len = 3;
 
-		response.getWriter().write(s,off,len);
+		response.getWriter().write(s, off, len);
 
-		verify(writer).write(s,off,len);
+		verify(writer).write(s, off, len);
 	}
 
 	@Test
@@ -602,7 +602,7 @@ public class OnCommittedResponseWrapperTests {
 		int len = 3;
 		response.setContentLength(3);
 
-		response.getWriter().write(buff,off,len);
+		response.getWriter().write(buff, off, len);
 
 		assertThat(committed).isTrue();
 	}
@@ -624,7 +624,7 @@ public class OnCommittedResponseWrapperTests {
 		int len = 3;
 		response.setContentLength(3);
 
-		response.getWriter().write(s,off,len);
+		response.getWriter().write(s, off, len);
 
 		assertThat(committed).isTrue();
 	}
@@ -1104,7 +1104,7 @@ public class OnCommittedResponseWrapperTests {
 	@Test
 	public void addHeaderContentLengthPrintWriterWriteStringCommits() throws Exception {
 		int expected = 1234;
-		response.addHeader("Content-Length",String.valueOf(String.valueOf(expected).length()));
+		response.addHeader("Content-Length", String.valueOf(String.valueOf(expected).length()));
 
 		response.getWriter().write(expected);