| | |
| | | import io.jsonwebtoken.Claims; |
| | | import reactor.core.publisher.Mono; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * 网关鉴权 |
| | | * |
| | |
| | | @Autowired |
| | | private IgnoreWhiteProperties ignoreWhite; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | |
| | |
| | | ServerHttpRequest.Builder mutate = request.mutate(); |
| | | |
| | | String url = request.getURI().getPath(); |
| | | log.info("url"+url); |
| | | // 跳过不需要验证的路径 |
| | | if (StringUtils.matches(url, ignoreWhite.getWhites())) |
| | | { |
| | | return chain.filter(exchange); |
| | | } |
| | | String token = getToken(request); |
| | | log.info("token"+token); |
| | | if (StringUtils.isEmpty(token)) |
| | | { |
| | | return unauthorizedResponse(exchange, "令牌不能为空"); |