我有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。在不创建单独的安全配置的情况下,可以配置我想要的东西吗?
发布于 2016-07-11 14:53:30
当使用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了。
https://stackoverflow.com/questions/38305907
复制相似问题