1212import org .springframework .security .authentication .UsernamePasswordAuthenticationToken ;
1313import org .springframework .security .core .context .SecurityContextHolder ;
1414import org .springframework .security .web .authentication .WebAuthenticationDetailsSource ;
15+ import org .springframework .util .AntPathMatcher ;
1516import org .springframework .web .filter .OncePerRequestFilter ;
1617import org .springframework .web .util .ContentCachingRequestWrapper ;
1718
1819import java .io .IOException ;
1920import java .nio .charset .StandardCharsets ;
2021import 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 ;
2325import 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