diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java
index 1b61c92112b..c29c749d76a 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java
@@ -26,7 +26,6 @@ import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.ObjectProvider;
-import org.springframework.boot.actuate.endpoint.Endpoint;
import org.springframework.boot.actuate.endpoint.mvc.EndpointHandlerMapping;
import org.springframework.boot.actuate.endpoint.mvc.MvcEndpoint;
import org.springframework.boot.actuate.endpoint.mvc.NamedMvcEndpoint;
@@ -62,7 +61,6 @@ import org.springframework.security.config.annotation.web.builders.WebSecurity.I
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.AuthenticationEntryPoint;
import org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint;
@@ -77,11 +75,7 @@ import org.springframework.util.StringUtils;
* {@link EnableAutoConfiguration Auto-configuration} for security of framework endpoints.
* Many aspects of the behavior can be controller with {@link ManagementServerProperties}
* via externalized application properties (or via an bean definition of that type to set
- * the defaults).
- *
- * The framework {@link Endpoint}s (used to expose application information to operations)
- * include a {@link Endpoint#isSensitive() sensitive} configuration option which will be
- * used as a security hint by the filter created here.
+ * the defaults)..
*
* @author Dave Syer
* @author Andy Wilkinson
@@ -126,7 +120,6 @@ public class ManagementWebSecurityAutoConfiguration {
.getRequestMatcher(this.contextResolver);
configurer.requestMatchers(requestMatcher);
}
-
}
}
@@ -223,8 +216,6 @@ public class ManagementWebSecurityAutoConfiguration {
http.exceptionHandling().authenticationEntryPoint(entryPoint);
// Match all the requests for actuator endpoints ...
http.requestMatcher(matcher);
- // ... but permitAll() for the non-sensitive ones
- configurePermittedRequests(http.authorizeRequests());
http.httpBasic().authenticationEntryPoint(entryPoint).and().cors();
// No cookies for management endpoints by default
http.csrf().disable();
@@ -258,38 +249,9 @@ public class ManagementWebSecurityAutoConfiguration {
return entryPoint;
}
- private void configurePermittedRequests(
- ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry requests) {
- requests.requestMatchers(new LazyEndpointPathRequestMatcher(
- this.contextResolver, EndpointPaths.SENSITIVE)).authenticated();
- // Permit access to the non-sensitive endpoints
- requests.requestMatchers(new LazyEndpointPathRequestMatcher(
- this.contextResolver, EndpointPaths.NON_SENSITIVE)).permitAll();
- }
-
}
- private enum EndpointPaths {
-
- ALL,
-
- NON_SENSITIVE {
-
- @Override
- protected boolean isIncluded(MvcEndpoint endpoint) {
- return !endpoint.isSensitive();
- }
-
- },
-
- SENSITIVE {
-
- @Override
- protected boolean isIncluded(MvcEndpoint endpoint) {
- return endpoint.isSensitive();
- }
-
- };
+ private static class EndpointPaths {
public String[] getPaths(EndpointHandlerMapping endpointHandlerMapping) {
if (endpointHandlerMapping == null) {
@@ -298,24 +260,18 @@ public class ManagementWebSecurityAutoConfiguration {
Set extends MvcEndpoint> endpoints = endpointHandlerMapping.getEndpoints();
Set paths = new LinkedHashSet<>(endpoints.size());
for (MvcEndpoint endpoint : endpoints) {
- if (isIncluded(endpoint)) {
- String path = endpointHandlerMapping.getPath(endpoint.getPath());
- paths.add(path);
- if (!path.equals("")) {
- paths.add(path + "/**");
- // Add Spring MVC-generated additional paths
- paths.add(path + ".*");
- }
- paths.add(path + "/");
+ String path = endpointHandlerMapping.getPath(endpoint.getPath());
+ paths.add(path);
+ if (!path.equals("")) {
+ paths.add(path + "/**");
+ // Add Spring MVC-generated additional paths
+ paths.add(path + ".*");
}
+ paths.add(path + "/");
}
return paths.toArray(new String[paths.size()]);
}
- protected boolean isIncluded(MvcEndpoint endpoint) {
- return true;
- }
-
}
private static class LazyEndpointPathRequestMatcher implements RequestMatcher {
@@ -342,7 +298,8 @@ public class ManagementWebSecurityAutoConfiguration {
return matcher;
}
// Match everything, including the sensitive and non-sensitive paths
- return new LazyEndpointPathRequestMatcher(contextResolver, EndpointPaths.ALL);
+ return new LazyEndpointPathRequestMatcher(contextResolver,
+ new EndpointPaths());
}
LazyEndpointPathRequestMatcher(ManagementContextResolver contextResolver,
diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpoint.java
index a409c652bff..a1ae48e7dd9 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpoint.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/cloudfoundry/CloudFoundryDiscoveryMvcEndpoint.java
@@ -41,7 +41,7 @@ class CloudFoundryDiscoveryMvcEndpoint extends AbstractMvcEndpoint {
private final Set endpoints;
CloudFoundryDiscoveryMvcEndpoint(Set endpoints) {
- super("", false);
+ super("");
this.endpoints = endpoints;
}
diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java
index a81c2e99d7b..b3debdedf6b 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/AbstractEndpoint.java
@@ -41,47 +41,27 @@ public abstract class AbstractEndpoint implements Endpoint, EnvironmentAwa
*/
private String id;
- private final boolean sensitiveDefault;
-
- /**
- * Mark if the endpoint exposes sensitive information.
- */
- private Boolean sensitive;
-
/**
* Enable the endpoint.
*/
private Boolean enabled;
- /**
- * Create a new sensitive endpoint instance. The endpoint will enabled flag will be
- * based on the spring {@link Environment} unless explicitly set.
- * @param id the endpoint ID
- */
- public AbstractEndpoint(String id) {
- this(id, true);
- }
-
/**
* Create a new endpoint instance. The endpoint will enabled flag will be based on the
* spring {@link Environment} unless explicitly set.
* @param id the endpoint ID
- * @param sensitive if the endpoint is sensitive by default
*/
- public AbstractEndpoint(String id, boolean sensitive) {
+ public AbstractEndpoint(String id) {
setId(id);
- this.sensitiveDefault = sensitive;
}
/**
* Create a new endpoint instance.
* @param id the endpoint ID
- * @param sensitive if the endpoint is sensitive
* @param enabled if the endpoint is enabled or not.
*/
- public AbstractEndpoint(String id, boolean sensitive, boolean enabled) {
+ public AbstractEndpoint(String id, boolean enabled) {
setId(id);
- this.sensitiveDefault = sensitive;
this.enabled = enabled;
}
@@ -115,14 +95,4 @@ public abstract class AbstractEndpoint implements Endpoint, EnvironmentAwa
this.enabled = enabled;
}
- @Override
- public boolean isSensitive() {
- return EndpointProperties.isSensitive(this.environment, this.sensitive,
- this.sensitiveDefault);
- }
-
- public void setSensitive(Boolean sensitive) {
- this.sensitive = sensitive;
- }
-
}
diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Endpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Endpoint.java
index d25791d763d..3c2647ba3fd 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Endpoint.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/Endpoint.java
@@ -42,13 +42,6 @@ public interface Endpoint {
*/
boolean isEnabled();
- /**
- * Return if the endpoint is sensitive, i.e. may return data that the average user
- * should not see. Mappings can use this as a security hint.
- * @return if the endpoint is sensitive
- */
- boolean isSensitive();
-
/**
* Called to invoke the endpoint.
* @return the results of the invocation
diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EndpointProperties.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EndpointProperties.java
index ae722967859..1c09a4928d9 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EndpointProperties.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/EndpointProperties.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors.
+ * Copyright 2012-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.
@@ -30,18 +30,11 @@ public class EndpointProperties {
private static final String ENDPOINTS_ENABLED_PROPERTY = "endpoints.enabled";
- private static final String ENDPOINTS_SENSITIVE_PROPERTY = "endpoints.sensitive";
-
/**
* Enable endpoints.
*/
private Boolean enabled = true;
- /**
- * Default endpoint sensitive setting.
- */
- private Boolean sensitive;
-
public Boolean getEnabled() {
return this.enabled;
}
@@ -50,14 +43,6 @@ public class EndpointProperties {
this.enabled = enabled;
}
- public Boolean getSensitive() {
- return this.sensitive;
- }
-
- public void setSensitive(Boolean sensitive) {
- this.sensitive = sensitive;
- }
-
/**
* Determine if an endpoint is enabled based on its specific property and taking into
* account the global default.
@@ -76,25 +61,4 @@ public class EndpointProperties {
return true;
}
- /**
- * Determine if an endpoint is sensitive based on its specific property and taking
- * into account the global default.
- * @param environment the Spring environment or {@code null}.
- * @param sensitive the endpoint property or {@code null}
- * @param sensitiveDefault the default setting to use if no environment property is
- * defined
- * @return if the endpoint is sensitive
- */
- public static boolean isSensitive(Environment environment, Boolean sensitive,
- boolean sensitiveDefault) {
- if (sensitive != null) {
- return sensitive;
- }
- if (environment != null
- && environment.containsProperty(ENDPOINTS_SENSITIVE_PROPERTY)) {
- return environment.getProperty(ENDPOINTS_SENSITIVE_PROPERTY, Boolean.class);
- }
- return sensitiveDefault;
- }
-
}
diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java
index 5c6b621e4c0..3a62ed7801c 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/HealthEndpoint.java
@@ -49,7 +49,7 @@ public class HealthEndpoint extends AbstractEndpoint {
*/
public HealthEndpoint(HealthAggregator healthAggregator,
Map healthIndicators) {
- super("health", false);
+ super("health");
Assert.notNull(healthAggregator, "HealthAggregator must not be null");
Assert.notNull(healthIndicators, "HealthIndicators must not be null");
CompositeHealthIndicator healthIndicator = new CompositeHealthIndicator(
diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java
index 7c38b68d774..40cef3f38b5 100644
--- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java
+++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/InfoEndpoint.java
@@ -41,7 +41,7 @@ public class InfoEndpoint extends AbstractEndpoint