docs(SecurityGlobalFilter.java): 注释完善

This commit is contained in:
郝先瑞 2022-02-15 23:26:38 +08:00
parent b53e923bfc
commit 49eedf979b
2 changed files with 7 additions and 5 deletions

View File

@ -6,7 +6,7 @@ import cn.hutool.core.io.IoUtil;
import com.youlai.common.constant.SecurityConstants;
import com.youlai.common.result.ResultCode;
import com.youlai.gateway.util.ResponseUtils;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.SneakyThrows;
import org.springframework.boot.context.properties.ConfigurationProperties;
@ -26,6 +26,7 @@ import org.springframework.security.web.server.SecurityWebFilterChain;
import org.springframework.security.web.server.ServerAuthenticationEntryPoint;
import org.springframework.security.web.server.authorization.ServerAccessDeniedHandler;
import reactor.core.publisher.Mono;
import java.io.InputStream;
import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey;
@ -39,12 +40,12 @@ import java.util.List;
* @date 2020-05-01
*/
@ConfigurationProperties(prefix = "security")
@AllArgsConstructor
@RequiredArgsConstructor
@Configuration
@EnableWebFluxSecurity
public class ResourceServerConfig {
private ResourceServerManager resourceServerManager;
private final ResourceServerManager resourceServerManager;
@Setter
private List<String> ignoreUrls;

View File

@ -25,11 +25,13 @@ import reactor.core.publisher.Mono;
import java.net.URLEncoder;
/**
* 安全拦截全局过滤器
* <p>
* 善后一些无关紧要的工作 ResourceServerManager#check 鉴权之后执行
*
* @author <a href="mailto:xianrui0365@163.com">haoxr</a>
* @date 2022/2/15
*/
@Component
@Slf4j
@ -49,7 +51,6 @@ public class SecurityGlobalFilter implements GlobalFilter, Ordered {
ServerHttpRequest request = exchange.getRequest();
ServerHttpResponse response = exchange.getResponse();
// 线上演示环境禁止修改和删除
String requestPath = request.getPath().toString();
if (env.equals("prod") && !SecurityConstants.LOGOUT_PATH.equals(requestPath)