0
0
Microservicessystem_design~12 mins

Authentication at gateway level in Microservices - Architecture Diagram

Choose your learning style9 modes available
System Overview - Authentication at gateway level

This system handles user requests by verifying their identity at the API Gateway before allowing access to backend microservices. It ensures only authenticated users can reach services, improving security and reducing load on services.

Architecture Diagram
User
  |
  v
Load Balancer
  |
  v
API Gateway (Auth Check)
  |
  v
Microservices Cluster
  |
  v
Database

Cache (for tokens) connected to API Gateway
Components
User
client
Sends requests to the system
Load Balancer
load_balancer
Distributes incoming requests evenly to API Gateway instances
API Gateway
api_gateway
Performs authentication and routes requests to microservices
Cache
cache
Stores authentication tokens for quick validation
Microservices Cluster
service
Handles business logic after authentication
Database
database
Stores user data and service data
Request Flow - 10 Hops
UserLoad Balancer
Load BalancerAPI Gateway
API GatewayCache
CacheAPI Gateway
API GatewayMicroservices Cluster
Microservices ClusterDatabase
DatabaseMicroservices Cluster
Microservices ClusterAPI Gateway
API GatewayLoad Balancer
Load BalancerUser
Failure Scenario
Component Fails:API Gateway
Impact:All incoming requests fail authentication and cannot reach microservices, causing service outage.
Mitigation:Deploy multiple API Gateway instances behind the load balancer for redundancy and failover.
Architecture Quiz - 3 Questions
Test your understanding
Where is the user authentication checked in this system?
AInside each microservice
BDirectly in the database
CAt the API Gateway before routing to microservices
DAt the load balancer
Design Principle
This design centralizes authentication at the API Gateway to secure all requests before they reach microservices. Using a cache for tokens speeds up validation and reduces database load. Load balancer redundancy ensures availability and scalability.