title: Spring Security not creating CSRF token
body: <p>I wish to use Spring Security (version 5.1.2) to generate a CSRF token for my Angular 7 application.  I have the following in my SecurityConfig file:</p>
  
  <pre><code>@Override
  protected void configure(HttpSecurity http) throws Exception {
      http.cors().and()
              .csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
  }
  </code></pre>
  
  <p>with the following RequestMapping in my controller:</p>
  
  <pre><code>@RestController
  @RequestMapping("/authentication")
  public class AuthenticationController {
  
      @GetMapping("/csrf")
      public void getCsrfToken(){...}
  
      @PostMapping("/register")
      public RegisterOutputDTO register(@RequestBody UserDTO input){...}
  }
  </code></pre>
  
  <p>I gathered from various sources that the <code>csrfTokenRepository</code> would automatically generate a cookie with header <code>XSRF-token</code> on my first <code>GET</code> call (which is what <code>/authentication/csrf</code> is for), but I am not getting a cookie back from the server.  Hence on my next <code>POST</code> call I am getting a 403 response.  What could I possibly be missing?</p>
  
  <p><a href="https://i.stack.imgur.com/uk0ip.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uk0ip.png" alt="This is my output"></a></p>