diff --git a/config/src/main/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurer.java index fde27dad55..18a5e02962 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/authentication/configurers/ldap/LdapAuthenticationProviderConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -158,7 +158,7 @@ public class LdapAuthenticationProviderConfigurer classNames = new ArrayList<>(4); - if(isProxy) { + if (isProxy) { classNames.add(MethodSecurityMetadataSourceAdvisorRegistrar.class.getName()); } diff --git a/config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityMetadataSourceAdvisorRegistrar.java b/config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityMetadataSourceAdvisorRegistrar.java index cb74b2914a..bfdade3442 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityMetadataSourceAdvisorRegistrar.java +++ b/config/src/main/java/org/springframework/security/config/annotation/method/configuration/MethodSecurityMetadataSourceAdvisorRegistrar.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 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. @@ -52,7 +52,7 @@ class MethodSecurityMetadataSourceAdvisorRegistrar implements MultiValueMap attributes = importingClassMetadata.getAllAnnotationAttributes(EnableGlobalMethodSecurity.class.getName()); Integer order = (Integer) attributes.getFirst("order"); - if(order != null) { + if (order != null) { advisor.addPropertyValue("order", order); } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java b/config/src/main/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java index 0eab54d761..f9d9c5efe0 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/AbstractRequestMatcherRegistry.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2018 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. @@ -163,7 +163,7 @@ public abstract class AbstractRequestMatcherRegistry { String... mvcPatterns) { boolean isServlet30 = ClassUtils.isPresent("javax.servlet.ServletRegistration", getClass().getClassLoader()); ObjectPostProcessor opp = this.context.getBean(ObjectPostProcessor.class); - if(!this.context.containsBean(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)) { + if (!this.context.containsBean(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)) { throw new NoSuchBeanDefinitionException("A Bean named " + HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME +" of type " + HandlerMappingIntrospector.class.getName() + " is required to use MvcRequestMatcher. Please ensure Spring Security & Spring MVC are configured in a shared ApplicationContext."); } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java index 0377e53a32..f651a4c4e0 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configuration/WebSecurityConfigurerAdapter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -223,7 +223,7 @@ public abstract class WebSecurityConfigurerAdapter implements List defaultHttpConfigurers = SpringFactoriesLoader.loadFactories(AbstractHttpConfigurer.class, classLoader); - for(AbstractHttpConfigurer configurer : defaultHttpConfigurers) { + for (AbstractHttpConfigurer configurer : defaultHttpConfigurers) { http.apply(configurer); } } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/CorsConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/CorsConfigurer.java index cc2273ba12..56229848f4 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/CorsConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/CorsConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -109,7 +109,7 @@ public class CorsConfigurer> * @return */ private static CorsFilter getMvcCorsFilter(ApplicationContext context) { - if(!context.containsBean(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)) { + if (!context.containsBean(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME)) { throw new NoSuchBeanDefinitionException(HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME, "A Bean named " + HANDLER_MAPPING_INTROSPECTOR_BEAN_NAME +" of type " + HandlerMappingIntrospector.class.getName() + " is required to use MvcRequestMatcher. Please ensure Spring Security & Spring MVC are configured in a shared ApplicationContext."); } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java index 7f763ac293..ab37f0c283 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ExpressionUrlAuthorizationConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2018 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. @@ -213,18 +213,18 @@ public final class ExpressionUrlAuthorizationConfigurer> extends .setAuthenticationDetailsSource(this.authenticationDetailsSource); } RememberMeServices rememberMeServices = http.getSharedObject(RememberMeServices.class); - if(rememberMeServices != null) { + if (rememberMeServices != null) { basicAuthenticationFilter.setRememberMeServices(rememberMeServices); } basicAuthenticationFilter = postProcess(basicAuthenticationFilter); diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurer.java index 01bf207047..f51acdf085 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/LogoutConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2018 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. @@ -261,7 +261,7 @@ public final class LogoutConfigurer> extends private LogoutSuccessHandler createDefaultSuccessHandler() { SimpleUrlLogoutSuccessHandler urlLogoutHandler = new SimpleUrlLogoutSuccessHandler(); urlLogoutHandler.setDefaultTargetUrl(logoutSuccessUrl); - if(defaultLogoutSuccessHandlerMappings.isEmpty()) { + if (defaultLogoutSuccessHandlerMappings.isEmpty()) { return urlLogoutHandler; } DelegatingLogoutSuccessHandler successHandler = new DelegatingLogoutSuccessHandler(defaultLogoutSuccessHandlerMappings); diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SecurityContextConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SecurityContextConfigurer.java index 85399d7af8..0808a98548 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SecurityContextConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SecurityContextConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2018 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. @@ -86,7 +86,7 @@ public final class SecurityContextConfigurer> e SecurityContextRepository securityContextRepository = http .getSharedObject(SecurityContextRepository.class); - if(securityContextRepository == null) { + if (securityContextRepository == null) { securityContextRepository = new HttpSessionSecurityContextRepository(); } SecurityContextPersistenceFilter securityContextFilter = new SecurityContextPersistenceFilter( @@ -101,4 +101,4 @@ public final class SecurityContextConfigurer> e securityContextFilter = postProcess(securityContextFilter); http.addFilter(securityContextFilter); } -} \ No newline at end of file +} diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurer.java index 0fdc1b6267..87d363149a 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/ServletApiConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2018 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. @@ -94,9 +94,9 @@ public final class ServletApiConfigurer> extend securityContextRequestFilter.setTrustResolver(trustResolver); } ApplicationContext context = http.getSharedObject(ApplicationContext.class); - if(context != null) { + if (context != null) { String[] grantedAuthorityDefaultsBeanNames = context.getBeanNamesForType(GrantedAuthorityDefaults.class); - if(grantedAuthorityDefaultsBeanNames.length == 1) { + if (grantedAuthorityDefaultsBeanNames.length == 1) { GrantedAuthorityDefaults grantedAuthorityDefaults = context.getBean(grantedAuthorityDefaultsBeanNames[0], GrantedAuthorityDefaults.class); securityContextRequestFilter.setRolePrefix(grantedAuthorityDefaults.getRolePrefix()); } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java index 43ea86d7f0..3c5b7cc84c 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/configurers/SessionManagementConfigurer.java @@ -479,7 +479,7 @@ public final class SessionManagementConfigurer> private ConcurrentSessionFilter createConccurencyFilter(H http) { SessionInformationExpiredStrategy expireStrategy = getExpiredSessionStrategy(); SessionRegistry sessionRegistry = getSessionRegistry(http); - if(expireStrategy == null) { + if (expireStrategy == null) { return new ConcurrentSessionFilter(sessionRegistry); } diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/reactive/ServerHttpSecurityConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/web/reactive/ServerHttpSecurityConfiguration.java index d5c63002a8..a5bbc6db5a 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/reactive/ServerHttpSecurityConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/reactive/ServerHttpSecurityConfiguration.java @@ -72,7 +72,7 @@ class ServerHttpSecurityConfiguration implements WebFluxConfigurer { public AuthenticationPrincipalArgumentResolver authenticationPrincipalArgumentResolver() { AuthenticationPrincipalArgumentResolver resolver = new AuthenticationPrincipalArgumentResolver( this.adapterRegistry); - if(this.beanFactory != null) { + if (this.beanFactory != null) { resolver.setBeanResolver(new BeanFactoryResolver(this.beanFactory)); } return resolver; @@ -89,13 +89,13 @@ class ServerHttpSecurityConfiguration implements WebFluxConfigurer { } private ReactiveAuthenticationManager authenticationManager() { - if(this.authenticationManager != null) { + if (this.authenticationManager != null) { return this.authenticationManager; } - if(this.reactiveUserDetailsService != null) { + if (this.reactiveUserDetailsService != null) { UserDetailsRepositoryReactiveAuthenticationManager manager = new UserDetailsRepositoryReactiveAuthenticationManager(this.reactiveUserDetailsService); - if(this.passwordEncoder != null) { + if (this.passwordEncoder != null) { manager.setPasswordEncoder(this.passwordEncoder); } manager.setUserDetailsPasswordService(this.userDetailsPasswordService); diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.java b/config/src/main/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.java index 30b2b44b7f..19b37dc7e7 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/reactive/WebFluxSecurityConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -68,7 +68,7 @@ class WebFluxSecurityConfiguration { private List getSecurityWebFilterChains() { List result = this.securityWebFilterChains; - if(ObjectUtils.isEmpty(result)) { + if (ObjectUtils.isEmpty(result)) { return Arrays.asList(springSecurityFilterChain()); } return result; diff --git a/config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java b/config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java index a5804499e9..6b49e14398 100644 --- a/config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java +++ b/config/src/main/java/org/springframework/security/config/annotation/web/socket/AbstractSecurityWebSocketMessageBrokerConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -216,7 +216,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends @Autowired(required = false) public void setMessageExpressionHandler(List>> expressionHandlers) { - if(expressionHandlers.size() == 1) { + if (expressionHandlers.size() == 1) { this.expressionHandler = expressionHandlers.get(0); } } @@ -227,7 +227,7 @@ public abstract class AbstractSecurityWebSocketMessageBrokerConfigurer extends } private SecurityExpressionHandler> getMessageExpressionHandler() { - if(expressionHandler == null) { + if (expressionHandler == null) { return defaultExpressionHandler; } return expressionHandler; diff --git a/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java b/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java index cfc14fcca8..0a1e119cbb 100644 --- a/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java +++ b/config/src/main/java/org/springframework/security/config/authentication/AuthenticationManagerFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -55,7 +55,7 @@ public class AuthenticationManagerFactoryBean implements } UserDetailsService uds = getBeanOrNull(UserDetailsService.class); - if(uds == null) { + if (uds == null) { throw new NoSuchBeanDefinitionException(BeanIds.AUTHENTICATION_MANAGER, MISSING_BEAN_ERROR_MESSAGE); } diff --git a/config/src/main/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBean.java b/config/src/main/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBean.java index 333481f531..2ddfc0f17c 100644 --- a/config/src/main/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBean.java +++ b/config/src/main/java/org/springframework/security/config/core/userdetails/UserDetailsResourceFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -96,7 +96,7 @@ public class UserDetailsResourceFactoryBean implements ResourceLoaderAware, Fact private Resource getPropertiesResource() { Resource result = resource; - if(result == null && resourceLocation != null) { + if (result == null && resourceLocation != null) { result = resourceLoader.getResource(resourceLocation); } Assert.notNull(result, "resource cannot be null if resourceLocation is null"); diff --git a/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java b/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java index 3ad241ccb3..b3971d5c4d 100644 --- a/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java +++ b/config/src/main/java/org/springframework/security/config/http/AuthenticationConfigBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 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. @@ -849,7 +849,7 @@ final class AuthenticationConfigBuilder { @Override public Map apply(HttpServletRequest request) { CsrfToken token = (CsrfToken) request.getAttribute(CsrfToken.class.getName()); - if(token == null) { + if (token == null) { return Collections.emptyMap(); } return Collections.singletonMap(token.getParameterName(), token.getToken()); diff --git a/config/src/main/java/org/springframework/security/config/http/CorsBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/http/CorsBeanDefinitionParser.java index e56febef9a..9c9bc19299 100644 --- a/config/src/main/java/org/springframework/security/config/http/CorsBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/http/CorsBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -39,17 +39,17 @@ public class CorsBeanDefinitionParser { private static final String ATT_REF = "ref"; public BeanMetadataElement parse(Element element, ParserContext parserContext) { - if(element == null) { + if (element == null) { return null; } String filterRef = element.getAttribute(ATT_REF); - if(StringUtils.hasText(filterRef)) { + if (StringUtils.hasText(filterRef)) { return new RuntimeBeanReference(filterRef); } BeanMetadataElement configurationSource = getSource(element, parserContext); - if(configurationSource == null) { + if (configurationSource == null) { throw new BeanCreationException("Could not create CorsFilter"); } @@ -66,7 +66,7 @@ public class CorsBeanDefinitionParser { boolean mvcPresent = ClassUtils.isPresent(HANDLER_MAPPING_INTROSPECTOR, getClass().getClassLoader()); - if(!mvcPresent) { + if (!mvcPresent) { return null; } diff --git a/config/src/main/java/org/springframework/security/config/http/FormLoginBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/http/FormLoginBeanDefinitionParser.java index b20b434f20..9bb5039dc1 100644 --- a/config/src/main/java/org/springframework/security/config/http/FormLoginBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/http/FormLoginBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 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. @@ -183,7 +183,7 @@ public class FormLoginBeanDefinitionParser { if (StringUtils.hasText(successHandlerRef)) { filterBuilder.addPropertyReference("authenticationSuccessHandler", successHandlerRef); - } else if(StringUtils.hasText(authenticationSuccessForwardUrl)) { + } else if (StringUtils.hasText(authenticationSuccessForwardUrl)) { BeanDefinitionBuilder forwardSuccessHandler = BeanDefinitionBuilder .rootBeanDefinition(ForwardAuthenticationSuccessHandler.class); forwardSuccessHandler.addConstructorArgValue(authenticationSuccessForwardUrl); @@ -216,7 +216,7 @@ public class FormLoginBeanDefinitionParser { if (StringUtils.hasText(failureHandlerRef)) { filterBuilder.addPropertyReference("authenticationFailureHandler", failureHandlerRef); - } else if(StringUtils.hasText(authenticationFailureForwardUrl)) { + } else if (StringUtils.hasText(authenticationFailureForwardUrl)) { BeanDefinitionBuilder forwardFailureHandler = BeanDefinitionBuilder .rootBeanDefinition(ForwardAuthenticationFailureHandler.class); forwardFailureHandler.addConstructorArgValue(authenticationFailureForwardUrl); diff --git a/config/src/main/java/org/springframework/security/config/http/GrantedAuthorityDefaultsParserUtils.java b/config/src/main/java/org/springframework/security/config/http/GrantedAuthorityDefaultsParserUtils.java index 160520aa41..b39ea1c2a5 100644 --- a/config/src/main/java/org/springframework/security/config/http/GrantedAuthorityDefaultsParserUtils.java +++ b/config/src/main/java/org/springframework/security/config/http/GrantedAuthorityDefaultsParserUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -48,7 +48,7 @@ class GrantedAuthorityDefaultsParserUtils { public final void setApplicationContext(ApplicationContext applicationContext) throws BeansException { String[] grantedAuthorityDefaultsBeanNames = applicationContext.getBeanNamesForType(GrantedAuthorityDefaults.class); - if(grantedAuthorityDefaultsBeanNames.length == 1) { + if (grantedAuthorityDefaultsBeanNames.length == 1) { GrantedAuthorityDefaults grantedAuthorityDefaults = applicationContext.getBean(grantedAuthorityDefaultsBeanNames[0], GrantedAuthorityDefaults.class); this.rolePrefix = grantedAuthorityDefaults.getRolePrefix(); } diff --git a/config/src/main/java/org/springframework/security/config/http/HandlerMappingIntrospectorFactoryBean.java b/config/src/main/java/org/springframework/security/config/http/HandlerMappingIntrospectorFactoryBean.java index 24d149e959..79b13dabf0 100644 --- a/config/src/main/java/org/springframework/security/config/http/HandlerMappingIntrospectorFactoryBean.java +++ b/config/src/main/java/org/springframework/security/config/http/HandlerMappingIntrospectorFactoryBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -37,7 +37,7 @@ class HandlerMappingIntrospectorFactoryBean implements FactoryBean sortedWebFilters = new ArrayList<>(); this.webFilters.forEach( f -> { - if(f instanceof OrderedWebFilter) { + if (f instanceof OrderedWebFilter) { f = ((OrderedWebFilter) f).webFilter; } sortedWebFilters.add(f); @@ -1066,10 +1066,10 @@ public class ServerHttpSecurity { } private ServerAuthenticationEntryPoint getAuthenticationEntryPoint() { - if(this.authenticationEntryPoint != null || this.defaultEntryPoints.isEmpty()) { + if (this.authenticationEntryPoint != null || this.defaultEntryPoints.isEmpty()) { return this.authenticationEntryPoint; } - if(this.defaultEntryPoints.size() == 1) { + if (this.defaultEntryPoints.size() == 1) { return this.defaultEntryPoints.get(0).getEntryPoint(); } DelegatingServerAuthenticationEntryPoint result = new DelegatingServerAuthenticationEntryPoint(this.defaultEntryPoints); @@ -1087,7 +1087,7 @@ public class ServerHttpSecurity { private WebFilter securityContextRepositoryWebFilter() { ServerSecurityContextRepository repository = this.securityContextRepository; - if(repository == null) { + if (repository == null) { return null; } WebFilter result = new ReactorContextWebFilter(repository); @@ -1130,10 +1130,10 @@ public class ServerHttpSecurity { @Override protected Access registerMatcher(ServerWebExchangeMatcher matcher) { - if(this.anyExchangeRegistered) { + if (this.anyExchangeRegistered) { throw new IllegalStateException("Cannot register " + matcher + " which would be unreachable because anyExchange() has already been registered."); } - if(this.matcher != null) { + if (this.matcher != null) { throw new IllegalStateException("The matcher " + matcher + " does not have an access rule defined"); } this.matcher = matcher; @@ -1141,7 +1141,7 @@ public class ServerHttpSecurity { } protected void configure(ServerHttpSecurity http) { - if(this.matcher != null) { + if (this.matcher != null) { throw new IllegalStateException("The matcher " + this.matcher + " does not have an access rule defined"); } AuthorizationWebFilter result = new AuthorizationWebFilter(this.managerBldr.build()); @@ -1446,7 +1446,7 @@ public class ServerHttpSecurity { this.authenticationManager); authenticationFilter.setAuthenticationFailureHandler(new ServerAuthenticationEntryPointFailureHandler(this.entryPoint)); authenticationFilter.setAuthenticationConverter(new ServerHttpBasicAuthenticationConverter()); - if(this.securityContextRepository != null) { + if (this.securityContextRepository != null) { authenticationFilter.setSecurityContextRepository(this.securityContextRepository); } http.addFilterAt(authenticationFilter, SecurityWebFiltersOrder.HTTP_BASIC); @@ -1596,16 +1596,16 @@ public class ServerHttpSecurity { } protected void configure(ServerHttpSecurity http) { - if(this.authenticationEntryPoint == null) { + if (this.authenticationEntryPoint == null) { this.isEntryPointExplicit = false; loginPage("/login"); } else { this.isEntryPointExplicit = true; } - if(http.requestCache != null) { + if (http.requestCache != null) { ServerRequestCache requestCache = http.requestCache.requestCache; this.defaultSuccessHandler.setRequestCache(requestCache); - if(this.defaultEntryPoint != null) { + if (this.defaultEntryPoint != null) { this.defaultEntryPoint.setRequestCache(requestCache); } } diff --git a/config/src/main/java/org/springframework/security/config/websocket/WebSocketMessageBrokerSecurityBeanDefinitionParser.java b/config/src/main/java/org/springframework/security/config/websocket/WebSocketMessageBrokerSecurityBeanDefinitionParser.java index 8165cca7e3..2288f61eb0 100644 --- a/config/src/main/java/org/springframework/security/config/websocket/WebSocketMessageBrokerSecurityBeanDefinitionParser.java +++ b/config/src/main/java/org/springframework/security/config/websocket/WebSocketMessageBrokerSecurityBeanDefinitionParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 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. @@ -143,7 +143,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements .rootBeanDefinition(ExpressionBasedMessageSecurityMetadataSourceFactory.class); mds.setFactoryMethod("createExpressionMessageMetadataSource"); mds.addConstructorArgValue(matcherToExpression); - if(expressionHandlerDefined) { + if (expressionHandlerDefined) { mds.addConstructorArgReference(expressionHandlerRef); } @@ -151,7 +151,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements ManagedList voters = new ManagedList<>(); BeanDefinitionBuilder messageExpressionVoterBldr = BeanDefinitionBuilder.rootBeanDefinition(MessageExpressionVoter.class); - if(expressionHandlerDefined) { + if (expressionHandlerDefined) { messageExpressionVoterBldr.addPropertyReference("expressionHandler", expressionHandlerRef); } voters.add(messageExpressionVoterBldr.getBeanDefinition()); @@ -172,7 +172,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements if (StringUtils.hasText(id)) { registry.registerAlias(inSecurityInterceptorName, id); - if(!registry.containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) { + if (!registry.containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) { registry.registerBeanDefinition(PATH_MATCHER_BEAN_NAME, new RootBeanDefinition(AntPathMatcher.class)); } } @@ -267,10 +267,10 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements AuthenticationPrincipalArgumentResolver.class)); bd.getPropertyValues().add(CUSTOM_ARG_RESOLVERS_PROP, argResolvers); - if(!registry.containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) { + if (!registry.containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) { PropertyValue pathMatcherProp = bd.getPropertyValues().getPropertyValue("pathMatcher"); Object pathMatcher = pathMatcherProp == null ? null : pathMatcherProp.getValue(); - if(pathMatcher instanceof BeanReference) { + if (pathMatcher instanceof BeanReference) { registry.registerAlias(((BeanReference) pathMatcher).getBeanName(), PATH_MATCHER_BEAN_NAME); } } @@ -312,7 +312,7 @@ public final class WebSocketMessageBrokerSecurityBeanDefinitionParser implements inboundChannel.getPropertyValues().add(INTERCEPTORS_PROP, interceptors); - if(!registry.containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) { + if (!registry.containsBeanDefinition(PATH_MATCHER_BEAN_NAME)) { registry.registerBeanDefinition(PATH_MATCHER_BEAN_NAME, new RootBeanDefinition(AntPathMatcher.class)); } } diff --git a/config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java b/config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java index f236392424..bca3ceffa6 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/sec2758/Sec2758Tests.java @@ -125,13 +125,13 @@ public class Sec2758Tests { @Override public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { - if(bean instanceof Jsr250MethodSecurityMetadataSource) { + if (bean instanceof Jsr250MethodSecurityMetadataSource) { ((Jsr250MethodSecurityMetadataSource) bean).setDefaultRolePrefix(null); } - if(bean instanceof DefaultMethodSecurityExpressionHandler) { + if (bean instanceof DefaultMethodSecurityExpressionHandler) { ((DefaultMethodSecurityExpressionHandler) bean).setDefaultRolePrefix(null); } - if(bean instanceof DefaultWebSecurityExpressionHandler) { + if (bean instanceof DefaultWebSecurityExpressionHandler) { ((DefaultWebSecurityExpressionHandler) bean).setDefaultRolePrefix(null); } return bean; diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterPowermockTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterPowermockTests.java index 04cc51d345..c3d837def5 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterPowermockTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/WebSecurityConfigurerAdapterPowermockTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -45,7 +45,7 @@ public class WebSecurityConfigurerAdapterPowermockTests { @After public void close() { - if(context != null) { + if (context != null) { context.close(); } } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityAntMatchersTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityAntMatchersTests.java index fdb6ce5e96..d03672528a 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityAntMatchersTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityAntMatchersTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 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. @@ -58,7 +58,7 @@ public class HttpSecurityAntMatchersTests { @After public void cleanup() { - if(context != null) { + if (context != null) { context.close(); } } diff --git a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java index 30200a83c0..11981ebd2b 100644 --- a/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java +++ b/config/src/test/java/org/springframework/security/config/annotation/web/configurers/HttpSecurityLogoutTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2018 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. @@ -59,7 +59,7 @@ public class HttpSecurityLogoutTests { @After public void cleanup() { - if(context != null) { + if (context != null) { context.close(); } } diff --git a/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java b/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java index 768bdfabac..f05bae2869 100644 --- a/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java +++ b/config/src/test/java/org/springframework/security/config/doc/XsdDocumentedTests.java @@ -193,24 +193,24 @@ public class XsdDocumentedTests { List lines = Files.readAllLines(Paths.get(this.referenceLocation)); for ( String line : lines ) { - if(line.matches("^\\[\\[.*\\]\\]$")) { + if (line.matches("^\\[\\[.*\\]\\]$")) { String id = line.substring(2, line.length() - 2); - if(id.endsWith("-children")) { + if (id.endsWith("-children")) { docAttrName = id.substring(0, id.length() - 9); currentDocAttrNameToElmt = docAttrNameToChildren; - } else if(id.endsWith("-parents")) { + } else if (id.endsWith("-parents")) { docAttrName = id.substring(0, id.length() - 8); currentDocAttrNameToElmt = docAttrNameToParents; - } else if(docAttrName != null && !id.startsWith(docAttrName)) { + } else if (docAttrName != null && !id.startsWith(docAttrName)) { currentDocAttrNameToElmt = null; docAttrName = null; } } - if(docAttrName != null && currentDocAttrNameToElmt != null) { + if (docAttrName != null && currentDocAttrNameToElmt != null) { String expression = "^\\* <<(nsa-.*),.*>>$"; - if(line.matches(expression)) { + if (line.matches(expression)) { String elmtId = line.replaceAll(expression, "$1"); currentDocAttrNameToElmt .computeIfAbsent(docAttrName, key -> new ArrayList<>()) diff --git a/config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java b/config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java index 8061e2581f..3f1b758f49 100644 --- a/config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java +++ b/config/src/test/java/org/springframework/security/config/http/HttpInterceptUrlTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -37,7 +37,7 @@ public class HttpInterceptUrlTests { @After public void close() { - if(context != null) { + if (context != null) { context.close(); } } @@ -57,7 +57,7 @@ public class HttpInterceptUrlTests { } private void loadConfig(String... configLocations) { - for(int i=0; i params = webRequest.getRequestParameters(); - if(params != null && !params.isEmpty()) { + if (params != null && !params.isEmpty()) { return request.body(BodyInserters.fromFormData(formData(params))); } return request; @@ -153,7 +153,7 @@ final class HtmlUnitWebTestClient { URI location = response.headers().asHttpHeaders().getLocation(); String host = request.url().getHost(); String scheme = request.url().getScheme(); - if(location != null) { + if (location != null) { String redirectUrl = location.toASCIIString(); if (location.getHost() == null) { redirectUrl = scheme+ "://" + host + location.toASCIIString(); @@ -180,7 +180,7 @@ final class HtmlUnitWebTestClient { .doOnSuccess( response -> { response.cookies().values().forEach( cookies -> { cookies.forEach( cookie -> { - if(cookie.getMaxAge().isZero()) { + if (cookie.getMaxAge().isZero()) { this.cookies.remove(cookie.getName()); } else { this.cookies.put(cookie.getName(), cookie); diff --git a/core/src/main/java/org/springframework/security/access/prepost/PrePostAdviceReactiveMethodInterceptor.java b/core/src/main/java/org/springframework/security/access/prepost/PrePostAdviceReactiveMethodInterceptor.java index 2f96a3ca87..a84ff5f460 100644 --- a/core/src/main/java/org/springframework/security/access/prepost/PrePostAdviceReactiveMethodInterceptor.java +++ b/core/src/main/java/org/springframework/security/access/prepost/PrePostAdviceReactiveMethodInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -90,14 +90,14 @@ public class PrePostAdviceReactiveMethodInterceptor implements MethodInterceptor PostInvocationAttribute attr = findPostInvocationAttribute(attributes); - if(Mono.class.isAssignableFrom(returnType)) { + if (Mono.class.isAssignableFrom(returnType)) { return toInvoke .flatMap( auth -> this.>proceed(invocation) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) ); } - if(Flux.class.isAssignableFrom(returnType)) { + if (Flux.class.isAssignableFrom(returnType)) { return toInvoke .flatMapMany( auth -> this.>proceed(invocation) .map( r -> attr == null ? r : this.postAdvice.after(auth, invocation, attr, r)) diff --git a/core/src/main/java/org/springframework/security/access/vote/RoleVoter.java b/core/src/main/java/org/springframework/security/access/vote/RoleVoter.java index e717d53fb4..4462e5bc7e 100644 --- a/core/src/main/java/org/springframework/security/access/vote/RoleVoter.java +++ b/core/src/main/java/org/springframework/security/access/vote/RoleVoter.java @@ -96,7 +96,7 @@ public class RoleVoter implements AccessDecisionVoter { public int vote(Authentication authentication, Object object, Collection attributes) { - if(authentication == null) { + if (authentication == null) { return ACCESS_DENIED; } int result = ACCESS_ABSTAIN; diff --git a/core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextCallable.java b/core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextCallable.java index 6372555537..0a93cb305c 100644 --- a/core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextCallable.java +++ b/core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextCallable.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -88,7 +88,7 @@ public final class DelegatingSecurityContextCallable implements Callable { } finally { SecurityContext emptyContext = SecurityContextHolder.createEmptyContext(); - if(emptyContext.equals(originalSecurityContext)) { + if (emptyContext.equals(originalSecurityContext)) { SecurityContextHolder.clearContext(); } else { SecurityContextHolder.setContext(originalSecurityContext); diff --git a/core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnable.java b/core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnable.java index 12654e67ff..25c085691e 100644 --- a/core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnable.java +++ b/core/src/main/java/org/springframework/security/concurrent/DelegatingSecurityContextRunnable.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -85,7 +85,7 @@ public final class DelegatingSecurityContextRunnable implements Runnable { } finally { SecurityContext emptyContext = SecurityContextHolder.createEmptyContext(); - if(emptyContext.equals(originalSecurityContext)) { + if (emptyContext.equals(originalSecurityContext)) { SecurityContextHolder.clearContext(); } else { SecurityContextHolder.setContext(originalSecurityContext); diff --git a/core/src/main/java/org/springframework/security/jackson2/SecurityJackson2Modules.java b/core/src/main/java/org/springframework/security/jackson2/SecurityJackson2Modules.java index 69298bdbe7..21f03b5d56 100644 --- a/core/src/main/java/org/springframework/security/jackson2/SecurityJackson2Modules.java +++ b/core/src/main/java/org/springframework/security/jackson2/SecurityJackson2Modules.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2018 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. @@ -75,7 +75,7 @@ public final class SecurityJackson2Modules { } public static void enableDefaultTyping(ObjectMapper mapper) { - if(mapper != null) { + if (mapper != null) { TypeResolverBuilder typeBuilder = mapper.getDeserializationConfig().getDefaultTyper(null); if (typeBuilder == null) { mapper.setDefaultTyping(createWhitelistedDefaultTyping()); @@ -89,13 +89,13 @@ public final class SecurityJackson2Modules { try { Class securityModule = (Class) ClassUtils.forName(className, loader); if (securityModule != null) { - if(logger.isDebugEnabled()) { + if (logger.isDebugEnabled()) { logger.debug("Loaded module " + className + ", now registering"); } instance = securityModule.newInstance(); } } catch (Exception e) { - if(logger.isDebugEnabled()) { + if (logger.isDebugEnabled()) { logger.debug("Cannot load module " + className, e); } } @@ -195,15 +195,15 @@ public final class SecurityJackson2Modules { DeserializationConfig config = (DeserializationConfig) context.getConfig(); JavaType result = delegate.typeFromId(context, id); String className = result.getRawClass().getName(); - if(isWhitelisted(className)) { + if (isWhitelisted(className)) { return delegate.typeFromId(context, id); } boolean isExplicitMixin = config.findMixInClassFor(result.getRawClass()) != null; - if(isExplicitMixin) { + if (isExplicitMixin) { return result; } JacksonAnnotation jacksonAnnotation = AnnotationUtils.findAnnotation(result.getRawClass(), JacksonAnnotation.class); - if(jacksonAnnotation != null) { + if (jacksonAnnotation != null) { return result; } throw new IllegalArgumentException("The class with " + id + " and name of " + className + " is not whitelisted. " + diff --git a/core/src/main/java/org/springframework/security/jackson2/UserDeserializer.java b/core/src/main/java/org/springframework/security/jackson2/UserDeserializer.java index db451a6cbd..ad685ffd74 100644 --- a/core/src/main/java/org/springframework/security/jackson2/UserDeserializer.java +++ b/core/src/main/java/org/springframework/security/jackson2/UserDeserializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2018 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. @@ -66,7 +66,7 @@ class UserDeserializer extends JsonDeserializer { readJsonNode(jsonNode, "accountNonLocked").asBoolean(), authorities ); - if(password.asText(null) == null) { + if (password.asText(null) == null) { result.eraseCredentials(); } return result; diff --git a/core/src/main/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenDeserializer.java b/core/src/main/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenDeserializer.java index 38016abc38..a0e4dfbf32 100644 --- a/core/src/main/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenDeserializer.java +++ b/core/src/main/java/org/springframework/security/jackson2/UsernamePasswordAuthenticationTokenDeserializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2018 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. @@ -62,7 +62,7 @@ class UsernamePasswordAuthenticationTokenDeserializer extends JsonDeserializer idToPasswordEncoder) { - if(idForEncode == null) { + if (idForEncode == null) { throw new IllegalArgumentException("idForEncode cannot be null"); } - if(!idToPasswordEncoder.containsKey(idForEncode)) { + if (!idToPasswordEncoder.containsKey(idForEncode)) { throw new IllegalArgumentException("idForEncode " + idForEncode + "is not found in idToPasswordEncoder " + idToPasswordEncoder); } - for(String id : idToPasswordEncoder.keySet()) { - if(id == null) { + for (String id : idToPasswordEncoder.keySet()) { + if (id == null) { continue; } - if(id.contains(PREFIX)) { + if (id.contains(PREFIX)) { throw new IllegalArgumentException("id " + id + " cannot contain " + PREFIX); } - if(id.contains(SUFFIX)) { + if (id.contains(SUFFIX)) { throw new IllegalArgumentException("id " + id + " cannot contain " + SUFFIX); } } @@ -175,7 +175,7 @@ public class DelegatingPasswordEncoder implements PasswordEncoder { */ public void setDefaultPasswordEncoderForMatches( PasswordEncoder defaultPasswordEncoderForMatches) { - if(defaultPasswordEncoderForMatches == null) { + if (defaultPasswordEncoderForMatches == null) { throw new IllegalArgumentException("defaultPasswordEncoderForMatches cannot be null"); } this.defaultPasswordEncoderForMatches = defaultPasswordEncoderForMatches; @@ -188,12 +188,12 @@ public class DelegatingPasswordEncoder implements PasswordEncoder { @Override public boolean matches(CharSequence rawPassword, String prefixEncodedPassword) { - if(rawPassword == null && prefixEncodedPassword == null) { + if (rawPassword == null && prefixEncodedPassword == null) { return true; } String id = extractId(prefixEncodedPassword); PasswordEncoder delegate = this.idToPasswordEncoder.get(id); - if(delegate == null) { + if (delegate == null) { return this.defaultPasswordEncoderForMatches .matches(rawPassword, prefixEncodedPassword); } @@ -206,11 +206,11 @@ public class DelegatingPasswordEncoder implements PasswordEncoder { return null; } int start = prefixEncodedPassword.indexOf(PREFIX); - if(start != 0) { + if (start != 0) { return null; } int end = prefixEncodedPassword.indexOf(SUFFIX, start); - if(end < 0) { + if (end < 0) { return null; } return prefixEncodedPassword.substring(start + 1, end); diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/Digester.java b/crypto/src/main/java/org/springframework/security/crypto/password/Digester.java index 35e9b600de..b73f084897 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/Digester.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/Digester.java @@ -1,5 +1,5 @@ /* - * Copyright 2011-2016 the original author or authors. + * Copyright 2011-2018 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. @@ -54,7 +54,7 @@ final class Digester { } final void setIterations(int iterations) { - if(iterations <= 0) { + if (iterations <= 0) { throw new IllegalArgumentException("Iterations value must be greater than zero"); } this.iterations = iterations; diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/LdapShaPasswordEncoder.java b/crypto/src/main/java/org/springframework/security/crypto/password/LdapShaPasswordEncoder.java index 84fd719c7e..733782bb4f 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/LdapShaPasswordEncoder.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/LdapShaPasswordEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -68,7 +68,7 @@ public class LdapShaPasswordEncoder implements PasswordEncoder { } public LdapShaPasswordEncoder(BytesKeyGenerator saltGenerator) { - if(saltGenerator == null) { + if (saltGenerator == null) { throw new IllegalArgumentException("saltGenerator cannot be null"); } this.saltGenerator = saltGenerator; diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/Md4PasswordEncoder.java b/crypto/src/main/java/org/springframework/security/crypto/password/Md4PasswordEncoder.java index b1571ec971..36616c0d0f 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/Md4PasswordEncoder.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/Md4PasswordEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -104,7 +104,7 @@ public class Md4PasswordEncoder implements PasswordEncoder { } private String digest(String salt, CharSequence rawPassword) { - if(rawPassword == null) { + if (rawPassword == null) { rawPassword = ""; } String saltedPassword = rawPassword + salt; @@ -143,11 +143,11 @@ public class Md4PasswordEncoder implements PasswordEncoder { private String extractSalt(String prefixEncodedPassword) { int start = prefixEncodedPassword.indexOf(PREFIX); - if(start != 0) { + if (start != 0) { return ""; } int end = prefixEncodedPassword.indexOf(SUFFIX, start); - if(end < 0) { + if (end < 0) { return ""; } return prefixEncodedPassword.substring(start, end + 1); diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/MessageDigestPasswordEncoder.java b/crypto/src/main/java/org/springframework/security/crypto/password/MessageDigestPasswordEncoder.java index 735c5ae050..8d75269696 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/MessageDigestPasswordEncoder.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/MessageDigestPasswordEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -162,11 +162,11 @@ public class MessageDigestPasswordEncoder implements PasswordEncoder { private String extractSalt(String prefixEncodedPassword) { int start = prefixEncodedPassword.indexOf(PREFIX); - if(start != 0) { + if (start != 0) { return ""; } int end = prefixEncodedPassword.indexOf(SUFFIX, start); - if(end < 0) { + if (end < 0) { return ""; } return prefixEncodedPassword.substring(start, end + 1); diff --git a/crypto/src/main/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoder.java b/crypto/src/main/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoder.java index 0d5d4c72fe..2e45695f24 100644 --- a/crypto/src/main/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoder.java +++ b/crypto/src/main/java/org/springframework/security/crypto/password/Pbkdf2PasswordEncoder.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -100,7 +100,7 @@ public class Pbkdf2PasswordEncoder implements PasswordEncoder { * @since 5.0 */ public void setAlgorithm(SecretKeyFactoryAlgorithm secretKeyFactoryAlgorithm) { - if(secretKeyFactoryAlgorithm == null) { + if (secretKeyFactoryAlgorithm == null) { throw new IllegalArgumentException("secretKeyFactoryAlgorithm cannot be null"); } String algorithmName = secretKeyFactoryAlgorithm.name(); @@ -131,7 +131,7 @@ public class Pbkdf2PasswordEncoder implements PasswordEncoder { } private String encode(byte[] bytes) { - if(this.encodeHashAsBase64) { + if (this.encodeHashAsBase64) { return Base64.getEncoder().encodeToString(bytes); } return String.valueOf(Hex.encode(bytes)); @@ -160,7 +160,7 @@ public class Pbkdf2PasswordEncoder implements PasswordEncoder { } private byte[] decode(String encodedBytes) { - if(this.encodeHashAsBase64) { + if (this.encodeHashAsBase64) { return Base64.getDecoder().decode(encodedBytes); } return Hex.decode(encodedBytes); diff --git a/itest/web/src/integration-test/java/org/springframework/security/integration/AbstractWebServerIntegrationTests.java b/itest/web/src/integration-test/java/org/springframework/security/integration/AbstractWebServerIntegrationTests.java index f022b97876..2e0be66511 100644 --- a/itest/web/src/integration-test/java/org/springframework/security/integration/AbstractWebServerIntegrationTests.java +++ b/itest/web/src/integration-test/java/org/springframework/security/integration/AbstractWebServerIntegrationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -37,13 +37,13 @@ public abstract class AbstractWebServerIntegrationTests { @After public void close() { - if(context != null) { + if (context != null) { context.close(); } } protected final MockMvc createMockMvc(String... configLocations) throws Exception { - if(this.context != null) { + if (this.context != null) { throw new IllegalStateException("context is already loaded"); } diff --git a/ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java b/ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java index 0db14b234a..67734d23eb 100644 --- a/ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java +++ b/ldap/src/main/java/org/springframework/security/ldap/authentication/PasswordComparisonAuthenticator.java @@ -123,10 +123,10 @@ public final class PasswordComparisonAuthenticator extends AbstractLdapAuthentic private String getPassword(DirContextOperations user) { Object passwordAttrValue = user.getObjectAttribute(this.passwordAttributeName); - if(passwordAttrValue == null) { + if (passwordAttrValue == null) { return null; } - if(passwordAttrValue instanceof byte[]) { + if (passwordAttrValue instanceof byte[]) { return new String((byte[]) passwordAttrValue); } return String.valueOf(passwordAttrValue); diff --git a/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java b/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java index d6e0f10faa..12808db9c7 100644 --- a/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java +++ b/test/src/main/java/org/springframework/security/test/context/support/ReactorContextTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -81,7 +81,7 @@ public class ReactorContextTestExecutionListener @Override public Context currentContext() { Context context = delegate.currentContext(); - if(context.hasKey(CONTEXT_DEFAULTED_ATTR_NAME)) { + if (context.hasKey(CONTEXT_DEFAULTED_ATTR_NAME)) { return context; } context = context.put(CONTEXT_DEFAULTED_ATTR_NAME, Boolean.TRUE); diff --git a/test/src/main/java/org/springframework/security/test/context/support/WithMockUserSecurityContextFactory.java b/test/src/main/java/org/springframework/security/test/context/support/WithMockUserSecurityContextFactory.java index 857e922324..4adc09e7c6 100644 --- a/test/src/main/java/org/springframework/security/test/context/support/WithMockUserSecurityContextFactory.java +++ b/test/src/main/java/org/springframework/security/test/context/support/WithMockUserSecurityContextFactory.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2014 the original author or authors. + * Copyright 2002-2018 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. @@ -51,7 +51,7 @@ final class WithMockUserSecurityContextFactory implements grantedAuthorities.add(new SimpleGrantedAuthority(authority)); } - if(grantedAuthorities.isEmpty()) { + if (grantedAuthorities.isEmpty()) { for (String role : withUser.roles()) { if (role.startsWith("ROLE_")) { throw new IllegalArgumentException("roles cannot start with ROLE_ Got " @@ -59,7 +59,7 @@ final class WithMockUserSecurityContextFactory implements } grantedAuthorities.add(new SimpleGrantedAuthority("ROLE_" + role)); } - } else if(!(withUser.roles().length == 1 && "USER".equals(withUser.roles()[0]))) { + } else if (!(withUser.roles().length == 1 && "USER".equals(withUser.roles()[0]))) { throw new IllegalStateException("You cannot define roles attribute "+ Arrays.asList(withUser.roles())+" with authorities attribute "+ Arrays.asList(withUser.authorities())); } diff --git a/test/src/main/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListener.java b/test/src/main/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListener.java index a26552e3d6..e7ca4e0d24 100644 --- a/test/src/main/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListener.java +++ b/test/src/main/java/org/springframework/security/test/context/support/WithSecurityContextTestExecutionListener.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -84,7 +84,7 @@ public class WithSecurityContextTestExecutionListener @Override public void beforeTestExecution(TestContext testContext) { SecurityContext securityContext = (SecurityContext) testContext.removeAttribute(SECURITY_CONTEXT_ATTR_NAME); - if(securityContext != null) { + if (securityContext != null) { TestSecurityContextHolder.setContext(securityContext); } } diff --git a/test/src/main/java/org/springframework/security/test/context/support/WithUserDetailsSecurityContextFactory.java b/test/src/main/java/org/springframework/security/test/context/support/WithUserDetailsSecurityContextFactory.java index d03fa90419..3c104b7613 100644 --- a/test/src/main/java/org/springframework/security/test/context/support/WithUserDetailsSecurityContextFactory.java +++ b/test/src/main/java/org/springframework/security/test/context/support/WithUserDetailsSecurityContextFactory.java @@ -67,7 +67,7 @@ final class WithUserDetailsSecurityContextFactory implements } private UserDetailsService findUserDetailsService(String beanName) { - if(reactorPresent) { + if (reactorPresent) { UserDetailsService reactive = findAndAdaptReactiveUserDetailsService(beanName); if (reactive != null) { return reactive; diff --git a/test/src/main/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurers.java b/test/src/main/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurers.java index 2d2d73276a..833d959aea 100644 --- a/test/src/main/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurers.java +++ b/test/src/main/java/org/springframework/security/test/web/reactive/server/SecurityMockServerConfigurers.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -286,7 +286,7 @@ public class SecurityMockServerConfigurers { @Override public Mono filter(ServerWebExchange exchange, WebFilterChain webFilterChain) { Supplier> context = exchange.getAttribute(ATTRIBUTE_NAME); - if(context != null) { + if (context != null) { exchange.getAttributes().remove(ATTRIBUTE_NAME); return webFilterChain.filter(exchange) .subscriberContext(ReactiveSecurityContextHolder.withSecurityContext(context.get())); diff --git a/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java b/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java index e3f758721e..da3d931bf1 100755 --- a/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/preauth/AbstractPreAuthenticatedProcessingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -149,7 +149,7 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi return false; } - if(logger.isDebugEnabled()) { + if (logger.isDebugEnabled()) { logger.debug("Pre-authenticated principal has changed to " + principal + " and will be reauthenticated"); } return true; @@ -205,7 +205,7 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi return false; } - if(!principalChanged(request, currentUser)) { + if (!principalChanged(request, currentUser)) { return false; } @@ -242,7 +242,7 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi authResult, this.getClass())); } - if(authenticationSuccessHandler != null) { + if (authenticationSuccessHandler != null) { authenticationSuccessHandler.onAuthenticationSuccess(request, response, authResult); } } @@ -262,7 +262,7 @@ public abstract class AbstractPreAuthenticatedProcessingFilter extends GenericFi } request.setAttribute(WebAttributes.AUTHENTICATION_EXCEPTION, failed); - if(authenticationFailureHandler != null) { + if (authenticationFailureHandler != null) { authenticationFailureHandler.onAuthenticationFailure(request, response, failed); } } diff --git a/web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLoginPageGeneratingFilter.java b/web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLoginPageGeneratingFilter.java index 153b527c35..64849b44e4 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLoginPageGeneratingFilter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLoginPageGeneratingFilter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -295,7 +295,7 @@ public class DefaultLoginPageGeneratingFilter extends GenericFilterBean { private String renderHiddenInputs(HttpServletRequest request) { StringBuilder sb = new StringBuilder(); - for(Map.Entry input : this.resolveHiddenInputs.apply(request).entrySet()) { + for (Map.Entry input : this.resolveHiddenInputs.apply(request).entrySet()) { sb.append("\n"); } return sb.toString(); diff --git a/web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLogoutPageGeneratingFilter.java b/web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLogoutPageGeneratingFilter.java index 70186605b0..b117d45ddc 100644 --- a/web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLogoutPageGeneratingFilter.java +++ b/web/src/main/java/org/springframework/security/web/authentication/ui/DefaultLogoutPageGeneratingFilter.java @@ -95,7 +95,7 @@ public class DefaultLogoutPageGeneratingFilter extends OncePerRequestFilter { private String renderHiddenInputs(HttpServletRequest request) { StringBuilder sb = new StringBuilder(); - for(Map.Entry input : this.resolveHiddenInputs.apply(request).entrySet()) { + for (Map.Entry input : this.resolveHiddenInputs.apply(request).entrySet()) { sb.append("\n"); } return sb.toString(); diff --git a/web/src/main/java/org/springframework/security/web/firewall/FirewalledResponse.java b/web/src/main/java/org/springframework/security/web/firewall/FirewalledResponse.java index c60a6a09fd..bf042bd3f2 100644 --- a/web/src/main/java/org/springframework/security/web/firewall/FirewalledResponse.java +++ b/web/src/main/java/org/springframework/security/web/firewall/FirewalledResponse.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2018 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. @@ -58,7 +58,7 @@ class FirewalledResponse extends HttpServletResponseWrapper { @Override public void addCookie(Cookie cookie) { - if(cookie != null) { + if (cookie != null) { validateCrlf(SET_COOKIE_HEADER, cookie.getName()); validateCrlf(SET_COOKIE_HEADER, cookie.getValue()); validateCrlf(SET_COOKIE_HEADER, cookie.getPath()); diff --git a/web/src/main/java/org/springframework/security/web/header/writers/frameoptions/XFrameOptionsHeaderWriter.java b/web/src/main/java/org/springframework/security/web/header/writers/frameoptions/XFrameOptionsHeaderWriter.java index 8927f4b6b3..6c7f77aaae 100644 --- a/web/src/main/java/org/springframework/security/web/header/writers/frameoptions/XFrameOptionsHeaderWriter.java +++ b/web/src/main/java/org/springframework/security/web/header/writers/frameoptions/XFrameOptionsHeaderWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2018 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. @@ -83,7 +83,7 @@ public final class XFrameOptionsHeaderWriter implements HeaderWriter { public void writeHeaders(HttpServletRequest request, HttpServletResponse response) { if (XFrameOptionsMode.ALLOW_FROM.equals(frameOptionsMode)) { String allowFromValue = this.allowFromStrategy.getAllowFromValue(request); - if(XFrameOptionsMode.DENY.getMode().equals(allowFromValue)) { + if (XFrameOptionsMode.DENY.getMode().equals(allowFromValue)) { response.setHeader(XFRAME_OPTIONS_HEADER, XFrameOptionsMode.DENY.getMode()); } else if (allowFromValue != null) { response.setHeader(XFRAME_OPTIONS_HEADER, diff --git a/web/src/main/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenDeserializer.java b/web/src/main/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenDeserializer.java index f58c2f0fb5..eab7e55c78 100644 --- a/web/src/main/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenDeserializer.java +++ b/web/src/main/java/org/springframework/security/web/jackson2/PreAuthenticatedAuthenticationTokenDeserializer.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2016 the original author or authors. + * Copyright 2015-2018 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. @@ -61,7 +61,7 @@ class PreAuthenticatedAuthenticationTokenDeserializer extends JsonDeserializer

save(ServerWebExchange exchange, SecurityContext context) { return exchange.getSession() .doOnNext(session -> { - if(context == null) { + if (context == null) { session.getAttributes().remove(this.springSecurityContextAttrName); } else { session.getAttributes().put(this.springSecurityContextAttrName, context); diff --git a/web/src/main/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriter.java index eeadc70f26..3d0dc85b9b 100644 --- a/web/src/main/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriter.java +++ b/web/src/main/java/org/springframework/security/web/server/header/StaticServerHttpHeadersWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -43,7 +43,7 @@ public class StaticServerHttpHeadersWriter implements ServerHttpHeadersWriter { public Mono writeHttpHeaders(ServerWebExchange exchange) { HttpHeaders headers = exchange.getResponse().getHeaders(); boolean containsOneHeaderToAdd = Collections.disjoint(headers.keySet(), this.headersToAdd.keySet()); - if(containsOneHeaderToAdd) { + if (containsOneHeaderToAdd) { this.headersToAdd.forEach((name, values) -> { headers.put(name, values); }); diff --git a/web/src/main/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriter.java b/web/src/main/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriter.java index 2e7cf31677..d463095444 100644 --- a/web/src/main/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriter.java +++ b/web/src/main/java/org/springframework/security/web/server/header/XXssProtectionServerHttpHeadersWriter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -108,7 +108,7 @@ public class XXssProtectionServerHttpHeadersWriter implements ServerHttpHeadersW if (!enabled) { return "0"; } - if(!block) { + if (!block) { return "1"; } return "1 ; mode=block"; diff --git a/web/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java b/web/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java index 25ff4a7ba5..541e676b95 100644 --- a/web/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java +++ b/web/src/main/java/org/springframework/security/web/server/util/matcher/PathPatternParserServerWebExchangeMatcher.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -61,12 +61,12 @@ public final class PathPatternParserServerWebExchangeMatcher implements ServerWe @Override public Mono matches(ServerWebExchange exchange) { ServerHttpRequest request = exchange.getRequest(); - if(this.method != null && !this.method.equals(request.getMethod())) { + if (this.method != null && !this.method.equals(request.getMethod())) { return MatchResult.notMatch(); } PathContainer path = request.getPath().pathWithinApplication(); boolean match = this.pattern.matches(path); - if(!match) { + if (!match) { return MatchResult.notMatch(); } Map pathVariables = this.pattern.matchAndExtract(path).getUriVariables(); diff --git a/web/src/main/java/org/springframework/security/web/util/UrlUtils.java b/web/src/main/java/org/springframework/security/web/util/UrlUtils.java index 9f9a7fce51..49333f4775 100644 --- a/web/src/main/java/org/springframework/security/web/util/UrlUtils.java +++ b/web/src/main/java/org/springframework/security/web/util/UrlUtils.java @@ -137,7 +137,7 @@ public final class UrlUtils { * defined in RFC 1738. */ public static boolean isAbsoluteUrl(String url) { - if(url == null) { + if (url == null) { return false; } final Pattern ABSOLUTE_URL = Pattern.compile("\\A[a-z0-9.+-]+://.*",