【发布时间】:2019-03-09 18:34:59
【问题描述】:
我的弹簧安全配置如下:
@EnableWebSecurity
@Order(1)
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable().authorizeRequests()
.antMatchers("/rest/app/health").permitAll()
.antMatchers("/*/app/**").authenticated()
.antMatchers("/**").permitAll().and().httpBasic();
}
@Override
public final void configure(final WebSecurity web) throws Exception {
super.configure(web);
web.httpFirewall(new DefaultHttpFirewall());
}
}
我只包含了 spring security 而不是 oauth2。由于某种原因,如果有人正在访问任何允许的 url,例如。 /rest/app/health 带有 Authorization 标头,他得到 401 Unauthorized。没有标题它工作正常。
如何忽略 Authorization 标头,因为我需要此标头作为请求参数来将我的请求委托给第三方服务。
【问题讨论】:
标签: spring spring-boot spring-security