title: Spring security client detail is going as user detail in DaoAuthenticationProvider
body: <p>Spring Boot, Security OAuth2 implementation, default token endpoint (/oauht/token) is working fine. However, when I send a request to new endpoint at /oauth/http/token it is throws Bad Credentials because of the following reason:</p>
  
  <p><code>FilterChainProxy</code> triggers around 12 filters and out of which one is <code>BasicAuthenticationFilter</code>. It uses <code>UserDetailsService</code> of <code>DaoAuthenticationProvider</code> class to fetch user data. For client authentication this should be <code>ClientDetailsService</code> but, for some reason this is always <code>UserDetailsService</code> and because of this client credentials goes to <code>UserRepository</code> and fails. This class does initialize properly because default <code>/oauth/token</code> works fine.</p>
  
  <p>I tried to inject existing Authentication Manager in <code>BasicAuthenticationFilter</code> and added that as a filter in <code>ResourceServerConfigurerAdapter</code> but that didn’t make any difference. It does change Authentication Manager provider from <code>AnonymousAuthenticationProvider</code> to <code>DaoAuthenticationProvider</code> but <code>UserDetailsService</code> still remains <code>UserDetails</code>.</p>
  
  <p>Request at <code>/oauth/http/token</code>, this doesn't work. Code is almost same as <code>postAccessToken()</code> of <code>org.springframework.security.oauth2.provider.endpoint.TokenEndpoint</code></p>
  
  <p><a href="https://i.stack.imgur.com/VhlFC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VhlFC.jpg" alt="enter image description here"></a></p>
  
  <p>In above screenshot we can see that userDetailsService is UserDetailsServiceImpl and due to this client details present in request header as <code>Basic dGVzdDpwYXNzd29yZA==</code> is going to user repository and checking at user table instead of going to client repository and checking at client table.</p>
  
  <p>Request at <code>/oauth/token</code>, this works</p>
  
  <p><a href="https://i.stack.imgur.com/rP0OR.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rP0OR.jpg" alt="enter image description here"></a></p>