Protecting Spring Cloud Gateway
When implementing Spring Cloud Gateway, it can serve as a system’s single entry point. For this reason, protecting Spring Cloud Gateway with OAuth2 is a good idea. This allows for centralizing authentication and authorization in Spring Cloud Gateway, eliminating the need for your client to reauthenticate with each service behind it.
You want to place your football
RESTful API, which is protected with OAuth2, behind Spring Cloud Gateway. So, you’ll also need to protect Spring Cloud Gateway with OAuth2.
In this recipe, you’ll learn how to configure Spring Cloud Gateway as a resource server and pass the token that you receive to the downstream service.
Getting ready
In this exercise, you will need the following:
- An authorization server. You can reuse Spring Authorization Server, which you created in the Setting up Spring Authorization Server recipe in Chapter 2, for this purpose.
- A resource server. The RESTful...