package com.njcb.corp.gateway.security;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.security.config.web.server.ServerHttpSecurity;
import org.springframework.security.web.server.SecurityWebFilterChain;
import org.springframework.web.filter.reactive.HiddenHttpMethodFilter;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;
/**
* @author Lei Ji Hui
* @version V1.0
* @date 2021/8/20 17:19
* @description: 注意:webflux环境下要生效必须用注解@EnableWebFluxSecurity使其生效
* cloud gateway采用的webflux技术(此处与web不同)
* @className WebSecurityConfig
**/
@Configuration
@EnableWebFluxSecurity
@Slf4j
public class WebSecurityConfig {
@Bean
SecurityWebFilterChain
SpringBoot2.* GateWay网关中关闭security验证
最新推荐文章于 2025-10-02 20:01:16 发布
该博客介绍了如何在使用WebFlux技术的Spring Cloud Gateway项目中配置Spring Security,允许所有请求并禁用基本认证、CSRF、登出和表单登录功能。强调了WebFlux环境与传统Servlet环境下的安全配置差异。

最低0.47元/天 解锁文章
2190

被折叠的 条评论
为什么被折叠?



