Allow /health and /info to authenticate anonymously
Then we can optionally find a non-anonymous principal if there is one. If the user is anonymous then the health result is cached up to endpoints.health.ttl (default 1000ms) to prevent a DOS attack. Fixes gh-1353
This commit is contained in:
@@ -17,6 +17,8 @@
|
||||
package sample.actuator;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.actuate.health.Health;
|
||||
import org.springframework.boot.actuate.health.HealthIndicator;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
@@ -26,10 +28,15 @@ import org.springframework.context.annotation.Configuration;
|
||||
@EnableAutoConfiguration
|
||||
@EnableConfigurationProperties
|
||||
@ComponentScan
|
||||
public class SampleActuatorApplication {
|
||||
public class SampleActuatorApplication implements HealthIndicator {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
SpringApplication.run(SampleActuatorApplication.class, args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Health health() {
|
||||
return Health.up().withDetail("hello", "world").build();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user