dromara/Sa-Token

jwt模式无效token没有抛出token无效的异常

wang1784594241 opened this issue · 1 comments

使用版本:

1.38.0

报错信息:

cn.hutool.json.JSONException: A JSONObject text must begin with '{' at 1 [character 2 line 1] at cn.hutool.json.JSONTokener.syntaxError(JSONTokener.java:450) at cn.hutool.json.JSONParser.parseTo(JSONParser.java:48) at cn.hutool.json.ObjectMapper.mapFromTokener(ObjectMapper.java:243) at cn.hutool.json.ObjectMapper.mapFromStr(ObjectMapper.java:219) at cn.hutool.json.ObjectMapper.map(ObjectMapper.java:98) at cn.hutool.json.JSONObject.<init>(JSONObject.java:210) at cn.hutool.json.JSONObject.<init>(JSONObject.java:187) at cn.hutool.json.JSONUtil.parseObj(JSONUtil.java:112) at cn.hutool.jwt.Claims.parse(Claims.java:86) at cn.hutool.jwt.JWT.parse(JWT.java:98) at cn.hutool.jwt.JWT.<init>(JWT.java:85) at cn.hutool.jwt.JWT.of(JWT.java:66) at cn.dev33.satoken.jwt.SaJwtTemplate.parseToken(SaJwtTemplate.java:183) at cn.dev33.satoken.jwt.SaJwtTemplate.getPayloads(SaJwtTemplate.java:222) at cn.dev33.satoken.jwt.SaJwtTemplate.getLoginId(SaJwtTemplate.java:244) at cn.dev33.satoken.jwt.SaJwtUtil.getLoginId(SaJwtUtil.java:173) at cn.dev33.satoken.jwt.StpLogicJwtForStateless.getLoginIdNotHandle(StpLogicJwtForStateless.java:133) at cn.dev33.satoken.stp.StpLogic.getLoginId(StpLogic.java:945) at cn.dev33.satoken.stp.StpLogic.checkLogin(StpLogic.java:923) at cn.dev33.satoken.stp.StpUtil.checkLogin(StpUtil.java:331) at com.fem.yzhz.common.config.SaTokenConfigure.lambda$addInterceptors$0(SaTokenConfigure.java:43) at cn.dev33.satoken.interceptor.SaInterceptor.preHandle(SaInterceptor.java:113) at org.springframework.web.servlet.HandlerExecutionChain.applyPreHandle(HandlerExecutionChain.java:151) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1035) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:898) at javax.servlet.http.HttpServlet.service(HttpServlet.java:626) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883) at javax.servlet.http.HttpServlet.service(HttpServlet.java:733) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) at cn.dev33.satoken.filter.SaPathCheckFilterForServlet.doFilter(SaPathCheckFilterForServlet.java:55)

希望结果:

按token无效处理

复现步骤:

token值前面加个1去调接口