Skip to content

Commit

Permalink
Merge pull request #225 from swm-standard/seyeon/swm-180
Browse files Browse the repository at this point in the history
HOTFIX: health check 용 api 구현
  • Loading branch information
adorableco authored Sep 21, 2024
2 parents 81942ec + 366e8f6 commit 8157aa6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -156,3 +156,4 @@ application.properties
.gradle
build
resources
/newrelic/newrelic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ class JwtAuthenticationFilter(
chain: FilterChain?,
) {
val accessToken = resolveToken(request as HttpServletRequest)
if (accessToken != null &&
jwtTokenProvider.validateToken(accessToken) &&
request.getHeader("userAgent")?.contains("ELB-HealthChecker/2.0") == false

if (accessToken != null && jwtTokenProvider.validateToken(accessToken)
) {
val authentication = jwtTokenProvider.getAuthentication(accessToken)
SecurityContextHolder.getContext().authentication = authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SecurityConfig(
.sessionManagement { it.sessionCreationPolicy(SessionCreationPolicy.STATELESS) }
.authorizeHttpRequests {
it
.requestMatchers("/api/auth/*")
.requestMatchers("/api/auth/*", "/")
.anonymous()
.requestMatchers("/v3/**", "/swagger-ui/**", "api/token")
.permitAll()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.swm_standard.phote.controller

import com.swm_standard.phote.common.responsebody.BaseResponse
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController

@RestController
class HealthCheckController {
@GetMapping("/")
fun healthCheck(): BaseResponse<String> = BaseResponse(data = "정상 작동 중")
}

0 comments on commit 8157aa6

Please sign in to comment.