Java 禁用选定端口的Spring安全性[使用WebFlux安全性]
如何禁用所选端口的安全性?我需要给予永久访问,例如4200端口(角度)。我在WebFlux安全部门工作Java 禁用选定端口的Spring安全性[使用WebFlux安全性],java,spring,spring-security,spring-webflux,Java,Spring,Spring Security,Spring Webflux,如何禁用所选端口的安全性?我需要给予永久访问,例如4200端口(角度)。我在WebFlux安全部门工作 @EnableWebFluxSecurity @EnableReactiveMethodSecurity public class SecurityConfig { (...) int selectedPort = 4200; @Bean public SecurityWebFilterChain springSecurityFilterChain(final ServerHt
@EnableWebFluxSecurity
@EnableReactiveMethodSecurity
public class SecurityConfig {
(...)
int selectedPort = 4200;
@Bean
public SecurityWebFilterChain springSecurityFilterChain(final ServerHttpSecurity http) {
return http
(...)
.authorizeExchange()
.pathMatchers("/menage").authenticated()
.anyExchange().permitAll()
.and()
.build();
}
在本例中,我需要为端口4200提供永久访问权限(禁用安全性?),以便使用“/menage”路径
当然,这种方法行不通:
private RequestMatcher checkPort(final int port) {
return (HttpServletRequest request) -> port == request.getLocalPort();
}
不要在不同的端口上为应用程序提供服务,创建一个端点,将index.html与应用程序的其余部分在同一端口上提供服务。这可能会有所帮助。白名单本地:4200不要在不同的端口上为应用程序提供服务,创建一个端点,该端点将在与应用程序其余部分相同的端口上为index.html提供服务。这可能会有所帮助。本地白名单:4200