Design a Global Identity and Access Management System
A Staff-level walkthrough of a globally distributed identity and access platform that authenticates 1B+ users and 10B+ logins a day across OAuth 2.0, OpenID Connect, and SAML. It trades stateless JWT validation against real-time revocation, with conditional access scoring risk on every sign-in behind a 99.999% availability target. Follow it top to bottom, or jump to any step.
Requirements
Functional Requirements
- Authentication: Verify user identity via password, MFA, passwordless (FIDO2), SSO
- Authorization: Role-based access control (RBAC), attribute-based access control (ABAC)
- Token management: Issue, validate, refresh, and revoke JWT tokens
- Multi-protocol: OAuth 2.0, OpenID Connect, SAML 2.0
- Conditional access: Policies that evaluate risk before granting access
- Cross-tenant: B2B (invite external users), B2C (customer identity), federation
- MFA orchestration: Step-up authentication for sensitive operations
Non-Functional Requirements
- Latency: Token validation < 5ms (cached); token issuance < 500ms
- Availability: 99.999% (identity is the foundation — if auth is down, everything is down)
- Scale: 1B+ users, 10B+ authentications/day
- Security: Zero tolerance for auth bypass vulnerabilities
Architecture
Deep dives
WHERE STAFF IS WONDeep Dive 1: Authentication Flows
OAuth 2.0 Authorization Code Flow (web apps):
Client Credentials Flow (service-to-service):
Device Code Flow (devices without browser — TV, IoT):
Deep Dive 2: Conditional Access Policies
Evaluated on EVERY authentication — the security brain of the system.
Risk signals:
- Sign-in risk: Impossible travel (login from NYC and Tokyo within 1 hour), known malicious IP, anonymous proxy, password spray detection
- User risk: Leaked credentials detected on dark web, anomalous behavior pattern
- Device risk: Non-compliant device, jailbroken/rooted, outdated OS
Deep Dive 3: Token Management and Caching
Token types:
- Access token (JWT): Contains claims (user, roles, scopes). Short-lived: 1 hour. Validated locally by resource server (no network call — just verify JWT signature).
- Refresh token: Long-lived (90 days). Used to get new access tokens without re-authentication.
- ID token: Contains user profile info. Used by client app only (not sent to APIs).
Token caching strategy:
Token revocation (the hard problem):
- JWTs are stateless — can't "revoke" a token that's already issued
- Solution: Continuous Access Evaluation (CAE)
- Resource servers check token validity against IdP on critical events
- Events: password change, user disabled, device non-compliant
- Within 1 minute of revocation event, token is no longer accepted
Tradeoffs
Monitoring
- Authentication success rate: Alert if < 98% (may indicate brute force or outage)
- MFA completion rate: Alert if < 90% (UX issue or attack)
- Token issuance latency p99: Alert if > 2 seconds
- Conditional access policy evaluation time: Alert if > 100ms
- Failed sign-in patterns: Detect password spray, credential stuffing
- Risky sign-in volume: Alert if spike in high-risk detections
Rubric — Senior vs Staff
Want more breakdowns like this?
Join free early access for upcoming RAG, LLM eval, agents, and AI infrastructure walkthroughs.