title: Spring OAuth2 ResourceServer external AuthorizationServer
body: <p>How do you setup a separate Spring OAuth2 ResourceServer only, that uses and 3rd party AuthorizationServer</p>
  
  <p>All examples I see always implement the ResourceServer and AuthorizationServer in same application. </p>
  
  <p>I don't want to implement the AuthorizationServer as someone else is going to provide this. </p>
  
  <p>Have tried with no luck</p>
  
  <pre><code>@Configuration
     @EnableResourceServer
     public class OAuth2ResourceServerConfig extends ResourceServerConfigurerAdapter
  </code></pre>
  
  <p>And application.yml includes</p>
  
  <pre><code>security:
    oauth2:
      resource:
        userInfoUri: https://...../userinfo
  </code></pre>
  
  <hr>
  
  <h2>Adding to my question some further details::</h2>
  
  <p>In my understanding - with OAuth there are 4 players:</p>
  
  <ul>
  <li>resource owner: a person</li>
  <li>resource server: server exposing a protected API (protected by the authentication server)</li>
  <li>authentication server: the server that handles issuing access tokens to clients</li>
  <li>client: an application (say website) accessing the resource server API's after resource owner have given consent</li>
  </ul>
  
  <p>I have tried various tutorials, but all seem to implement their own Authorisation server</p>
  
  <p><a href="http://www.swisspush.org/security/2016/10/17/oauth2-in-depth-introduction-for-enterprises" rel="nofollow noreferrer">http://www.swisspush.org/security/2016/10/17/oauth2-in-depth-introduction-for-enterprises</a>
  <a href="https://gigsterous.github.io/engineering/2017/03/01/spring-boot-4.html" rel="nofollow noreferrer">https://gigsterous.github.io/engineering/2017/03/01/spring-boot-4.html</a></p>
  
  <p>or are examples of implementing the client player</p>
  
  <ul>
  <li><a href="http://www.baeldung.com/spring-security-openid-connect" rel="nofollow noreferrer">http://www.baeldung.com/spring-security-openid-connect</a> </li>
  <li><a href="https://spring.io/guides/tutorials/spring-boot-oauth2/" rel="nofollow noreferrer">https://spring.io/guides/tutorials/spring-boot-oauth2/</a></li>
  </ul>
  
  <p>My Question is: 
  How do I implement just the Resource Server which secures my REST API, via a 3rd party authentication server, nothing more. </p>