Skip to content

Commit

Permalink
V0.30.6 - enable info/health endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Aidan Whiteley committed Oct 14, 2023
1 parent 9f20ec9 commit ac66351
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.aidanwhiteley</groupId>
<artifactId>books</artifactId>
<version>0.30.4-RELEASE</version>
<version>0.30.6-RELEASE</version>
<packaging>jar</packaging>

<name>Books Microservice</name>
Expand Down Expand Up @@ -66,10 +66,10 @@
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-oauth2-jose</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest;
import org.springframework.boot.actuate.health.Health;
import org.springframework.boot.actuate.health.HealthEndpoint;
import org.springframework.boot.actuate.info.Info;
import org.springframework.boot.actuate.info.InfoEndpoint;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
Expand Down Expand Up @@ -145,7 +149,8 @@ public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Excepti
.authorizeHttpRequests(authz ->
authz
// Make sure Actuator endpoints are protected
.requestMatchers(EndpointRequest.toAnyEndpoint()).hasRole(ROLE_ACTUATOR.getShortName())
.requestMatchers(EndpointRequest.toAnyEndpoint().excluding(HealthEndpoint.class).excluding(InfoEndpoint.class)).
hasRole(ROLE_ACTUATOR.getShortName())
// We permitAll here (getting us back to the Spring Boot 2 default) as we have method level security
// applied rather than request level
.anyRequest().permitAll()
Expand Down
5 changes: 3 additions & 2 deletions src/main/resources/application-cloudy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ eureka:
management:
endpoints:
enabled-by-default: ${CLOUDY_ACTUATOR_ENABLED:false}
health:
show-details: ${CLOUDY_ACTUATOR_HEALTH_SHOW_DETAILS:false}
web:
exposure:
# Exposing only read only items and not large data amounts - so no heapdump, threaddump or shutdown. No project use of flyway, integrationgraph, liquibase, prometheus
include: auditevents, beans, caches, conditions, configprops, env, health, httptrace, info, jolokia, logfile, loggers, metrics, mappings, scheduledtasks, sessions
include: ${CLOUDY_ACTUATOR_ENDPOINTS:health, info}
info:
git:
mode: full
Expand Down

0 comments on commit ac66351

Please sign in to comment.