We are using token-based authentication (with Spring Security) in our Spring Boot 2 application. Now I'm introducing Spring Boot Actuator to it. I would like to configure the /health
endpoint to be visible without any permissions but to show health checks details only when authorized.
I found the property management.endpoint.health.show-details=when_authorized
which should be helpful but now I'm fighting with the Spring Security configuration to allow everybody to see:
{
"status": "UP"
}
under /actuator/health
while users authorized with token should see:
{
"status": "UP",
"details": { ... }
}
Did you face a similar problem? How did you handle it?
management.endpoint.health.show-details=when_authorized
is set and I'm turning on authentication for this endpoint then I see the details. But I cannot enter without authentication. When I turn off auth for the endpoint and thewhen_authorized
is set, I do not see details. So the param is working correctly. But I cannot figure out how to set/actuator/health
endpoint to be available both with and without authentication... – Piotr Pradzynski