Spring security 禁用CSRF时主体为空

Spring security 禁用CSRF时主体为空,spring-security,spring-boot,csrf,spring-oauth2,Spring Security,Spring Boot,Csrf,Spring Oauth2,我正在创建一个webapp,它使用springbootstartersecurity和spring-security-oauth2使用Facebook登录 为了避免在angular 2中实现所有CSRF内容(因为它只是一个玩具项目),我想关闭CSRF。 我已经实现了以下配置: @Configuration public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected

我正在创建一个webapp,它使用
springbootstartersecurity
spring-security-oauth2
使用Facebook登录

为了避免在angular 2中实现所有CSRF内容(因为它只是一个玩具项目),我想关闭CSRF。
我已经实现了以下配置:

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable();
    }
}
但是现在,
主体
-对象总是
null

Task createTask(@RequestBody Task task, Principal principal) {
    // do stuff
}
为什么?
我想我无意中覆盖了application.yaml中配置的安全配置,但即使我添加了
顺序
-注释,它也不起作用:(

编辑:
请求头(我创建了一个过滤器来添加XSRF-TOKEN cookie,忽略它):


angular应用程序地址(在浏览器url栏中)是否与spring应用程序侦听的主机和端口匹配?是的。如果我删除配置,则一切正常(除了CSRF禁止的POST、PUT等),您可以查看chrome网络面板或调试代理(即Fiddler)吗并显示angular ajax请求头是什么样子的?angular应用程序地址(在浏览器url栏中)是否与spring应用程序侦听的主机和端口匹配?是的。如果我删除配置,一切都会正常工作(除了CSRF禁止的POST、PUT等)您能看看chrome网络面板或调试代理(即Fiddler)并展示ajax请求头的样子吗?
POST /foo HTTP/1.1
Host: localhost:81
Connection: keep-alive
Content-Length: 15
Origin: http://localhost:81
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.94 Safari/537.36
Content-Type: application/json
Accept: */*
Referer: http://localhost:81/create-task
Accept-Encoding: gzip, deflate
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
Cookie: _ga=GA1.1.681162454.1458756836; JSESSIONID=F65FB28C14A8A2D870D18842DE855212; XSRF-TOKEN=551858ab-678e-4dcb-bc72-44fbc569ec41