diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ManagementEndpointPathResolver.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ManagementEndpointPathResolver.java index 8356ddef7d3..4281204d2b6 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ManagementEndpointPathResolver.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/endpoint/ManagementEndpointPathResolver.java @@ -24,6 +24,7 @@ import org.springframework.boot.endpoint.EndpointPathResolver; * actuator endpoint paths based on the endpoint id and management.context-path. * * @author Madhura Bhave + * @since 2.0.0 */ public class ManagementEndpointPathResolver implements EndpointPathResolver { diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java index ae1c4002e28..1b8e3d1d0c1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityAutoConfiguration.java @@ -52,10 +52,8 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur @ConditionalOnClass({ AuthenticationManager.class, GlobalAuthenticationConfigurerAdapter.class }) @EnableConfigurationProperties(SecurityProperties.class) -@Import({ SpringBootWebSecurityConfiguration.class, - WebSecurityEnablerConfiguration.class, - AuthenticationManagerConfiguration.class, - SecurityDataConfiguration.class }) +@Import({ SpringBootWebSecurityConfiguration.class, WebSecurityEnablerConfiguration.class, + AuthenticationManagerConfiguration.class, SecurityDataConfiguration.class }) public class SecurityAutoConfiguration { @Bean diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java index f6cbc2941c1..b748f11d348 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SecurityProperties.java @@ -108,11 +108,6 @@ public class SecurityProperties implements SecurityPrerequisite { */ private boolean enabled = true; - /** - * Security authorize mode to apply. - */ - private SecurityAuthorizeMode authorizeMode = SecurityAuthorizeMode.ROLE; - public boolean isEnabled() { return this.enabled; } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootSecurity.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootSecurity.java index 16da7a6c805..d3d480a4e5e 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootSecurity.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootSecurity.java @@ -33,11 +33,11 @@ import org.springframework.util.StringUtils; /** - * Provides request matchers that can be used to - * configure security for static resources and the error controller path in a custom - * {@link WebSecurityConfigurerAdapter}. + * Provides request matchers that can be used to configure security for static resources + * and the error controller path in a custom {@link WebSecurityConfigurerAdapter}. * * @author Madhura Bhave + * @since 2.0.0 */ public final class SpringBootSecurity { @@ -46,14 +46,15 @@ public final class SpringBootSecurity { */ public final static String ALL_ENDPOINTS = "**"; - private static String[] STATIC_RESOURCES = new String[]{"/css/**", "/js/**", - "/images/**", "/webjars/**", "/**/favicon.ico"}; + private static String[] STATIC_RESOURCES = new String[] { "/css/**", "/js/**", + "/images/**", "/webjars/**", "/**/favicon.ico" }; private final EndpointPathResolver endpointPathResolver; private final ErrorController errorController; - SpringBootSecurity(EndpointPathResolver endpointPathResolver, ErrorController errorController) { + SpringBootSecurity(EndpointPathResolver endpointPathResolver, + ErrorController errorController) { this.endpointPathResolver = endpointPathResolver; this.errorController = errorController; } @@ -67,7 +68,8 @@ public final class SpringBootSecurity { Assert.notEmpty(ids, "At least one endpoint id must be specified."); List pathList = Arrays.asList(ids); if (pathList.contains(ALL_ENDPOINTS)) { - return new AntPathRequestMatcher(this.endpointPathResolver.resolvePath(ALL_ENDPOINTS), null); + return new AntPathRequestMatcher(this.endpointPathResolver.resolvePath( + ALL_ENDPOINTS), null); } return getEndpointsRequestMatcher(pathList); } @@ -84,7 +86,8 @@ public final class SpringBootSecurity { if (e.isAnnotationPresent(Endpoint.class)) { return e.getAnnotation(Endpoint.class).id(); } - throw new IllegalArgumentException("Only classes annotated with @Endpoint are supported."); + throw new IllegalArgumentException( + "Only classes annotated with @Endpoint are supported."); }).collect(Collectors.toList()); return getEndpointsRequestMatcher(paths); } @@ -104,7 +107,8 @@ public final class SpringBootSecurity { */ public RequestMatcher error() { if (this.errorController == null) { - throw new IllegalStateException("Path for error controller could not be determined."); + throw new IllegalStateException( + "Path for error controller could not be determined."); } String path = normalizePath(this.errorController.getErrorPath()); return new AntPathRequestMatcher(path + "/**", null); @@ -121,9 +125,9 @@ public final class SpringBootSecurity { private static RequestMatcher getRequestMatcher(String... paths) { List matchers = new ArrayList<>(); - for (String path : paths) { - matchers.add(new AntPathRequestMatcher(path, null)); - } + for (String path : paths) { + matchers.add(new AntPathRequestMatcher(path, null)); + } return new OrRequestMatcher(matchers); } @@ -134,5 +138,6 @@ public final class SpringBootSecurity { } return result; } + } diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java index 5fc3cd7a0ac..ec11a21acb8 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/SpringBootWebSecurityConfiguration.java @@ -30,11 +30,12 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur /** * The default configuration for web security. It relies on Spring Security's * content-negotiation strategy to determine what sort of authentication to use. - * If the user specifies their own {@link WebSecurityConfigurerAdapter}, this will back-off - * completely and the users should specify all the bits that they want to configure as part - * of the custom security configuration. + * If the user specifies their own {@link WebSecurityConfigurerAdapter}, this will + * back-off completely and the users should specify all the bits that they want to + * configure as part of the custom security configuration. * * @author Madhura Bhave + * @since 2.0.0 */ @ConditionalOnProperty(prefix = "security.basic", name = "enabled", havingValue = "true", matchIfMissing = true) @ConditionalOnClass(EnableWebSecurity.class) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/WebSecurityEnablerConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/WebSecurityEnablerConfiguration.java index ef0520cde3b..9d55f707b24 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/WebSecurityEnablerConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/WebSecurityEnablerConfiguration.java @@ -25,12 +25,13 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; /** - * If there is a bean of type WebSecurityConfigurerAdapter, - * this adds the {@code @EnableWebSecurity} annotation if it is not already specified. - * This will make sure that the annotation is present with default security autoconfiguration - * and also if the user adds custom security and forgets to add the annotation. + * If there is a bean of type WebSecurityConfigurerAdapter, this adds the + * {@code @EnableWebSecurity} annotation if it is not already specified. This will make + * sure that the annotation is present with default security auto-configuration and also + * if the user adds custom security and forgets to add the annotation. * * @author Madhura Bhave + * @since 2.0.0 */ @ConditionalOnBean(WebSecurityConfigurerAdapter.class) @ConditionalOnClass(EnableWebSecurity.class) diff --git a/spring-boot/src/main/java/org/springframework/boot/endpoint/DefaultEndpointPathResolver.java b/spring-boot/src/main/java/org/springframework/boot/endpoint/DefaultEndpointPathResolver.java index eb691423546..703d9babddc 100644 --- a/spring-boot/src/main/java/org/springframework/boot/endpoint/DefaultEndpointPathResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/endpoint/DefaultEndpointPathResolver.java @@ -21,6 +21,7 @@ package org.springframework.boot.endpoint; * resolving endpoint paths. * * @author Madhura Bhave + * @since 2.0.0 */ public class DefaultEndpointPathResolver implements EndpointPathResolver { diff --git a/spring-boot/src/main/java/org/springframework/boot/endpoint/EndpointPathResolver.java b/spring-boot/src/main/java/org/springframework/boot/endpoint/EndpointPathResolver.java index d468f8f2184..581fad261c7 100644 --- a/spring-boot/src/main/java/org/springframework/boot/endpoint/EndpointPathResolver.java +++ b/spring-boot/src/main/java/org/springframework/boot/endpoint/EndpointPathResolver.java @@ -27,7 +27,6 @@ public interface EndpointPathResolver { /** * Resolve endpoint path based on id. - * * @param endpointId the endpoint id * @return the resolved path */