|
|
@@ -116,20 +116,19 @@ public class JwtAuthFilter extends OncePerRequestFilter {
|
|
|
}finally {
|
|
|
MDC.clear();
|
|
|
}
|
|
|
-}
|
|
|
+ }
|
|
|
|
|
|
-private boolean isPublicPath(String uri) {
|
|
|
- for (String prefix : PUBLIC_PREFIXES) {
|
|
|
- if (uri.startsWith(prefix)) {
|
|
|
- return true;
|
|
|
+ private boolean isPublicPath(String uri) {
|
|
|
+ for (String prefix : PUBLIC_PREFIXES) {
|
|
|
+ if (uri.startsWith(prefix)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
+ return "/".equals(uri) || uri.endsWith(".html") || uri.endsWith(".js") || uri.endsWith(".css");
|
|
|
+ }
|
|
|
+ private void send401(HttpServletResponse response, String msg) throws IOException {
|
|
|
+ response.setStatus(401);
|
|
|
+ response.setContentType("application/json;charset=UTF-8");
|
|
|
+ response.getWriter().write("{\"error\":\"" + msg + "\",\"code\":401}");
|
|
|
}
|
|
|
- return "/".equals(uri) || uri.endsWith(".html") || uri.endsWith(".js") || uri.endsWith(".css");
|
|
|
-}
|
|
|
-
|
|
|
-private void send401(HttpServletResponse response, String msg) throws IOException {
|
|
|
- response.setStatus(401);
|
|
|
- response.setContentType("application/json;charset=UTF-8");
|
|
|
- response.getWriter().write("{\"error\":\"" + msg + "\",\"code\":401}");
|
|
|
-}
|
|
|
}
|