Skip to content

Commit dbc6029

Browse files
committed
CLAP-425 Fix: 비밀번호 재설정 경로에도 잠금 계정 여부를 확인하도록 수정
<footer> - #554
1 parent 1ade25a commit dbc6029

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/main/java/clap/server/adapter/inbound/security/WebSecurityUrl.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ private WebSecurityUrl() {
1515
public static final String REISSUANCE_ENDPOINT = "/api/auths/reissuance";
1616
public static final String PASSWORD_EMAIL_ENDPOINT = "/api/new-password";
1717
public static final String TEMPORARY_TOKEN_ALLOWED_ENDPOINT = "/api/members/initial-password";
18+
public static final String[] ANONYMOUS_ENDPOINTS = {LOGIN_ENDPOINT, PASSWORD_EMAIL_ENDPOINT};
1819
}

src/main/java/clap/server/adapter/inbound/security/filter/JwtAuthenticationFilter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
4949
SWAGGER_ENDPOINTS
5050
).flatMap(Arrays::stream).toArray(String[]::new);
5151

52-
public static final String[] ANONYMOUS_ENDPOINTS = {LOGIN_ENDPOINT, PASSWORD_EMAIL_ENDPOINT};
53-
5452
@Override
5553
protected void doFilterInternal(
5654
@NotNull HttpServletRequest request,

src/main/java/clap/server/adapter/inbound/security/filter/LoginAttemptFilter.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@
1212
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
1313
import org.springframework.security.core.context.SecurityContextHolder;
1414
import org.springframework.security.web.authentication.WebAuthenticationDetailsSource;
15+
import org.springframework.util.AntPathMatcher;
1516
import org.springframework.web.filter.OncePerRequestFilter;
1617
import org.springframework.web.util.ContentCachingRequestWrapper;
1718

1819
import java.io.IOException;
1920
import java.nio.charset.StandardCharsets;
2021
import java.util.ArrayList;
22+
import java.util.Arrays;
2123

22-
import static clap.server.adapter.inbound.security.WebSecurityUrl.LOGIN_ENDPOINT;
24+
import static clap.server.adapter.inbound.security.WebSecurityUrl.ANONYMOUS_ENDPOINTS;
2325
import static clap.server.common.utils.ClientIpParseUtil.getClientIp;
2426

2527

@@ -33,10 +35,10 @@ public class LoginAttemptFilter extends OncePerRequestFilter {
3335
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)
3436
throws ServletException, IOException {
3537
try {
36-
if (request.getRequestURI().equals(LOGIN_ENDPOINT)) {
38+
if (Arrays.stream(ANONYMOUS_ENDPOINTS)
39+
.anyMatch(endpoint -> new AntPathMatcher().match(endpoint, request.getRequestURI()))) {
3740
String nickname = request.getParameter("nickname");
3841
checkAccountLockStatusUseCase.checkAccountIsLocked(nickname);
39-
4042
}
4143
} catch (AuthException e) {
4244
log.warn("Authentication failed for IP: {}. Error: {}", getClientIp(request), e.getMessage());

0 commit comments

Comments
 (0)