Refined actuator endpoint security rules:
- Allowed public access to `/actuator/health`. - Enforced authentication for other `/actuator/**` endpoints in production. - Allowed all `/actuator/**` endpoints in development.
This commit is contained in:
parent
f62cfbfb66
commit
f7efc9eb81
2 changed files with 5 additions and 1 deletions
|
|
@ -70,6 +70,8 @@ public class SecurityConfig {
|
||||||
.cors(cors -> cors.configurationSource(prodCorsConfigurationSource())) // Production CORS
|
.cors(cors -> cors.configurationSource(prodCorsConfigurationSource())) // Production CORS
|
||||||
.authorizeHttpRequests(auth -> auth
|
.authorizeHttpRequests(auth -> auth
|
||||||
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||||
|
.requestMatchers("/actuator/health").permitAll()
|
||||||
|
.requestMatchers("/actuator/**").authenticated()
|
||||||
.requestMatchers("/oauth2/token").permitAll()
|
.requestMatchers("/oauth2/token").permitAll()
|
||||||
.requestMatchers("/api/**").authenticated()
|
.requestMatchers("/api/**").authenticated()
|
||||||
.requestMatchers("/api/dev/**").denyAll()
|
.requestMatchers("/api/dev/**").denyAll()
|
||||||
|
|
@ -174,6 +176,8 @@ public class SecurityConfig {
|
||||||
.cors(cors -> cors.configurationSource(devCorsConfigurationSource())) // Dev CORS
|
.cors(cors -> cors.configurationSource(devCorsConfigurationSource())) // Dev CORS
|
||||||
.authorizeHttpRequests(auth -> auth
|
.authorizeHttpRequests(auth -> auth
|
||||||
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
.requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
|
||||||
|
.requestMatchers("/actuator/health").permitAll()
|
||||||
|
.requestMatchers("/actuator/**").permitAll()
|
||||||
.requestMatchers("/oauth2/token").permitAll()
|
.requestMatchers("/oauth2/token").permitAll()
|
||||||
.requestMatchers("/api/**").permitAll()
|
.requestMatchers("/api/**").permitAll()
|
||||||
.requestMatchers("/api/dev/**").permitAll()
|
.requestMatchers("/api/dev/**").permitAll()
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ spring.cloud.azure.active-directory.authorization-clients.graph.scopes=openid,pr
|
||||||
|
|
||||||
# Management Endpoints
|
# Management Endpoints
|
||||||
management.endpoints.web.exposure.include=health,info,metrics
|
management.endpoints.web.exposure.include=health,info,metrics
|
||||||
management.endpoint.health.show-details=always
|
management.endpoint.health.show-details=when-authorized
|
||||||
|
|
||||||
# Flyway Migration
|
# Flyway Migration
|
||||||
spring.flyway.enabled=true
|
spring.flyway.enabled=true
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue