有没有办法通过一些配置或通过pom修改来禁用web-flux安全。现在,我使用以下命令禁用了它
@Bean public SecurityWebFilterChain securityWebFilterChain(final ServerHttpSecurity httpSecurity) {
return httpSecurity
.authorizeExchange().anyExchange().permitAll().and()
.build(); }在生产环境中,这是最好的方法吗?每当我添加依赖项以从config服务器中读取值时,spring安全性就会出现在类路径中,并且弹出窗口出现。我不想要安全措施,因为我们有自己的安全措施。
发布于 2019-03-26 20:01:46
您可以使用仅在特定上下文中运行的配置/配置文件类,例如:
@Configuration
@Profile("dev")
public class SecurityConfig {
@Bean
public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) {
return http.authorizeExchange().anyExchange().permitAll().and().build();
}
}然后,如果你想让它作为你的应用程序的一部分运行,你可以运行:
mvn spring-boot:run -Dspring-boot.run.profiles=dev也可以将其包含在properties/yaml文件中。希望这能有所帮助。
https://stackoverflow.com/questions/53002900
复制相似问题