diff --git a/foxogram-api/src/main/java/su/foxogram/interceptors/AuthenticationInterceptor.java b/foxogram-api/src/main/java/su/foxogram/interceptors/AuthenticationInterceptor.java index 6afdad5..8d0dd04 100644 --- a/foxogram-api/src/main/java/su/foxogram/interceptors/AuthenticationInterceptor.java +++ b/foxogram-api/src/main/java/su/foxogram/interceptors/AuthenticationInterceptor.java @@ -6,6 +6,7 @@ import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; import org.springframework.stereotype.Component; import org.springframework.web.servlet.HandlerInterceptor; import su.foxogram.constants.AttributesConstants; @@ -14,6 +15,7 @@ import su.foxogram.models.User; import su.foxogram.services.AuthenticationService; +import java.util.Objects; import java.util.Set; @Slf4j @@ -34,6 +36,8 @@ public AuthenticationInterceptor(AuthenticationService authenticationService) { @Override public boolean preHandle(HttpServletRequest request, @NotNull HttpServletResponse response, @NotNull Object handler) throws UserUnauthorizedException, UserEmailNotVerifiedException { + if (Objects.equals(request.getMethod(), HttpMethod.OPTIONS.name())) return true; + String requestURI = request.getRequestURI(); boolean ignoreEmailVerification = EMAIL_VERIFICATION_IGNORE_PATHS.stream().anyMatch(requestURI::contains);