java—如何使用spring security和webflux忽略特定路径

4uqofj5v  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(335)

我试图忽略不需要springsecurity和springwebflux验证的特定路径。这是我的配置:

@Bean
    SecurityWebFilterChain springWebFilterChain(ServerHttpSecurity http) throws Exception {
        return http.csrf().disable()
                   .authorizeExchange()
                   .pathMatchers("/swagger-ui/**").permitAll().and()
                   .authorizeExchange()
                   .pathMatchers("/**").authenticated()
                   .pathMatchers("/prepaid/validateSubscriber").hasAnyRole("VALIDATESUBSCRIBER", "PREPAID")
                   .pathMatchers("site/crm-services/prepaid/**").hasRole("PREPAID")
                   .and().httpBasic().and()
                   .build();
    }

但在尝试访问swaggerui时,它仍然要求我进行身份验证,我应该如何配置webfilterchain以忽略swaggerui路径?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题