|
|
|
@ -5,6 +5,7 @@ import com.zdxt.knowledge.domain.JwtProperties; |
|
|
|
import com.zdxt.knowledge.domain.WechatUser; |
|
|
|
import com.zdxt.knowledge.mapper.WechatLoginMapper; |
|
|
|
import io.jsonwebtoken.Claims; |
|
|
|
import io.jsonwebtoken.ExpiredJwtException; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
@ -63,6 +64,10 @@ public class JwtTokenUserInterceptor implements HandlerInterceptor { |
|
|
|
return true; |
|
|
|
} |
|
|
|
return false; |
|
|
|
} catch (ExpiredJwtException e) { |
|
|
|
//4、不通过,响应401状态码
|
|
|
|
response.setStatus(402); |
|
|
|
throw new RuntimeException("token过期"); |
|
|
|
}catch (Exception ex) { |
|
|
|
//4、不通过,响应401状态码
|
|
|
|
response.setStatus(401); |
|
|
|
|