liuchengsen vor 1 Monat
Ursprung
Commit
fc82da59f1

+ 6 - 3
backend-java/src/main/java/com/pharmacopoeia/security/JwtAuthFilter.java

@@ -5,6 +5,7 @@ import jakarta.servlet.FilterChain;
 import jakarta.servlet.ServletException;
 import jakarta.servlet.http.HttpServletRequest;
 import jakarta.servlet.http.HttpServletResponse;
+import org.jetbrains.annotations.NotNull;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
@@ -39,8 +40,8 @@ public class JwtAuthFilter extends OncePerRequestFilter {
 
     @Override
     protected void doFilterInternal(HttpServletRequest request,
-                                    HttpServletResponse response,
-                                    FilterChain filterChain) throws ServletException, IOException {
+                                    @NotNull HttpServletResponse response,
+                                    @NotNull FilterChain filterChain) throws ServletException, IOException {
         String uri = request.getRequestURI();
         String method = request.getMethod();
 
@@ -85,7 +86,9 @@ public class JwtAuthFilter extends OncePerRequestFilter {
 
     private boolean isPublicPath(String uri) {
         for (String prefix : PUBLIC_PREFIXES) {
-            if (uri.startsWith(prefix)) return true;
+            if (uri.startsWith(prefix)) {
+                return true;
+            }
         }
         return "/".equals(uri) || uri.endsWith(".html") || uri.endsWith(".js") || uri.endsWith(".css");
     }