Setting up authorization and resource servers

spring-security-oauth2 has not yet been (June 2017) been updated with the changes for Spring Framework 5.x and Spring Boot 2.x. We will use Spring Boot 1.5.x for examples related to OAuth 2 authentication. Code examples are here in the GitHub repository ;https://github.com/PacktPublishing/Mastering-Spring-5.0.

Typically, an authorization server would be a different server from the application where the API is exposed. To keep things simple, we will make our current API server act both as the resource server and as the authorization server.

The following code snippet shows how we can enable our application to act as the resource and authorization server:

   @EnableResourceServer @EnableAuthorizationServer ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.