diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java index d0e0aeda9d..2e81b96b5d 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/DocsMvcEndpoint.java @@ -36,6 +36,14 @@ public class DocsMvcEndpoint extends WebMvcConfigurerAdapter implements MvcEndpo private String path = "/docs"; + /** + * Enable the endpoint. + */ + private boolean enabled = true; + + /** + * Mark if the endpoint exposes sensitive information. + */ private boolean sensitive; private final ManagementServletContext managementServletContext; @@ -78,8 +86,12 @@ public class DocsMvcEndpoint extends WebMvcConfigurerAdapter implements MvcEndpo return this.path; } - public void setSensitive(boolean sensitive) { - this.sensitive = sensitive; + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; } @Override @@ -87,6 +99,10 @@ public class DocsMvcEndpoint extends WebMvcConfigurerAdapter implements MvcEndpo return this.sensitive; } + public void setSensitive(boolean sensitive) { + this.sensitive = sensitive; + } + @Override public Class> getEndpointType() { return null; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpoint.java index 6eebdf66e3..ef9efa1741 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/HalJsonMvcEndpoint.java @@ -37,8 +37,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter * @since 1.3.0 */ @ConfigurationProperties("endpoints.actuator") -public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter - implements MvcEndpoint { +public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter implements MvcEndpoint { /** * Endpoint URL path. @@ -47,16 +46,16 @@ public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter @Pattern(regexp = "^$|/[^/]*", message = "Path must be empty or start with /") private String path; - /** - * Enable security on the endpoint. - */ - private boolean sensitive = false; - /** * Enable the endpoint. */ private boolean enabled = true; + /** + * Mark if the endpoint exposes sensitive information. + */ + private boolean sensitive = false; + private final ManagementServletContext managementServletContext; public HalJsonMvcEndpoint(ManagementServletContext managementServletContext) { @@ -86,6 +85,14 @@ public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter return this.path; } + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + @Override public boolean isSensitive() { return this.sensitive; @@ -95,14 +102,6 @@ public class HalJsonMvcEndpoint extends WebMvcConfigurerAdapter this.sensitive = sensitive; } - public boolean isEnabled() { - return this.enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - @Override public Class> getEndpointType() { return null; diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java index c3d2c269ba..653f6ddbed 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/JolokiaMvcEndpoint.java @@ -57,16 +57,16 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, @Pattern(regexp = "/[^?#]*", message = "Path must start with /") private String path = "/jolokia";; - /** - * Enable security on the endpoint. - */ - private boolean sensitive = true; - /** * Enable the endpoint. */ private boolean enabled = true; + /** + * Mark if the endpoint exposes sensitive information. + */ + private boolean sensitive = true; + private final ServletWrappingController controller = new ServletWrappingController(); public JolokiaMvcEndpoint() { @@ -102,15 +102,6 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, this.enabled = enabled; } - @Override - public String getPath() { - return this.path; - } - - public void setPath(String path) { - this.path = path; - } - @Override public boolean isSensitive() { return this.sensitive; @@ -120,6 +111,15 @@ public class JolokiaMvcEndpoint implements MvcEndpoint, InitializingBean, this.sensitive = sensitive; } + @Override + public String getPath() { + return this.path; + } + + public void setPath(String path) { + this.path = path; + } + @Override @SuppressWarnings("rawtypes") public Class getEndpointType() { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java index e5d884813c..8535cb498a 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/LogFileMvcEndpoint.java @@ -59,16 +59,16 @@ public class LogFileMvcEndpoint implements MvcEndpoint, EnvironmentAware { @Pattern(regexp = "/[^/]*", message = "Path must start with /") private String path = "/logfile"; - /** - * Enable security on the endpoint. - */ - private boolean sensitive = true; - /** * Enable the endpoint. */ private boolean enabled = true; + /** + * Mark if the endpoint exposes sensitive information. + */ + private boolean sensitive = true; + private Environment environment; @Override @@ -85,6 +85,14 @@ public class LogFileMvcEndpoint implements MvcEndpoint, EnvironmentAware { this.path = path; } + public boolean isEnabled() { + return this.enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + @Override public boolean isSensitive() { return this.sensitive; @@ -94,14 +102,6 @@ public class LogFileMvcEndpoint implements MvcEndpoint, EnvironmentAware { this.sensitive = sensitive; } - public boolean isEnabled() { - return this.enabled; - } - - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - @Override @SuppressWarnings("rawtypes") public Class getEndpointType() { diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ManagementErrorEndpoint.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ManagementErrorEndpoint.java index 87d5944642..597bcaa341 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ManagementErrorEndpoint.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/endpoint/mvc/ManagementErrorEndpoint.java @@ -67,4 +67,5 @@ public class ManagementErrorEndpoint implements MvcEndpoint { public Class getEndpointType() { return null; } + } diff --git a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 3aea98d03b..26db5bdd58 100644 --- a/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -17,24 +17,12 @@ "sourceType": "org.springframework.boot.actuate.endpoint.EnvironmentEndpoint", "description": "Keys that should be sanitized. Keys can be simple strings that the property ends with or regex expressions." }, - { - "name": "endpoints.docs.enabled", - "type": "java.lang.Boolean", - "description": "Enable actuator docs endpoint.", - "defaultValue": true - }, { "name": "endpoints.jmx.enabled", "type": "java.lang.Boolean", "description": "Enable JMX export of all endpoints.", "defaultValue": true }, - { - "name": "endpoints.jolokia.enabled", - "type": "java.lang.Boolean", - "description": "Enable Jolokia endpoint.", - "defaultValue": true - }, { "name": "info", "type": "java.util.Map",