title: Spring Oauth2 : No AuthenticationProvider found for PreAuthenticatedAuthentication
body: <p>I'm putting in place a Spring web server and I want my API to be secured with Oauth2 Password Flow. Everything seems to be working fine for the AuthorizationServer part (No problem authenticating and getting an access token) but on the ResourceServer part I keep getting the following error :</p>
  
  <pre><code>org.springframework.security.authentication.ProviderNotFoundException: No AuthenticationProvider found for org.springframework.security.web.authentication.preauth.PreAuthenticatedAuthenticationToken
  </code></pre>
  
  <p>Am I right in assuming that since any Oauth2 configuration is by nature split between the authorization server which grants the access token and the resource server which will check for this token validity, any access token granted by the AuthorizationServer to a client will be seen as some sort of pre-authentication by the Resource Server, and thus making it look for a provider able to support this kind of Authentication ?</p>
  
  <p>If it is the case, what would be the best way to provide one ? I'm struggling to find any concrete example.</p>
  
  <p>Or is my assumption wrong and the problem is coming from my setup being incorrect somewhere else ? Maybe I missed the part where I should make such a Provider available.</p>
  
  <p>Thanks in advance !</p>