Skip to main content

Identity Platform

1. Executive Summary​

An identity platform is the authoritative system for authentication (proving who you are), authorization (what you may do), and identity lifecycle (provisioning, federation, offboarding) across workforce employees, customer users, and machine workloads. Modern platforms unify Workforce Identity (SSO via SAML/OIDC to corporate apps), Customer Identity and Access Management (CIAM) (registration, social login, MFA for B2C), and machine identity (SPIFFE, workload JWTs, service accounts) under consistent policy engines and audit.

Principal architects design identity platforms when fragmented login systems create security gaps, compliance failures, and poor user experience. This chapter covers a reference architecture serving 50M customer identities, 20K employees, 8K microservices—with OIDC as primary protocol, RBAC + ABAC policy layering, step-up authentication for sensitive actions, and zero standing admin access integrated with Zero Trust Architecture.

Safety: authentication failures deny access; authorization is default-deny. Liveness: cached JWKS and session stores must survive IdP degradation within defined bounds without bypassing MFA.

2. Why This Topic Matters​

Identity is the control plane of security:

  • Credential stuffing attacks exploit password reuse.
  • OAuth misconfiguration causes cross-tenant data leaks in SaaS.
  • Stale workforce accounts remain active after termination.
  • B2B federation (SAML) errors break enterprise deals.

Principal interviews test OAuth2 flows, token lifetimes, refresh rotation, SCIM provisioning, and how identity integrates with API platforms and secrets management—not "we use Okta" without depth. Follow-ups on token binding, session fixation, and break-glass admin separate levels.

3. Problems Being Solved​

ProblemPlatform capability
Password fatigueSSO; passwordless passkeys
MFA enforcementAdaptive risk-based step-up
Customer registrationCIAM with social IdPs
B2B enterprise SSOSAML/OIDC federation per tenant
Service-to-service authmTLS + JWT with audience claims
Provisioning lagSCIM sync from HRIS
Audit and complianceLogin logs; access reviews
Privileged accessPAM integration; just-in-time roles

4. Assumptions and System Model​

Functional​

  • Workforce SSO to 200+ SaaS apps via SAML/OIDC.
  • Customer sign-up, login, password reset, MFA enrollment.
  • OAuth2 authorization server for first-party and partner APIs.
  • Admin console for role assignment and access reviews.
  • SCIM inbound from Workday/Okta for user lifecycle.
  • Machine auth: K8s SA tokens → OIDC → service JWT.

Non-functional​

  • Login p99 < 500 ms (excluding external IdP latency).
  • Availability 99.99% for auth endpoints.
  • Global deployment with data residency per region for CIAM PII.
  • Support 10K auth RPS peak (product launch).
AssumptionImplication
OIDC preferred over customStandard libraries; interoperable
Tokens are bearer unless boundShort TTL; rotation; mTLS where possible
HRIS is source of truth for workforceSCIM deprovision within 1 hour of termination
Customers may use social loginAccount linking; email verification
Regulations vary by regionEU data in EU; consent logging

5. Essential Terminology​

TermDefinition
IdPIdentity Provider—authenticates users
SPService Provider—relies on IdP (SAML term)
OIDCOpenID Connect—identity layer on OAuth2
SAMLXML federation standard for enterprise SSO
CIAMCustomer Identity and Access Management
SCIMCross-domain user provisioning protocol
RBACRole-Based Access Control
ABACAttribute-Based Access Control
MFAMulti-Factor Authentication
Refresh token rotationNew refresh on each use; detect reuse
JWKSJSON Web Key Set for token verification
PasskeyWebAuthn/FIDO2 passwordless credential
B2B federationPer-tenant enterprise IdP trust

6. Core Mechanism​

6.1 Identity platform architecture​

Figure 1: Unified identity platform—workforce federation, CIAM, and machine OAuth in one policy plane.

6.2 Authorization code flow (customer login)​

Figure 2: OIDC authorization code flow with optional adaptive MFA.

6.3 Token and session model​

Figure 3: Short-lived access tokens; refresh rotation detects theft.

6.4 Deep dives​

B2B multi-tenant federation:

  • Each enterprise tenant configures SAML metadata or OIDC discovery URL.
  • Email domain routing: @acme.com → Acme IdP.
  • JIT provisioning creates user with tenant_id claim.

Authorization layering:

  1. Coarse RBAC: billing_admin, viewer.
  2. ABAC: resource.owner_id == subject.user_id.
  3. ReBAC (optional): Google Zanzibar-style relationship tuples for sharing graphs.

Machine identity:

  • SPIFFE ID spiffe://prod/ns/payments/sa/api in JWT sub.
  • Audience claim aud: payments-api enforced at gateway and service.

Offboarding:

  • SCIM DELETE or active: false → revoke all sessions within 60 s.
  • Event to API platform to invalidate outstanding refresh tokens.

7. Step-by-Step Walkthrough​

7.1 Employee SSO to internal tool​

  1. Employee visits analytics.corp.com.
  2. SP redirects to corporate IdP (OIDC).
  3. IdP asserts MFA satisfied; returns ID token + access token.
  4. SP validates JWT signature via JWKS cache.
  5. SP maps groups claim to RBAC roles.

7.2 Customer passkey enrollment​

  1. Logged-in customer opts into passkey.
  2. WebAuthn challenge from platform; credential stored hashed.
  3. Next login: passwordless assertion; risk score low → no SMS MFA.

7.3 OAuth misconfiguration incident​

  1. Mobile app uses implicit flow (legacy)—token in URL fragment leaked via referrer.
  2. Fix: migrate to PKCE authorization code; rotate client secret.
  3. Postmortem updates Architecture Governance OAuth standards.

7.4 Service-to-service call​

  1. Payment service requests token from AS with client credentials + mTLS.
  2. JWT contains scope: payments.write and SPIFFE sub.
  3. Ledger service validates aud and scope before accepting write.

7.5 Regulatory audit of access decisions​

  1. Auditor requests proof that terminated employees lost access within policy SLA.
  2. Export IdP audit log + SCIM event stream + session revoke events correlated by user_id.
  3. Identify 3 accounts exceeding 60-minute SLA—root cause delayed SCIM from contractor agency.
  4. Action: webhook from agency HR system; daily reconciliation job; dashboard for security review.
  5. Principal deliverable: access lifecycle diagram linking HRIS → SCIM → session store → API gateway blocklist—referenced in SOC2 evidence binder.

7A. Integration Summary​

ConsumerIdentity capabilityContract
API PlatformOAuth AS, JWT validationaud, scope, tenant_id
Secrets Management PlatformWorkload JWT authSPIFFE sub binding
Zero Trust ArchitectureMFA, posture, federationContinuous session risk
SaaS appsSAML/OIDC SSOAttribute mapping per app

8. Invariants and Guarantees​

PropertyTypeMechanism
AuthN before sessionSafetyCredential verify first
Default deny AuthZSafetyExplicit policy grants
Token signature integritySafetyAsymmetric keys in HSM
Refresh reuse detectionSafetyRotation family revoke
Session invalidation on offboardSafetySCIM + event bus
Login availabilityLivenessMulti-region IdP replicas

9. Failure Scenarios​

ScenarioMitigation
IdP regional outageSecondary region; cached JWKS
JWKS rotation lagKey overlap period; kid header
SCIM delay on terminationHR webhook + daily reconciliation
MFA provider downBackup factor; break-glass policy
SAML clock skewSkew tolerance; NTP monitoring
Token theftShort TTL; rotation; binding
Directory split-brainSingle writer region; CRDT not typical
DDoS on /loginCDN + CAPTCHA + rate limit

10. Performance Characteristics​

10K auth RPS peak
Session store: Redis cluster &lt; 5 ms p99
JWT validation at gateway: local JWKS cache &lt; 1 ms
SCIM bulk sync: async queue; not hot path
Password hash: Argon2id tuned to ~200ms (anti-brute-force)
Directory read: replicated LDAP/DB with read replicas

11. Scalability Limits​

LimitMitigation
Session store memoryShorter session TTL; stateless JWT where safe
SAML XML parsing CPUDedicated federation workers
JWKS fetch stormCDN cache; push key update webhook
Global user countShard directory by region
Policy evaluation complexityCompile policies; cache decisions briefly

12. Operational Considerations​

  • SLO: 99.99% auth endpoint; 100% SCIM deprovision within 1 hour SLA.
  • Dashboards: login success rate, MFA adoption, federation errors, token grant rate.
  • Runbooks: key rotation, IdP metadata update, mass session revoke.
  • Quarterly access reviews for privileged roles.
  • Game day: primary IdP failure; verify read-only mode messaging.

13. Security Considerations​

  • PKCE mandatory for public clients; no implicit flow.
  • Secure cookie flags: HttpOnly, Secure, SameSite=Lax.
  • Rate limit login; credential stuffing detection.
  • Admin actions require step-up MFA and PAM session recording.
  • GDPR: consent logs; right-to-erasure workflow for CIAM.
  • Integrate secrets for signing keys via Secrets Management Platform.

14. Cost Considerations​

Okta/Auth0/Azure AD B2C licensing per MAU for CIAM. Self-hosted Keycloak reduces license but increases ops. MFA SMS costs add up—push WebAuthn. Engineering: custom policy engine vs OPA sidecar.

15. Production Implementations​

SystemPattern
Okta / Azure ADWorkforce SSO leader
Auth0 / CognitoCIAM patterns
KeycloakSelf-hosted OIDC/SAML
Google IdentityB2B workforce
SPIFFE/SPIREWorkload identity

16. Alternatives and Tradeoffs​

DecisionTradeoff
Central IdP vs per-app authSecurity vs migration cost
Stateful session vs JWT-onlyRevocation speed vs scale
SAML vs OIDC for B2BEnterprise demand vs modern DX
SMS MFA vs WebAuthnReach vs phishing resistance
Zanzibar vs RBACExpressiveness vs complexity
Build vs buy CIAMTime vs customization

17. Common Misconceptions​

MisconceptionReality
"JWT means stateless forever"Revocation needs blocklist or short TTL
"OAuth is authentication"OAuth is delegation; OIDC adds identity
"MFA once per device forever"Step-up for sensitive actions
"Service accounts don't need rotation"Machine creds need lifecycle too
"SAML is legacy only"Still required for enterprise RFPs
"Groups in token are enough"Fine-grained ABAC often needed

18. Principal Architect Perspective​

  • Identity is platform, not per-team login page.
  • Optimize for offboarding speed—slow deprovision is a breach waiting.
  • Token design is API contract—claims must be stable and documented.
  • Federation errors are revenue risks for B2B—monitor obsessively.
  • Machine and human identity converge on OIDC patterns.
  • Partner with security on zero-trust policy alignment.

19. Architecture Review Exercise​

Scenario: Microservice validates JWT but ignores aud and accepts any signed token from corporate IdP.

Review: Cross-service token replay. Enforce audience, issuer, expiry, and scope at gateway and service. Document in API standards.

20. Whiteboard Explanation​

"Workforce users federate through SAML or OIDC to our central authorization server. Customers use CIAM with passkeys and adaptive MFA. The OAuth server issues short-lived access JWTs and rotating refresh tokens. SCIM from HRIS deprovisions within an hour. Machine workloads get SPIFFE-based client credentials. Policy engine combines RBAC roles with ABAC attributes. API gateway validates JWKS with cached keys. Privileged admin uses PAM with just-in-time elevation. All login and admin events go to immutable audit for compliance."

21. Interview Questions​

  1. Design identity for B2B SaaS with enterprise SSO. — Signals: SAML/OIDC per tenant, JIT provision. Red flags: one password DB.
  2. OAuth2 flows compare? — Signals: auth code+PKCE, client credentials. Red flags: implicit for SPAs.
  3. Refresh token rotation? — Signals: reuse detection, family revoke.
  4. JWT validation checklist? — Signals: sig, exp, iss, aud, scope.
  5. SCIM offboarding latency? — Signals: event-driven session revoke.
  6. MFA bypass risks? — Signals: step-up, risk engine. Red flags: permanent device trust.
  7. RBAC vs ABAC? — Signals: layering, policy engine.
  8. Machine identity at scale? — Signals: SPIFFE, short-lived JWT.
  9. Cross-region CIAM data residency? — Signals: shard directory, consent.
  10. Passwordless rollout? — Signals: WebAuthn, fallback factors.
  11. B2B SAML debugging? — Signals: metadata, clock skew, attribute mapping.
  12. Break-glass admin access? — Signals: PAM, time-bound, audited.

22. Interview Follow-Ups​

  1. Token stolen from mobile app storage. — Short TTL, binding, secure enclave.
  2. Enterprise IdP cert expires unnoticed. — Metadata monitoring alerts 30d prior.
  3. Acquire company with separate IdP. — Federation bridge; gradual directory merge.

22A. Production Low-Level Design (Interview + Game Day)​

Identity LLD: IdP control plane (users, sessions, policies) + token data plane (issue/validate).

Context diagram​

Step-by-step flow:

StepAction
1–2Authenticate; issue tokens
3Resource servers validate
4Lifecycle automation

Production stack​

LayerChoiceRole
IdPOkta / Keycloak-classSSO
DirectorySCIM syncSource of truth
MFAWebAuthn / TOTPAssurance
FederationSAML / OIDCApps
PrivilegedPAM / JITStanding priv kill
AuditSIEMTerminations

API + schema​

POST /oauth/token
POST /logout
POST /admin/users/{id}/disable
POST /scim/v2/Users
EntityFields
userid, status, attrs, mfa
sessionid, user, exp, device
tokenjti, aud, exp, scope

Happy-path login​

Failure — termination at 2AM​

Observability + SLO​

SLIIdea
Login success
MFA challenge
Time-to-revokeTermination SLO
Token validate latency

22B. Game Day Playbooks​

Catalog​

IDDrillInjectSignal
GD-1Immediate terminateFire userSessions dead
GD-2IdP region outageFailoverLogin SLO
GD-3Token alg confusionBad kidReject
GD-4SCIM floodHR sync bugRate / DLQ
GD-5MFA bypass attemptPolicyBlock + alert
GD-6Orphan OAuth clientsSecret leakRotate

GD-1 — Workforce termination (detailed)​

GD-3 — JWT validation hardening (detailed)​

Pass criteria: only approved issuers/algs; termination drill meets minute-level SLO.

23. Strong Answer Example​

Question: "How handle workforce termination at 2 AM?"

Answer this as a 45-minute design discussion using the PRACTICE framework. Below is how a strong student sounds aloud—automated kill chain in minutes, not "HR emails Okta in the morning."

PRACTICE interview answer map for workforce termination at 2 AM

Figure A: PRACTICE map — Problem → Requirements → Assumptions → Capacity → Topology → Invariants → Constraints → Evolution.


Student interview script (PRACTICE)​

P — Problem framing​

"Termination at 2 AM is a security + identity lifecycle problem: the person may still have an active laptop, SSO sessions, refresh tokens, API keys, VPN, and cloud roles. Waiting until morning is an unacceptable exposure window.

Disabling an AD/Okta checkbox is not enough. Long-lived JWTs, refresh tokens, app session cookies, SSH keys, and SaaS SCIM lag can keep access alive.

Short answer: Event-driven offboarding—HRIS → SCIM/deprovision → IdP disable + revoke sessions/refresh → fan-out user.revoked to apps/gateway/PAM—with short access-token TTL, server-side session kill, and an SLA (policy max e.g. 60 minutes; target ~5 minutes automated). On-call runbook if automation fails."

R — Requirements​

RequirementDesign
Works unattended at 2 AMFully automated from HRIS event
Kill interactive SSO quicklyRevoke IdP sessions + refresh tokens
Kill API / gateway accessBlocklist sub / introspection / short JWT TTL
Kill privileged sessionsPAM / break-glass close on revoke
SaaS apps (GitHub, Salesforce…)SCIM deprovision / group removal
Prove it for auditCorrelated timeline HRIS → last successful auth

"I'd ask: contractor vs FTE? High-risk admin? Which apps are SCIM vs JIT-only?"

A — Assumptions (state aloud)​

AssumptionWhy it matters
HRIS is workforce source of truthTermination event must be reliable
Central IdP (Okta/Entra/Keycloak-class)SSO + token issuance hub
Mix of OIDC/SAML apps + APIsDifferent revoke mechanisms
Access JWTs are short-livedCan't wait hours for natural expiry
Some credentials are non-SSOKeys, tokens, certs need explicit disable

"I'd state the exposure metric: time(HRIS terminate → last successful auth)."

C — Capacity​

SCIM / webhook path → low QPS; must be HA (termination is rare but critical)
Session store DEL fan-out → O(sessions per user); fine at human scale
Gateway blocklist → hot cache; TTL ≥ access-token lifetime
Mass layoff edge case → queue + rate-limit SaaS SCIM; prioritize VIP/admin first
Reconciliation job → nightly catch missed SCIM

"I'd optimize for correctness and latency of revoke, not throughput—unless mass RIF."

T — Topology (draw this)​

2 AM termination kill chain

Figure B: HRIS → IdP disable/revoke → apps/sessions/keys/PAM; SLO minutes, not next business day.

Lingering access if you only disable the directory account

Figure C: JWTs, refresh tokens, cookies, API keys, VPN certs, break-glass—each needs an explicit kill.

Layer2 AM action
HRISMark terminated (source event)
IdPDisable login; remove groups; revoke refresh; end IdP sessions
Session storeDEL all sid for user_id
Access tokensShort TTL (e.g. 5–15m) + optional denylist/introspection for high-risk
API gatewayCache sub revoked until tokens expire
AppsSCIM deprovision; SAML/OIDC back-channel logout where supported
Secrets / keysDisable personal access tokens, SSH keys, cloud keys
PAM / VPNKill elevated + network sessions; revoke certs
AuditImmutable log of each step

I — Invariants (safety)​

"Non-negotiable:

  1. Termination is automated—no 'wait for morning email.'
  2. Disable account ≠ revoke tokens/sessions—do both.
  3. Refresh token families revoked (reuse detection still on).
  4. Access token lifetime bounds residual risk after revoke.
  5. Machine/personal keys in scope, not only SSO.
  6. Measurable SLA with alerts when breached.
  7. Break-glass accounts reviewed; never shared with the terminated user."

C — Constraints (second C)​

ConstraintDesign response
Long-lived JWT-only appsForce short TTL or session store; migrate offenders
SCIM-lagging SaaSWebhook + retry + daily reconcile; priority queue for admins
Offline laptop / cached credsDevice management wipe/cert revoke; VPN posture
IdP outage at 2 AMRunbook: emergency gateway blocklist from HRIS feed; status
Contractor agencies delayed HRISContractual SLA; shadow IT inventory
Insider already exfiltrated tokensAssume breach playbook; rotate shared secrets if needed

E — Evolution (prove it)​

Phased delivery:

PhaseDeliverable
M1ADR: offboarding SLO (target 5m / max 60m) + kill-chain matrix
M2HRIS → SCIM webhook → IdP disable + session/refresh revoke
M3user.revoked → gateway blocklist + PAM close
M4SCIM to critical SaaS; PAT/SSH/key disable automation
M5Metric: HRIS→last-auth; alert on SLA breach; chaos terminate test user at night
M6SOC2 evidence binder: sample timelines

Failure modes:

FailureMitigation
Manual Okta click next morningAutomate from HRIS
Disable user, leave refresh validRevoke refresh families
JWT valid for hoursShort TTL + denylist for sensitive APIs
Missed SaaS appInventory + reconcile
No audit trailCorrelate SCIM + session + gateway events

Observability: deprovision lag p50/p99, sessions killed count, refresh revoke count, gateway blocklist hits, last-auth-after-terminate gauge, failed SCIM per app.


Closing line (interview)​

"So for workforce termination at 2 AM, I don't wait for email. HRIS fires SCIM, the IdP disables the user, revokes sessions and refresh tokens, publishes user.revoked so the gateway blocklists the subject and PAM kills elevated sessions, and we SCIM-deprovision SaaS plus disable keys/certs. Access JWTs stay short-lived so residual risk dies in minutes. I'd target ~5 minutes automated with a hard 60-minute policy ceiling, alert on breach, and prove it with time(terminate → last auth) in the audit pack."

Scoring signals​

StrongWeak / red flag
Automated HRIS→SCIM kill chain"HR emails Okta in the morning"
Sessions + refresh + keys, not just disableCheckbox-only disable
Short JWT TTL / gateway blocklistHours-long access tokens ignored
SLA + metric + on-call runbookNo measurable window
SaaS SCIM + reconcileSSO-only thinking
PAM / break-glass includedForget privileged path

Compact outline (if time-boxed to 2 minutes)​

"Automate: HRIS→SCIM→IdP disable, revoke sessions/refresh, user.revoked to gateway/PAM, SCIM SaaS, kill keys. Short access TTL. Target ~5 min, max 60. Measure last-auth-after-terminate. Don't wait for morning email."

24. Weak Answer Example​

Question: "How handle workforce termination at 2 AM?"

"We use Okta and disable users manually when HR emails."

Why weak / red flags: No automation or night-time SLA, no session/refresh/key revoke, no gateway fan-out, no measurable terminate→last-auth—leaves hours of lingering access.

25. Hands-On Exercise​

  1. Deploy Keycloak; configure OIDC client with PKCE SPA.
  2. Implement JWT validation middleware checking aud/iss/exp.
  3. SCIM mock provision and deprovision user; verify session kill.
  4. Configure SAML federation with test IdP; debug attribute mapping.
  5. Extension: Refresh token rotation with reuse detection test.
  6. Extension: OPA policy for ABAC on sample API.

26. Knowledge Check​

  1. OIDC vs OAuth2 responsibility split?
  2. Why PKCE for public clients?
  3. SAML assertion vs OIDC ID token?
  4. What claims belong in access vs ID token?
  5. SCIM operations for offboarding?
  6. JWKS rotation strategy?
  7. Passkey phishing resistance mechanism?
  8. Client credentials flow use case?
  9. Session fixation prevention?
  10. Tenant isolation in B2B CIAM?
  11. When step-up MFA?
  12. SPIFFE ID in JWT benefit?

27. Flashcards​

FrontBack
OIDCIdentity on OAuth2
PKCEPublic client code exchange protection
SCIMAutomated user provisioning
JWKSPublic keys for JWT verify
Refresh rotationDetect token theft via reuse
CIAMCustomer identity management
ABACAttribute-based policy
WebAuthnPasskey standard
aud claimIntended token recipient
FederationTrust external enterprise IdP
Step-up MFAExtra auth for sensitive action
SPIFFEWorkload identity framework

28. Cheat Sheet​

IDENTITIES: workforce | customer | machine
PROTOCOLS: OIDC primary; SAML B2B; SCIM provision
TOKENS: access 15m; refresh rotated; validate aud/iss/exp
MFA: adaptive risk; WebAuthn preferred
FEDERATION: per-tenant metadata; domain routing
MACHINE: client credentials + mTLS + SPIFFE sub
OFFBOARD: SCIM → revoke sessions + refresh
POLICY: RBAC coarse + ABAC fine
AUDIT: all login/admin events immutable
ZERO TRUST: identity + device + context

28A. Principal Interview Deep Dive​

B2B federation failure modes​

Enterprise SSO integrations fail in production for predictable reasons—principal architects prepare:

FailureSymptomMitigation
Metadata cert expiryAll logins fail for tenant30/14/7 day alerts; automated metadata fetch
Attribute mapping driftUser provisioned without roleContract test against IdP sandbox
Clock skewSAML assertion rejectedNTP monitoring; skew tolerance documented
JIT provisioning raceDuplicate usersIdempotent provision by external_id
IdP outageEnterprise customers blockedCached session; status page; contractual RTO

Token design as API contract​

Access token claims must be stable, documented, and minimal:

Required: sub, iss, aud, exp, iat
Tenant: tenant_id (B2B)
AuthZ: scope or roles (prefer scope for APIs)
Avoid: PII in token (email in ID token only)

Breaking change policy: adding optional claims is safe; renaming claims requires new API version. Coordinate with API Platform JWT validation middleware.

Machine identity at scale​

8,000 K8s pods × cert TTL 24h → 333 cert issuances/hour average
SPIRE or mesh CA must automate; manual cert ops impossible
Rotation: rolling pod restart vs hot reload depends on mesh choice
Blast radius: compromised SA in namespace X → policy limits paths to namespace X only

Offboarding SLA as security invariant​

Safety: Terminated employee session invalid within 60 minutes (target 5 minutes automated). Liveness: IdP degradation may delay revoke—document maximum exposure window in risk register.

Measure: time(HRIS termination event → last successful auth)—dashboard for security review.

Interview scenario: OAuth for mobile + SPA + server​

ClientFlowPitfall
SPAAuth code + PKCEStoring refresh in localStorage
MobileAuth code + PKCE + attestationCustom URL scheme hijack
ServerClient credentials + mTLSShared secret in image

Principal answer maps each client to flow with explicit threat mitigation—never one-size-fits-all.

19A. Extended Review Scenario​

Scenario B: Mobile app stores refresh token in localStorage; XSS on marketing subdomain steals token.

Review: Public client must use PKCE auth code flow; refresh token in httpOnly cookie or secure enclave—not localStorage. Implement strict Content-Security-Policy on all subdomains. Short access token TTL (15 min). Refresh rotation with reuse detection revokes token family on theft. Add security regression test in CI scanning mobile repo for forbidden storage patterns.

23A. Additional Strong Answer​

Q: Design B2B multi-tenant identity for SaaS with per-customer SAML.

Outline: Each enterprise tenant record stores IdP metadata URL, attribute mapping (groups → roles), and JIT provisioning rules. Email domain routing resolves tenant on login. SP-initiated and IdP-initiated flows supported. Tenant isolation: tenant_id claim in every token; authorization policies deny cross-tenant API paths. Admin console for tenant self-service metadata upload with validation. Sandbox IdP for integration testing. Monitor federation error rate per tenant—sales alert if enterprise login fails >1%. SCIM outbound optional for provisioned app roster sync.

28B. Extended BOE Walkthrough (Interview Script)​

Interviewer: "Design identity for B2B SaaS with enterprise SSO."

Strong candidate:

"B2B means tenant-per-enterprise with SAML or OIDC federation. Customer users may also use local CIAM with passkeys for SMB segment.

Federation broker routes @acme.com to Acme IdP metadata. JIT provisioning creates user with tenant_id and mapped groups → roles. SCIM from customer optional for roster sync.

OAuth authorization server issues access JWT 15-minute TTL, refresh rotation with reuse detection. Machine workloads use SPIFFE client credentials—separate from human flows.

Offboarding: SCIM or admin disable → revoke all sessions within 60 minutes target. Audit every login and admin action.

Token validation at API Platform gateway: iss, aud, exp, tenant_id required.

Data residency: EU tenants in EU directory shard—legal not optional.

Break-glass admin via PAM with recording—not shared root password."

30. References​

  • OAuth 2.0 RFC 6749 and OIDC Core 1.0 — protocol standards.
  • SAML 2.0 OASIS specification — enterprise federation.
  • SCIM RFC 7644 — provisioning protocol.
  • NIST SP 800-63B — digital identity guidelines.
  • FIDO2/WebAuthn specifications — passwordless authentication.

Distinction: RFC security requirements are normative; vendor IdP feature sets vary; regional privacy law drives data residency implementation choices.

30A. Further reading paths​

Study Zero Trust Architecture for continuous verification model, API Platform for JWT validation at gateway, and Secrets Management Platform for signing key storage. Walk through B2B SAML metadata exchange on paper—principal candidates should explain attribute mapping, clock skew, and certificate rotation without conflating SAML with OIDC.

Lab: Configure Keycloak SAML IdP + OIDC client; test SCIM deprovision kills active sessions. Interview drill: compare authorization code + PKCE vs client credentials—when each applies, what attacks each prevents, and common mobile/SPA misconfigurations that leak tokens.