Member-only story
Spring Cloud Gateway OpenID Connect with Keycloak
9 min readJun 23, 2025
In this story, we’ll explore how to secure microservices architectures with Spring Cloud Gateway, Resource Servers, and Keycloak.
· Prerequisites
· Overview
∘ How the authentication flow works
· Setting up a Keycloak Instance
∘ Start Keycloak instance
∘ Create a realm
∘ Creating a Client
∘ Create Users
· Spring Cloud Gateway implementation
∘ application.yml
∘ Security Configuration
· Spring Resource Server implementation
∘ Configure application settings
∘ JwtGrantedAuthoritiesConverter
∘ Security Configuration
∘ Resource server Endpoints
· Testing
· Conclusion
· References
Prerequisites
This is the list of all the prerequisites:
- Docker / Docker-compose installed (optional if you’ve already downloaded and installed Keycloak from https://www.keycloak.org/downloads)
- Spring Boot 3