title: X-CSRF-TOKEN is not generated by Spring Boot
body: <p>I followed the guide here: <a href="http://spring.io/guides/gs/rest-service/" rel="noreferrer">http://spring.io/guides/gs/rest-service/</a> to build my rest service example and now I am trying to enable the CSRF protection. I read that it should be enabled by default, so if I DON'T include: </p>
  
  <blockquote>
    <p>http.csrf().disable()</p>
  </blockquote>
  
  <p>in my <code>WebSecurityConfigurerAdapter</code> configuration, the CSRF protectection should be enabled by default, but it does not seem to to be the case. The problem is that the X-CSRF-TOKEN is not generated and not included in my HTTP response in any way.
  What am I expected to do, to have the x-csrf-token generated and included in the response and, of course, the csrf protection fully working?</p>
  
  <p>I noticed that, with a similar spring mvc configuration, I get the x-csrf-token generated simply including:</p>
  
  <blockquote>
    <p>&lt; security:csrf disabled="false"/></p>
  </blockquote>
  
  <p>in my security configuration file. But, with spring boot maybe I am getting something wrong and there is no way to have the csrf token generated. Can anybody help me, perhaps pointing me to a working example? My security configuration is:</p>
  
  <pre><code>     @Override
       protected void configure(HttpSecurity http) throws Exception 
       {
          http
        // .csrf().disable()
        .authorizeRequests()
            .anyRequest()
            .authenticated()
        .and()
        .httpBasic()
        .authenticationEntryPoint(new RestAuthenticationEntryPoint())
        .and()
        .formLogin()
        .successHandler(new RestAuthenticationSuccessHandler())
        .failureHandler(new SimpleUrlAuthenticationFailureHandler())
        .and()
        .logout()
        .logoutSuccessHandler(new RestLogoutSuccessHandler());
  }
  
  @Override
  public void configure(AuthenticationManagerBuilder auth) throws Exception 
  {
      auth.userDetailsService(restUserDetailService);
  }
  </code></pre>