-
Book Overview & Buying
-
Table Of Contents
The Spring Pocket Guide
By :
Let’s turn our eyes to a new service called auth, in which we’ll set up a simple Spring Security application. We have two goals: to demonstrate how we might protect this solitary service and then to demonstrate how we might protect a system of services.
Return to the Spring Initializr and generate a new project with the following dependencies selected for auth: Spring Web, OAuth 2 Authorization Server, and GraalVM Native Support.
Download the resulting .zip file, unzip it, and then import it into your IDE. We’ll need to change or define a few files:
#src/main/resources/application.properties
server.port=9090
Spring Security is all about authentication and authorization.
Let’s lock down access to the following Spring MVC controller that’s expecting Principal (an authenticated user):
@Controller
@ResponseBody
class HelloPrincipalController {
@GetMapping("/")
Map<String, String> hello(Principal...