Java HTTP入站网关上的基本HTTP身份验证不工作
我有一个入站网关,我正在尝试使用JavaDSL为基本HTTP身份验证提供安全保护Java HTTP入站网关上的基本HTTP身份验证不工作,java,spring,spring-security,spring-integration,Java,Spring,Spring Security,Spring Integration,我有一个入站网关,我正在尝试使用JavaDSL为基本HTTP身份验证提供安全保护 IntegrationFlows .from(Http.inboundGateway("/support/toggleListener/{storageId}/{action}") .headerExpression(HeaderKeys.STORAGE_ID, spelParser.parseExpression("#pathVariables.st
IntegrationFlows
.from(Http.inboundGateway("/support/toggleListener/{storageId}/{action}")
.headerExpression(HeaderKeys.STORAGE_ID, spelParser.parseExpression("#pathVariables.storageId"))
.headerExpression("action", spelParser.parseExpression("#pathVariables.action"))
.id("toggleListenerIn")
.requestMapping(new Consumer<RequestMappingSpec>() {
@Override
public void accept(RequestMappingSpec spec) {
spec.methods(HttpMethod.GET);
spec.methods(HttpMethod.POST);
}
})
.get())
及
这两种方法都会被触发(configure,configureGlobal),但是当我向网关发送请求时,身份验证没有启动
如果您能指出我哪里弄错了,或者向我指出使用入站网关基本身份验证的Java DSL示例,我将不胜感激。我想知道您的
springSecurityFilterChain
安全配置是否正确:。请在执行请求并确保其安全时,也共享org.springframework
类别的DEBUG
日志。我想知道您的springSecurityFilterChain
安全配置是否正确:。执行请求时,请共享org.springframework
类别的DEBUG
日志,并确保其安全。
@Component
@EnableWebSecurity
@EnableGlobalMethodSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
System.out.println("SecurityConfig.configure called");
http.authorizeRequests().antMatchers("/**").authenticated().and().httpBasic();
}
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth.inMemoryAuthentication().withUser("test").password("test").roles("ADMIN");
}
}
@Component
public class SecurityWebApplicationInitializer extends AbstractSecurityWebApplicationInitializer {
}