[英]Spring Boot Actuator - enable single endpoint
There's a difference in implementation between two versions of Spring Boot Actuator (1.2.5 and 1.3.0) in HealthMvcEndpoint, isUnrestricted() method ( && and || ). HealthMvcEndpoint 中两个版本的 Spring Boot Actuator(1.2.5 和 1.3.0)的实现存在差异,isUnrestricted() 方法( && 和 || )。 I understand that this is to preserve these restrictions
我了解这是为了保留这些限制
http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#production-ready-health-access-restrictions http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#production-ready-health-access-restrictions
But is there any solution now to enable only one endpoint (eg Health) unrestricted with full content, without exposing all the others?但是现在是否有任何解决方案可以仅启用一个端点(例如 Health)不受全部内容限制,而不会暴露所有其他端点? Disabling management.security.enabled is just making all the endpoints accessible without authentication (?) - it doesn't look like it's taking endpoint sensitivity with it.
禁用 management.security.enabled 只是使所有端点无需身份验证(?)即可访问 - 它看起来不像是对端点敏感。
I managed to partially solve this by making all the endpoints disabled in the first place by endpoints.enabled = false
with disabling their security management.security.enabled = false
我设法通过首先通过
endpoints.enabled = false
禁用所有端点并禁用它们的安全management.security.enabled = false
来部分解决这个问题
and enabled the ones I wanted without security - like the Health endpoint endpoints.health.enabled = true
and endpoints.health.sensitive = false
.并在没有安全性的情况下启用我想要的那些 - 比如 Health 端点
endpoints.health.enabled = true
和endpoints.health.sensitive = false
。
With actuator 2 these properties have been changed使用执行器 2,这些属性已更改
To disable all the actuator endpoints use要禁用所有执行器端点,请使用
management.endpoints.enabled-by-default=false
To enable specific endpoint use management.endpoint.<id>.enabled
property.要启用特定端点,请使用
management.endpoint.<id>.enabled
属性。 The following example enables the shutdown endpoint:以下示例启用关闭端点:
management.endpoint.shutdown.enabled=true
Official Documentation官方文档
https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.