How It Works — Trust¶
Behind every login, every token exchange, every encrypted channel, there is a concrete sequence of steps — a flow. This chapter walks through the flows that establish trust, played frame by frame.
Trusted Third Party¶
The idea underneath every token, JWT, and federation scheme: a party both sides trust vouches for who someone is.
Proving Origin Through a Trusted Third Party¶
Signed Messages — Proving Origin and Integrity¶
JWT — Standardizing Signed Messages¶
Refresh Tokens — Renewing an Expired Access Token¶
Encryption¶
Every later flow assumes secrets can cross the network safely. These flows show how — shared keys, key pairs, agreeing on a key in the open, and combining approaches for real traffic.
Symmetric Encryption — One Shared Key¶
Asymmetric Encryption — Public Key Locks, Private Key Unlocks¶
Diffie-Hellman — Agreeing on a Secret in the Open¶
Hybrid Encryption — Asymmetric to Share a Key, Symmetric for the Data¶
Authentication¶
Proving a human is who they claim to be. Passwords open the section; second factors — one-time codes, hardware keys, passkeys — each close an attack the previous one left open.
Password Signup — Creating an Account¶
Password Login — Checking a Password and Setting a Session Cookie¶
MFA With an Authenticator App — TOTP¶
MFA by SMS — Codes Sent Through the Phone Network¶
MFA With WebAuthn — Signing a Challenge¶
Passkeys — Public-Key Login That Replaces the Password¶
Identity Federation¶
Instead of every site holding its own passwords, one Identity Provider vouches for a user. These flows show the two ways to carry that trust — signatures and lookups — and how OIDC, SAML, SSO, and Kerberos put them to work.
Federation by Signature — The Pattern¶
Federation by Lookup — The Pattern¶
OpenID Connect — Federation by Signature, Modern (JWT)¶
SAML 2.0 — Federation by Signature, Legacy (XML)¶
SSO Pattern — Single Session on the IdP¶
Kerberos¶
Workload Identity¶
The same problem as human authentication, but for services. These flows go from static shared credentials to certificates, and finally to cloud-native identity where the platform itself vouches.
Static Credentials — the Workload's Shared Password¶
mTLS — Services Proving Each Other With Certificates¶
Cloud Workload Identity — the Platform Vouches for the Service¶
Access Federation¶
Once identity is settled, the next step is delegation and inter-service trust — a user letting one app act on their behalf at another, or two services proving each other on the wire.
OAuth2 — Implicit (legacy)¶
OAuth2 — Auth Code without PKCE¶
OAuth2 — Auth Code + PKCE¶
OAuth2 — Client Credentials¶
mTLS Handshake¶
Service Mesh Sidecar¶
CLI Delegation¶
Terminal tools have no browser popup, no callback URL, and no session cookie. These flows show the tricks command-line clients use to obtain a token — running a tiny local server, polling for a code, or shelling out to a plugin.