Skip to content

Commit 15d3c64

Browse files
committed
feat: health-check api
1 parent 7fc5ba6 commit 15d3c64

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/main/java/land/leets/domain/auth/presentation/AuthController.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212
import land.leets.global.jwt.JwtProvider;
1313
import land.leets.global.jwt.dto.JwtResponse;
1414
import lombok.RequiredArgsConstructor;
15-
import lombok.extern.slf4j.Slf4j;
16-
import org.springframework.web.bind.annotation.*;
15+
import org.springframework.http.HttpStatus;
16+
import org.springframework.http.ResponseEntity;
17+
import org.springframework.web.bind.annotation.GetMapping;
18+
import org.springframework.web.bind.annotation.RequestParam;
19+
import org.springframework.web.bind.annotation.RestController;
1720

1821
import java.io.IOException;
1922
import java.security.GeneralSecurityException;
2023

2124
@RestController
2225
@RequiredArgsConstructor
23-
@Slf4j
2426
public class AuthController {
2527
private final AuthService authService;
2628
private final JwtProvider jwtProvider;
@@ -40,4 +42,9 @@ public JwtResponse get(@RequestParam("code") String code) throws GeneralSecurity
4042

4143
return new JwtResponse(accessToken, refreshToken);
4244
}
45+
46+
@GetMapping("/health-check")
47+
public ResponseEntity<Void> checkHealthStatus() {
48+
return new ResponseEntity<>(HttpStatus.OK);
49+
}
4350
}

src/main/java/land/leets/global/config/SecurityConfig.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
5151
http
5252
.authorizeHttpRequests()
5353
.requestMatchers(CorsUtils::isCorsRequest).permitAll()
54+
55+
.requestMatchers(HttpMethod.GET,"/health-check").permitAll()
56+
5457
.requestMatchers("/v3/api-docs/**", "/swagger-ui/**").permitAll()
5558

5659
.requestMatchers("/oauth2/**", "/auth/**").permitAll()
@@ -71,6 +74,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
7174
.requestMatchers(HttpMethod.GET,"/application/**").hasAuthority(AuthRole.ROLE_ADMIN.getRole())
7275
.requestMatchers(HttpMethod.PATCH,"/application/**").hasAuthority(AuthRole.ROLE_ADMIN.getRole())
7376

77+
.requestMatchers(HttpMethod.GET,"/interview").permitAll()
78+
.requestMatchers(HttpMethod.PATCH,"/interview/**").hasAuthority(AuthRole.ROLE_ADMIN.getRole())
79+
7480
.requestMatchers(HttpMethod.POST,"/mail/**").hasAuthority(AuthRole.ROLE_ADMIN.getRole())
7581

7682
.anyRequest().authenticated();

0 commit comments

Comments
 (0)