Configuring an MVC application with OpenID authentication
We want to create a new web application for our football fans. To do so, we must authenticate the users when they’re accessing the application. We’ll use access tokens to access the protected RESTful API.
In this recipe, we’ll learn how to use Spring OAuth2 Client to protect an MVC web application and get access tokens for other protected resources.
If you plan to use an SPA, you will need to look for OpenID-certified libraries for your target environment.
Getting ready
For this recipe, you will reuse the Authorization Server application you created in the Setting up Spring Authorization Server recipe and the application you created in the Protecting a RESTful API using OAuth2 with different scopes recipe. I’ve prepared a working version of both projects in case you haven’t completed them yet. You can find them in this book’s GitHub repository at https://github.com/PacktPublishing...