| | |
| | | private static final String CODE = "code";
|
| | |
|
| | | private static final String UUID = "uuid";
|
| | | |
| | | private static final String GRANT_TYPE = "grant_type";
|
| | | |
| | | private static final String REFRESH_TOKEN = "refresh_token";
|
| | |
|
| | | @Override
|
| | | public GatewayFilter apply(Object config)
|
| | |
| | |
|
| | | // 非登录请求,不处理
|
| | | if (!StringUtils.containsIgnoreCase(request.getURI().getPath(), AUTH_URL))
|
| | | {
|
| | | return chain.filter(exchange);
|
| | | }
|
| | | |
| | | // 刷新token请求,不处理
|
| | | String grantType = request.getQueryParams().getFirst(GRANT_TYPE);
|
| | | if (StringUtils.containsIgnoreCase(request.getURI().getPath(), AUTH_URL) && StringUtils.containsIgnoreCase(grantType, REFRESH_TOKEN))
|
| | | {
|
| | | return chain.filter(exchange);
|
| | | }
|
| | |
| | | catch (Exception e)
|
| | | {
|
| | | ServerHttpResponse response = exchange.getResponse();
|
| | | response.getHeaders().add("Content-Type", "application/json;charset=UTF-8");
|
| | | return exchange.getResponse().writeWith(
|
| | | Mono.just(response.bufferFactory().wrap(JSON.toJSONBytes(AjaxResult.error(e.getMessage())))));
|
| | | }
|