title: Spring Security - Oauth2 Pass Request Paramerter to the AuthenticationProvider
body: <p>I have created a custom authentication provider to which I need to pass a parameter from the request.</p>
  
  <p>The enpoint is </p>
  
  <blockquote>
    <p>/oauth/token?grant_type=password&amp;username=xxx&amp;password=xxx&amp;client_id=xxx&amp;client_secret=xxx&amp;country=my</p>
  </blockquote>
  
  <p>From the above request I need to capture the <code>country</code> parameter and pass it on to the custom authentication provider, which will then authenticate the user based on his username, password and country.</p>
  
  <p>The above request passes through the <code>ClientCredentialsTokenEndpointFilter</code> filter, but there is no way I can set the country value from the request onto the authentication object.</p>
  
  <pre><code>&lt;http pattern="/oauth/token" create-session="never"
      authentication-manager-ref="clientAuthenticationManager" 
      xmlns="http://www.springframework.org/schema/security"&gt;
      &lt;intercept-url pattern="/oauth/token" access="fullyAuthenticated" /&gt;
      &lt;anonymous enabled="false" /&gt;
      &lt;http-basic entry-point-ref="clientAuthenticationEntryPoint" /&gt;     
      &lt;custom-filter ref="clientCredentialsTokenEndpointFilter"
          after="BASIC_AUTH_FILTER" /&gt;
      &lt;access-denied-handler ref="oauthAccessDeniedHandler" /&gt;
  &lt;/http&gt;
  </code></pre>
  
  <p>Please let me know if I can have this implemented by extending any of the security features.</p>
  
  <p>I am using <code>Spring 4.1</code> and <code>Spring Security 4.0.3RELEASE</code></p>
  
  <p>Thanks,
  Anwar</p>