|
@@ -4,8 +4,10 @@ import com.auth0.jwt.exceptions.TokenExpiredException;
|
|
|
import com.ynfy.app.api.v1.annoation.IgnoreAuth;
|
|
|
import com.ynfy.app.api.v1.util.TokenUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.jeecg.common.exception.JeecgBoot401Exception;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.util.JwtUtil;
|
|
|
+import org.jeecg.common.util.SpringContextUtils;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
import org.jeecg.modules.system.service.ISysUserService;
|
|
|
import org.springframework.stereotype.Component;
|
|
@@ -50,7 +52,8 @@ public class AuthorizationInterceptor implements HandlerInterceptor {
|
|
|
//获取token
|
|
|
String token = TokenUtil.getToken(request);
|
|
|
if (StringUtils.isBlank(token)) {
|
|
|
- throw new JeecgBootException("请先登录");
|
|
|
+ JwtUtil.responseError(SpringContextUtils.getHttpServletResponse(),401,"请先登录");
|
|
|
+ return false;
|
|
|
}
|
|
|
String userName = TokenUtil.getUserName(token);
|
|
|
|