All the services we have created up until now are unsecured. A consumer does not need to provide any credentials to access these services. However, all services in the real world are usually secured.
In this section, we will discuss two ways of authenticating REST services:
OAuth 2.0 authentication
We will implement these two types of authentication with Spring Security.
Spring Boot provides a starter for Spring Security using
spring-boot-starter-security. We will start with adding Spring Security starter to our
Add the following dependency to your file
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency>
Spring-boot-starter-security dependency brings in three important Spring Security dependencies: