title: How to change spring security oauth2 default token endpoint?
body: <p>We have spring security oauth2 based application. Every thing is working fine. But i am failed to change default token endpoint from "/oauth/token" to "/external/oauth/token".</p>
  
  <p>My spring-servlet.xml</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;http pattern="/external/oauth/token" create-session="stateless" 
         authentication-manager-ref="clientAuthenticationManager"
         use-expressions="true" xmlns="http://www.springframework.org/schema/security"&gt;
        &lt;intercept-url pattern="/external/oauth/token" access="isFullyAuthenticated()" /&gt;
        &lt;anonymous enabled="false" /&gt;
        &lt;http-basic entry-point-ref="clientAuthenticationEntryPoint" /&gt;
        &lt;!-- include this only if you need to authenticate clients via request parameters --&gt;
        &lt;custom-filter ref="clientCredentialsTokenEndpointFilter" after="BASIC_AUTH_FILTER" /&gt;
        &lt;access-denied-handler ref="oauthAccessDeniedHandler"/&gt;
  &lt;/http&gt;
  
  &lt;oauth:authorization-server client-details-service-ref="clientDetails" 
          token-services-ref="tokenServices" 
          user-approval-handler-ref="userApprovalHandler" token-endpoint-url="/external/oauth/token"&gt;
          &lt;oauth:authorization-code /&gt;
          &lt;oauth:implicit /&gt;
          &lt;oauth:refresh-token /&gt;
          &lt;oauth:client-credentials /&gt;
          &lt;oauth:password /&gt;
  &lt;/oauth:authorization-server&gt;
  </code></pre>
  
  <p>But the result when i access this endpoint is</p>
  
  <pre><code>{
      error: "unauthorized"
      error_description: "An Authentication object was not found in the SecurityContext"
  }
  </code></pre>
  
  <p>am i missing any thing ? Please suggest.</p>