From 5d5b88deb966230359bdb7ea756c61d8245850b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=ED=95=9C=EA=B4=80=ED=9D=AC?= <85067003+limehee@users.noreply.github.com> Date: Tue, 18 Jun 2024 16:01:07 +0900 Subject: [PATCH] =?UTF-8?q?refactor(IpAuthenticationFilter):=20=EC=A0=91?= =?UTF-8?q?=EA=B7=BC=20=ED=97=88=EC=9A=A9=20=EA=B5=AD=EA=B0=80=EB=A5=BC=20?= =?UTF-8?q?=ED=94=84=EB=A1=9C=ED=8C=8C=EC=9D=BC=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20(#379)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/global/auth/filter/IpAuthenticationFilter.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/page/clab/api/global/auth/filter/IpAuthenticationFilter.java b/src/main/java/page/clab/api/global/auth/filter/IpAuthenticationFilter.java index 055b7e08d..7b76e9eff 100644 --- a/src/main/java/page/clab/api/global/auth/filter/IpAuthenticationFilter.java +++ b/src/main/java/page/clab/api/global/auth/filter/IpAuthenticationFilter.java @@ -9,11 +9,13 @@ import jakarta.servlet.ServletRequest; import jakarta.servlet.ServletResponse; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import page.clab.api.global.config.IPInfoConfig; import page.clab.api.global.util.HttpReqResUtil; import java.io.IOException; +import java.util.List; import java.util.Objects; @Component @@ -22,6 +24,9 @@ public class IpAuthenticationFilter implements Filter { private final IPinfo ipInfo; + @Value("${security.access.allowed-countries}") + private List allowedCountries; + public IpAuthenticationFilter(IPInfoConfig ipInfoConfig) { ipInfo = ipInfoConfig.ipInfo(); } @@ -48,7 +53,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha private boolean isNonPermittedCountry(IPResponse ipResponse) { String country = ipResponse.getCountryCode(); - return Objects.nonNull(country) && !country.equals("KR"); + return Objects.nonNull(country) && !allowedCountries.contains(country); } @Override