我有3个maven模块:
我想要" / a / "使用https和x509以及" / b / "使用没有安全性的http(或其他类型的安全性 - 例如jwt)。
我目前的版本是:
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.antMatchers("/a/**").authenticated()
.and()
.x509()
.and().csrf().disable();
}
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/b/**");
}
}
它仍然在https上运行B并且需要auth。是否可以在不创建单独的安全配置的情况下配置我想要的内容?
答案 0 :(得分:0)
使用HTTP和HTTPS时,您必须配置两个连接器。如文档中所述(请参阅http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto-configure-ssl),仅使用配置文件无法执行此操作。
您必须配置其中一个连接器(例如HTTPS)并以编程方式添加其他连接器。此示例显示了如何:https://github.com/spring-projects/spring-boot/tree/v1.3.6.RELEASE/spring-boot-samples/spring-boot-sample-tomcat-multi-connectors
顺便说一下,不建议再使用普通的HTTP。