|
|
|
@ -5,13 +5,10 @@ import cn.hutool.json.JSONObject;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import cn.hutool.jwt.JWT;
|
|
|
|
|
import cn.hutool.jwt.JWTUtil;
|
|
|
|
|
import com.supervision.domain.UserInfo;
|
|
|
|
|
import com.supervision.exception.BusinessException;
|
|
|
|
|
import com.supervision.util.SpringBeanUtil;
|
|
|
|
|
import com.supervision.util.TokenUtil;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
|
import org.springframework.http.HttpStatus;
|
|
|
|
|
import org.springframework.web.servlet.HandlerInterceptor;
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
@ -34,7 +31,7 @@ public class JwtInterceptor implements HandlerInterceptor {
|
|
|
|
|
if (StrUtil.isNotBlank(request.getHeader("Knife4j-Gateway-Code"))){
|
|
|
|
|
token = devActiveUser();
|
|
|
|
|
}else {
|
|
|
|
|
throw new BusinessException("当前用户未登录");
|
|
|
|
|
throw new BusinessException("当前用户未登录",HttpStatus.UNAUTHORIZED.value());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -59,7 +56,7 @@ public class JwtInterceptor implements HandlerInterceptor {
|
|
|
|
|
// 校验是否比当前时间大
|
|
|
|
|
long currentTimeMillis = System.currentTimeMillis();
|
|
|
|
|
if (currentTimeMillis > l) {
|
|
|
|
|
throw new BusinessException("用户登录已过期,请重新登录");
|
|
|
|
|
throw new BusinessException("用户登录已过期,请重新登录",HttpStatus.UNAUTHORIZED.value());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|