Skip to content

Commit

Permalink
Enabled health check endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
dapolach committed Sep 18, 2024
1 parent f6be3af commit 7efdc04
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
14 changes: 14 additions & 0 deletions backend/actuator.http
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
### List of available actuator endpoints
GET {{host}}/actuator
Accept: application/json
Authorization: Bearer {{$auth.token("frontend")}}

### Healthcheck endpoint (public)
GET {{host}}/actuator/health
Accept: application/json

### List of loggers and their settings
GET {{host}}/actuator/loggers
Accept: application/json
Authorization: Bearer {{$auth.token("frontend")}}

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package club.klabis.config.security;

import club.klabis.config.authserver.AuthorizationServerConfiguration;
import org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.web.SecurityFilterChain;

@Configuration
public class ActuatorSecurity {
@Bean("actuatorSecurityFilterChain")
@Order(value = AuthorizationServerConfiguration.BEFORE_AUTH_SERVER_SECURITY_ORDER)
public SecurityFilterChain errorPageFilterChain(HttpSecurity http) throws Exception {
http.securityMatcher(EndpointRequest.to("health"))
.csrf(AbstractHttpConfigurer::disable)
.authorizeHttpRequests(
c -> c.anyRequest().permitAll()
);

return http.build();
}
}
5 changes: 4 additions & 1 deletion backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,14 @@ management:
endpoint:
loggers:
enabled: true
health:
probes:
enabled: true
endpoints:
web:
exposure:
#include: loggers, caches, configprops, env, flyway, httpexchanges, info, mappings, scheduledtasks
include: loggers, caches, env, info, mappings
include: loggers, caches, env, info, mappings, health

springdoc:
swagger-ui:
Expand Down

0 comments on commit 7efdc04

Please sign in to comment.