update #5
3 changed files with 6 additions and 12 deletions
|
@ -159,7 +159,7 @@ public class UserAuthenticationFilter extends OncePerRequestFilter {
|
|||
};
|
||||
|
||||
for (String pattern : permitAllPatterns) {
|
||||
if (uri.startsWith(pattern) || uri.endsWith(".svg")) {
|
||||
if (uri.startsWith(pattern) || uri.endsWith(".svg") || uri.endsWith(".png") || uri.endsWith(".ico")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,16 +4,7 @@ public class RequestUriUtils {
|
|||
|
||||
public static boolean isStaticResource(String requestURI) {
|
||||
|
||||
return requestURI.startsWith("/css/")
|
||||
|| requestURI.startsWith("/fonts/")
|
||||
|| requestURI.startsWith("/js/")
|
||||
|| requestURI.startsWith("/images/")
|
||||
|| requestURI.startsWith("/public/")
|
||||
|| requestURI.startsWith("/pdfjs/")
|
||||
|| requestURI.startsWith("/pdfjs-legacy/")
|
||||
|| requestURI.endsWith(".svg")
|
||||
|| requestURI.endsWith(".webmanifest")
|
||||
|| requestURI.startsWith("/api/v1/info/status");
|
||||
return isStaticResource("", requestURI);
|
||||
}
|
||||
|
||||
public static boolean isStaticResource(String contextPath, String requestURI) {
|
||||
|
@ -24,7 +15,10 @@ public class RequestUriUtils {
|
|||
|| requestURI.startsWith(contextPath + "/images/")
|
||||
|| requestURI.startsWith(contextPath + "/public/")
|
||||
|| requestURI.startsWith(contextPath + "/pdfjs/")
|
||||
|| requestURI.startsWith(contextPath + "/login")
|
||||
|| requestURI.endsWith(".svg")
|
||||
|| requestURI.endsWith(".png")
|
||||
|| requestURI.endsWith(".ico")
|
||||
|| requestURI.endsWith(".webmanifest")
|
||||
|| requestURI.startsWith(contextPath + "/api/v1/info/status");
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ public class RequestUriUtilsTest {
|
|||
assertFalse(RequestUriUtils.isStaticResource("/api/v1/users"));
|
||||
assertFalse(RequestUriUtils.isStaticResource("/api/v1/orders"));
|
||||
assertFalse(RequestUriUtils.isStaticResource("/"));
|
||||
assertFalse(RequestUriUtils.isStaticResource("/login"));
|
||||
assertTrue(RequestUriUtils.isStaticResource("/login"));
|
||||
assertFalse(RequestUriUtils.isStaticResource("/register"));
|
||||
assertFalse(RequestUriUtils.isStaticResource("/api/v1/products"));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue