OAuth 2.0 is a way of securing APIs. Spring Security provides Spring Cloud Security and Spring Cloud OAuth2 components for implementing the grant flows we discussed earlier.
OAuth implementation using Spring Security
Security microservice
We'll create one more service, a security-service, which will control authentication and authorization, and also act as a resource server.
Create a new microservice, security-service, the way other microservices have been created and then follow the following steps:
- First, add Spring Security and Spring Security OAuth 2 dependencies in pom.xml:
<dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-security</artifactId...