title: How do I disable Csrf (Cross-Site Request Forgery) for java Springmvc controller in XML config
body: <p>I have a SpringMvc application using Spring-Security 5.2 and Spring-webmvc 5.2. I've configured our security using xml.</p>
  <p>CSRF is working fine but I have another system hitting 2 of my <em>Post</em> endpoints to authenticate but can't access them after enabling csrf. Is there a way to exclude this particular controller <em>OR</em> the specific Post endpoints int he controller from the csrf filter?</p>
  <p><strong>context-security.xml</strong></p>
  <pre><code>&lt;http request-matcher-ref=&quot;someRequestMatcher&quot; auto-config=&quot;true&quot; realm=&quot;realm-01&quot;&gt;
  &lt;csrf disabled=&quot;false&quot;/&gt;
  &lt;interceptor-url pattern=&quot;login.html&quot; access=&quot;permitAll&quot; /&gt;
  &lt;interceptor-url pattern=&quot;/admin/**&quot; access=&quot;hasRole('administrator')&quot; /&gt;
  &lt;interceptor-url pattern=&quot;/user/**&quot; access=&quot;hasRole('user')&quot; /&gt;
  ...
  &lt;/http&gt;
  </code></pre>
  <p><strong>Controller</strong></p>
  <pre><code>    @Controller
      @RequestMapping(value= &quot;/authenticate&quot;, produces=&quot;application/json&quot;)
      public class authController {
      ...
      @RequestMapping(value=&quot;/v1/specialUserAuthentication&quot;, 
  method=RequestMethod.POST, 
  produces=javax.ws.core.MediaType.Application_json)
      public ResponseEntity&lt;Boolean&gt; authenticateSpecialuser(@RequestBody AuthInfo info){
      boolean isAuthenticated = &lt;someway to AUthenticate&gt;
      ...
      return new ResponseEntity&lt;&gt;(isAuthenticated, HttpStatus.OK);
      }
  </code></pre>