| | |
| | | import com.zy.acs.framework.common.Cools; |
| | | import io.jsonwebtoken.Claims; |
| | | import io.jsonwebtoken.ExpiredJwtException; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| | | import org.springframework.security.core.context.SecurityContextHolder; |
| | | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| | |
| | | * 处理携带token的请求过滤器 |
| | | * |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class JwtAuthenticationFilter extends OncePerRequestFilter { |
| | | |
| | |
| | | } |
| | | } |
| | | } catch (ExpiredJwtException e) { |
| | | log.error("JwtAuthenticationFilter ExpiredJwtException", e); |
| | | CommonUtil.responseError(response, Constants.TOKEN_EXPIRED_CODE, Constants.TOKEN_EXPIRED_MSG, |
| | | e.getMessage()); |
| | | return; |
| | | } catch (Exception e) { |
| | | log.error("JwtAuthenticationFilter", e); |
| | | CommonUtil.responseError(response, Constants.BAD_CREDENTIALS_CODE, Constants.BAD_CREDENTIALS_MSG, |
| | | e.toString()); |
| | | return; |