【发布时间】:2017-02-25 12:58:53
【问题描述】:
我在我的 API 项目中使用 Spring Security 和 Spring Oauth2 和 JWT
Spring oauth 2 提供的用于登录的默认 API 是 /oauth/token
此 API 始终在响应中添加“Strict-Transport-Security: max-age=31536000 ; includeSubDomains”标头。 但我不希望在我的情况下出现这种情况。我已经用下面的源代码删除了 HSTS。
@EnableWebSecurity
public class WebSecurityConfig extends
WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
// ...
.headers()
.httpStrictTransportSecurity().disable();
}
}
使用上面的代码,我定义的 API 在标头中被删除了 HSTS。但默认 API /oauth/token 仍然在标头中返回 HSTS。 有没有办法做到这一点? 请帮忙。
谢谢, 锡
【问题讨论】:
标签: spring-security spring-oauth2 hsts