Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
SWAGGER_ENDPOINTS
).flatMap(Arrays::stream).toArray(String[]::new);

public static final String[] ANONYMOUS_ENDPOINTS = {LOGIN_ENDPOINT, REISSUANCE_ENDPOINT, PASSWORD_EMAIL_ENDPOINT};
public static final String[] ANONYMOUS_ENDPOINTS = {LOGIN_ENDPOINT, PASSWORD_EMAIL_ENDPOINT};

@Override
protected void doFilterInternal(
Expand All @@ -58,7 +58,6 @@ protected void doFilterInternal(
@NotNull FilterChain filterChain
) throws ServletException, IOException {
try {

if (isAnonymousRequest(request)) {
filterChain.doFilter(request, response);
return;
Expand All @@ -76,10 +75,11 @@ protected void doFilterInternal(
}

private boolean isAnonymousRequest(HttpServletRequest request) {
String requestUri = request.getRequestURI();
boolean isAnonymousURI = Arrays.stream(ANONYMOUS_ENDPOINTS)
.anyMatch(endpoint -> new AntPathMatcher().match(endpoint, request.getRequestURI()));
.anyMatch(endpoint -> new AntPathMatcher().match(endpoint, requestUri));
boolean isAnonymous = request.getHeader(HttpHeaders.AUTHORIZATION) == null;
return isAnonymousURI && isAnonymous;
return (isAnonymousURI && isAnonymous) || requestUri.equals(REISSUANCE_ENDPOINT);
}

@Override
Expand Down