Domain 5 Β· Lesson 2 of 5
SSO, Federation & Identity Protocols
ΔΔng nhαΊp Mα»t lαΊ§n & Giao thα»©c Danh tΓnh
SSO Protocol Comparison
| Protocol | Purpose | Format | Use Case | TS Relevance |
|---|---|---|---|---|
| Kerberos | AuthN β ticket-based | Proprietary tickets | Windows Active Directory | Internal service (rare) |
| SAML 2.0 | AuthN β browser SSO | XML assertions | Enterprise web apps | Admin portal SSO potential |
| OAuth 2.0 | AuthZ delegation | JSON + HTTP | API access grants | Platform C uses JWT Bearer tokens |
| OIDC | AuthN (on top of OAuth) | JWT (ID Token) | Modern app SSO | "Login with Google" pattern |
Kerberos Flow
Client
TGT
Ticket Granting Ticket
Service Ticket
Service
- KDC (Key Distribution Center) = AS (Authentication Server) + TGS (Ticket Granting Server)
- Single point of failure: if KDC goes down, all Kerberos authentication fails
- Tickets are time-limited (default 10 hours) β prevents replay attacks but requires clock sync (NTP)
OAuth 2.0 vs OIDC β Critical Distinction
OAuth 2.0 = AUTHORIZATION
Answers: "What can this app access?"
Delegates access to resources. Issues access tokens (opaque or JWT). Does NOT tell you who the user is β no identity claims.
OIDC = AUTHENTICATION (on top of OAuth)
Answers: "Who is the user?"
Adds an ID Token (JWT) with user claims: sub, email, name, iss, aud, exp. Used for "Login with Google/GitHub."
Federated identity: IdP (Identity Provider) authenticates the user. SP (Service Provider) relies on the IdP's assertion. JIT (Just-In-Time) provisioning: user account is created automatically on first SSO login.
JWT Structure & Security Risks
header (red) . payload (yellow) . signature (green)
JWT payload is BASE64-ENCODED β NOT encrypted!
Anyone can decode the payload. The signature (using the private key) proves integrity, not confidentiality. Never put sensitive secrets in JWT payload.
JWT Security Attacks
| Attack | What Happens | Defense |
|---|---|---|
| alg=none | Attacker changes alg header to "none" β server accepts unsigned token |
Hardcode accepted algorithm to RS256; reject any other value |
| Key Confusion | If RS256 server, attacker uses RSA public key as HMAC secret for HS256 signing | Never accept HS256 when configured for RSA; validate alg on every request |
| Missing exp | Expired token accepted because server doesn't validate exp claim |
Always validate exp β reject tokens past expiry |
| Missing aud | Partner A token accepted by Partner D service β cross-tenant token abuse | Validate aud claim matches the service receiving the token |
Key Terms
- OAuth 2.0 = AUTHORIZATION (not authentication). OIDC adds authentication on top via the ID Token.
- SAML = enterprise browser SSO (XML); OIDC = modern API/mobile (JWT). On the exam: mobile app SSO = OIDC.
- Kerberos KDC = single point of failure β if KDC goes down, authentication fails for entire domain.
- JWT payload is BASE64-encoded β NOT encrypted β sensitive data should never go in JWT payload.
- alg=none attack: if server doesn't validate the algorithm header, an attacker can send an unsigned token that gets accepted.
- Verify
algheader is hardcoded to RS256 β rejectnoneand HS256 (key confusion risk). - Validate
expclaim on every request β reject tokens past expiry. - Validate
audclaim β Partner A token must be rejected by Partner D service (prevents cross-tenant abuse). - Validate
issclaim β tokens must be from Platform C's own issuer only. - Short-lived access tokens (15 min) + refresh token rotation β limits window of token theft exposure.
- Private RSA signing key stored only in Vault β rotation schedule documented and tested.
Practice Quiz
Q1. OAuth 2.0 vs OIDC β which protocol provides authentication (identity), and which provides authorization (access)?
βΌ Reveal Answer
Q2. A developer decodes a JWT and reads the user's email and role from the payload. Should they trust this data for authorization decisions?
βΌ Reveal Answer
Q3. A Kerberos KDC experiences a hardware failure at 9am on a business day. What is the immediate impact?
βΌ Reveal Answer
Q4. What is the alg=none attack in JWT, and what configuration prevents it?
βΌ Reveal Answer
Q5. A mobile app needs SSO β the user logs in and the app receives identity information (name, email) plus a token to call APIs. Which protocol combination should be used?