title: Spring Oauth2 - override TokenEndpoint allowed methods
body: <p>I need to allow users to get an OAuth token via grant_type=password and using GET and not POST. The default implementation for <a href="http://docs.spring.io/spring-security/oauth/apidocs/org/springframework/security/oauth2/provider/endpoint/TokenEndpoint.html" rel="nofollow">TokenEndpoint</a> is as follows:</p>
  
  <pre><code>public class TokenEndpoint extends AbstractEndpoint {
  
  private OAuth2RequestValidator oAuth2RequestValidator = new DefaultOAuth2RequestValidator();
  
  private Set&lt;HttpMethod&gt; allowedRequestMethods = new HashSet&lt;HttpMethod&gt;(Arrays.asList(HttpMethod.POST));
  
  @RequestMapping(value = "/oauth/token", method=RequestMethod.GET)
  public ResponseEntity&lt;OAuth2AccessToken&gt; getAccessToken(Principal principal, @RequestParam
  Map&lt;String, String&gt; parameters) throws HttpRequestMethodNotSupportedException {
      if (!allowedRequestMethods.contains(HttpMethod.GET)) {
          throw new HttpRequestMethodNotSupportedException("GET");
      }
      return postAccessToken(principal, parameters);
  }
  </code></pre>
  
  <p>As you can see, the default allowed is only POST. I am using XML configuration (not annotations). How can I add to the Set the HttpMethod.GET?</p>