无关风月
2025-01-22 99367ea1c11a68b420936e7f7db5fa7367da4f44
xinquan-gateway/src/main/java/com/xinquan/gateway/filter/AuthFilter.java
@@ -1,14 +1,5 @@
package com.xinquan.gateway.filter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import com.xinquan.common.core.constant.CacheConstants;
import com.xinquan.common.core.constant.HttpStatus;
import com.xinquan.common.core.constant.SecurityConstants;
@@ -19,6 +10,15 @@
import com.xinquan.common.redis.service.RedisService;
import com.xinquan.gateway.config.properties.IgnoreWhiteProperties;
import io.jsonwebtoken.Claims;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.gateway.filter.GatewayFilterChain;
import org.springframework.cloud.gateway.filter.GlobalFilter;
import org.springframework.core.Ordered;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.stereotype.Component;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Mono;
/**
@@ -83,6 +83,10 @@
        return chain.filter(exchange.mutate().request(mutate.build()).build());
    }
    private String getAppUserTokenKey(String userkey) {
        return CacheConstants.APP_USER_LOGIN_TOKEN_KEY + userkey;
    }
    private void addHeader(ServerHttpRequest.Builder mutate, String name, Object value)
    {
        if (value == null)