feat: 일반 유저용 캔 리스트 조회 API 추가, GeoCountryFilter(GeoCountry.OTHER, GeoCountry.KR 구분용) 추가

This commit is contained in:
2025-10-01 22:29:39 +09:00
parent 3d852a8356
commit e45fe1bf10
5 changed files with 63 additions and 4 deletions

View File

@@ -0,0 +1,8 @@
package kr.co.vividnext.sodalive.common
const val WAF_GEO_HEADER = "x-amzn-waf-geo-country"
enum class GeoCountry { KR, OTHER }
fun parseGeo(headerValue: String?): GeoCountry =
if (headerValue?.trim()?.uppercase() == "KR") GeoCountry.KR else GeoCountry.OTHER

View File

@@ -0,0 +1,20 @@
package kr.co.vividnext.sodalive.common
import org.springframework.stereotype.Component
import org.springframework.web.filter.OncePerRequestFilter
import javax.servlet.FilterChain
import javax.servlet.http.HttpServletRequest
import javax.servlet.http.HttpServletResponse
@Component
class GeoCountryFilter : OncePerRequestFilter() {
override fun doFilterInternal(
request: HttpServletRequest,
response: HttpServletResponse,
filterChain: FilterChain
) {
val country = parseGeo(request.getHeader(WAF_GEO_HEADER))
request.setAttribute("geoCountry", country)
filterChain.doFilter(request, response)
}
}