Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HOTFIX: health check 용 api 구현 #225

Merged
merged 2 commits into from
Sep 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 = "정상 작동 중")
}
Loading