|
@@ -5,6 +5,7 @@ import com.diagbot.client.UserServiceClient;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
|
import com.diagbot.entity.ServiceToken;
|
|
|
import com.diagbot.entity.Token;
|
|
|
+import com.diagbot.exception.CommonErrorCode;
|
|
|
import com.diagbot.util.GsonUtil;
|
|
|
import com.diagbot.util.StringUtil;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -76,11 +77,17 @@ public class GlobalGatewayFilter implements GlobalFilter {
|
|
|
String tokenStr = request.getHeaders().getFirst("Authorization");
|
|
|
if(StringUtil.isNotEmpty(tokenStr)) {
|
|
|
Token token = new Token();
|
|
|
+ tokenStr = tokenStr.replaceFirst("Bearer ", "");
|
|
|
token.setToken(tokenStr);
|
|
|
RespDTO<Boolean> res = userServiceClient.verifyToken(token);
|
|
|
if (res == null || !RespDTO.TRUE_CODE.equals(res.code)) {
|
|
|
return getVoidMono(serverWebExchange, res);
|
|
|
}
|
|
|
+ if(!res.data) {
|
|
|
+ res.code = CommonErrorCode.TOKEN_PAST.getCode();
|
|
|
+ res.msg = CommonErrorCode.TOKEN_PAST.getMsg();
|
|
|
+ return getVoidMono(serverWebExchange, res);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// if(!IS_GENERATE) {
|