Microservices Security Architecture & OAuth 2.0
Understand Zero Trust architecture, Authentication vs Authorization, and centralized identity federation using OAuth 2.0 and OpenID Connect.
In a monolithic application, security is straightforward: a user enters credentials on a login page, the server verifies the password against a database, creates an HTTP session (JSESSIONID) stored in local memory, and serializes a cookie to the user's browser. Subsequent requests pass that cookie, and the server's session filter validates access.
In a distributed microservices system consisting of 40 services spread across multiple Kubernetes clusters and cloud regions, in-memory HTTP sessions fail completely:
- Services are stateless and scale elastically.
- Storing session state in a single shared database recreates a bottleneck and single point of failure.
- A user request might touch six different services, each needing to know who the user is without repeatedly re-prompting for passwords.
01The Zero Trust Philosophy
Beginner teams often operate under the outdated Perimeter Security Model (Castle-and-Moat): build a strong firewall around the VPC, and assume that all network traffic inside the internal network is friendly and trusted.
Modern enterprise engineering operates under the Zero Trust Architecture:
"Never trust, always verify."
- The internal network is assumed to be hostile: A compromised pod or rogue internal contractor must not be able to sniff unencrypted traffic or forge requests to adjacent services.
- Every request must carry cryptographic proof of identity: Both human callers and machine-to-machine inter-service calls must authenticate and authorize on every hop.
- Principle of Least Privilege: A service only receives the minimal scopes and permissions required to perform its exact task.
Loading the rest of the lesson…