mirror of https://gitee.com/maxjhandsome/pig
fix #I3XU3M dev 代码无法正确退出,提示 header client 信息不存在
This commit is contained in:
parent
67d7490292
commit
580aa3c616
|
@ -17,6 +17,7 @@
|
||||||
package com.pig4cloud.pig.gateway.filter;
|
package com.pig4cloud.pig.gateway.filter;
|
||||||
|
|
||||||
import cn.hutool.core.text.CharSequenceUtil;
|
import cn.hutool.core.text.CharSequenceUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.pig4cloud.pig.common.core.constant.CacheConstants;
|
import com.pig4cloud.pig.common.core.constant.CacheConstants;
|
||||||
|
@ -60,10 +61,22 @@ public class ValidateCodeGatewayFilter extends AbstractGatewayFilterFactory<Obje
|
||||||
ServerHttpRequest request = exchange.getRequest();
|
ServerHttpRequest request = exchange.getRequest();
|
||||||
boolean isAuthToken = CharSequenceUtil.containsAnyIgnoreCase(request.getURI().getPath(),
|
boolean isAuthToken = CharSequenceUtil.containsAnyIgnoreCase(request.getURI().getPath(),
|
||||||
SecurityConstants.OAUTH_TOKEN_URL);
|
SecurityConstants.OAUTH_TOKEN_URL);
|
||||||
|
|
||||||
|
// 不是登录请求,直接向下执行
|
||||||
|
if (!isAuthToken) {
|
||||||
|
return chain.filter(exchange);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新token,直接向下执行
|
||||||
|
String grantType = request.getQueryParams().getFirst("grant_type");
|
||||||
|
if (StrUtil.equals(SecurityConstants.REFRESH_TOKEN, grantType)) {
|
||||||
|
return chain.filter(exchange);
|
||||||
|
}
|
||||||
|
|
||||||
boolean isIgnoreClient = configProperties.getIgnoreClients().contains(WebUtils.getClientId(request));
|
boolean isIgnoreClient = configProperties.getIgnoreClients().contains(WebUtils.getClientId(request));
|
||||||
try {
|
try {
|
||||||
// only oauth and the request not in ignore clients need check code.
|
// only oauth and the request not in ignore clients need check code.
|
||||||
if (isAuthToken && !isIgnoreClient) {
|
if (!isIgnoreClient) {
|
||||||
checkCode(request);
|
checkCode(request);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue