Login and access for apps: authentication and authorization
04
Key concepts
8 min read · Chapter 4 of 10
01
Entity and identity
What is the unit of record, and how do we know it is the same one?
The records to keep apart: the person, the organization (tenant, workspace or account, depending on the product), the membership linking them with a role, the connection to that organization's directory, each credential (password, passkey, authenticator seed, recovery codes), each session and token, and each non-human identity: service accounts, registered OAuth clients, API keys and agents. One human often holds several identities, such as a work login through SSO, a personal Google login and an old password account at the same domain.
Key every identity on a stable ID from its source: issuer plus subject in OpenID Connect, issuer plus name ID in SAML, the directory's external ID in SCIM. Email changes and gets recycled, and linking accounts because emails match is how attackers set up a takeover before the real user signs up.
Most B2B apps use one global pool of users with memberships (the Slack and GitHub shape), so a person can belong to several organizations; separate pools per customer isolate harder and cost more to run.
02
State and lifecycle
What states exist, and what moves an entity between them?
An account goes invited, active, suspended, deactivated and deleted, sometimes reactivated. A credential is enrolled, verified and revoked; a session is created, refreshed, then expires or is revoked; an enterprise connection goes draft, verified, active and disabled. SCIM moves users through create, update and deactivate, and real directories rarely delete.
The state most systems lack is "decommissioned": tokens, keys and test accounts nobody switched off. Microsoft's Midnight Blizzard breach in 2023-24 started with a password spray on a legacy test account with no MFA, then used an old test OAuth app with high privileges.
Timers define behaviour. NIST's 2025 guidelines suggest ending sessions at the middle assurance level after 24 hours, or one hour idle, and disabling an authenticator after at most 100 failed attempts in a row. Access tokens live minutes and refresh tokens days to months.
03
System of record and ledger
Who owns the truth, and how do systems reconcile?
For enterprise users the app owns fewer facts than its database suggests.
| Fact | Source of truth |
|---|---|
| Whether the user still works there | The customer's directory, fed by HR |
| Their role | The directory's groups or the app; choose deliberately |
| What they may do on each record | The app's permission store |
| Whether a session is live | The identity provider or the app's session store |
| Who did what, when | The app's audit log |
Google's Zanzibar paper treats stored relationships ("Ana is an editor of board 42") as the ledger of access, with a consistency token so a permission removed a second ago isn't missed by a stale read; Google reported over 2 trillion stored permissions and millions of checks a second.
The audit log is the record investigators read. Okta missed file downloads in its 2023 support-system breach for about 14 days because two ways of viewing a file wrote different log events. I'd treat sign-in events (success, failure, factor used, recovery, admin resets) as a record customers can read and export.
04
Rules and policy
What logic decides outcomes, and who can change it?
Permission models come in three families, usually mixed. Roles are simple and auditable until every customer wants a custom one ("role explosion"). Attribute rules (department, region, time) are flexible and hard to explain to an auditor. Relationships handle sharing, folders and nested teams, and need a store and modelling skill.
Where the check runs matters as much as the model. The gateway confirms a token is valid and has the right scope, the service decides whether this user may do this to this record, row-level security in the database filters by tenant as a last line of defence, and hiding a button controls nothing. OWASP's advice: deny by default, implement the check once and reuse it, enforce record ownership, and log failures.
OAuth scopes record consent for an app. A token with "files:read" says what the app may do for the user; the app still has to check what the user may do, and agents widen that gap. The other rules are customers' settings (require SSO for our domain, MFA for everyone, sessions under eight hours, these IP ranges only), which belong in the product as per-organization policy that admins set themselves.
05
Effective dating
Which version of the rule applied at that moment?
Dates I'd keep on a calendar as of October 2026:
| Change | Effective | Status (Oct 2026) |
|---|---|---|
| PCI DSS 4.0.1: MFA for all access to cardholder data | March 31, 2025 | Live |
| NIST SP 800-63-4 final | July 31, 2025 | Live |
| New York's financial regulator: MFA for anyone accessing any system | November 1, 2025 | Live |
| WebAuthn Level 3 becomes a W3C Recommendation | August 25, 2026 | Live |
| Snowflake: password sign-ins need MFA, final phase | August-October 2026 | Rolling out |
| ID-JAG draft (basis of MCP's enterprise extension) expires unless renewed | November 22, 2026 | Upcoming |
| OAuth 2.1 targeted for submission to the IETF's steering group | December 2026 | Upcoming; still a draft |
| EU digital identity wallets due in every member state | December 24, 2026 | Upcoming |
| Clerk bills SCIM separately from SSO | January 1, 2027 | Upcoming |
| HIPAA rule making MFA required for health data | July 2027, reportedly | Proposed |
Inside the product, dates sit on SAML certificates, token lifetimes, invitations, recovery codes and the gap between someone's last day and the moment the app learns of it. A questionnaire written in 2026 may still ask for 8-character passwords with complexity rules NIST dropped in 2025, so ask which version a requirement comes from.
06
Interfaces and standards
What format and protocol do counterparties speak?
| Standard | What it's for | Status (Oct 2026) |
|---|---|---|
| OpenID Connect Core 1.0 | Sign-in on top of OAuth | Final |
| SAML 2.0 | Enterprise SSO | OASIS standard since 2005 |
| SCIM 2.0 | Provisioning users and groups | IETF standard since 2015 |
| OAuth security best practice (RFC 9700) | PKCE for every public client, no implicit or password grants, exact redirect matching | Best current practice since January 2025 |
| OAuth 2.1 | OAuth 2.0 and its best practice in one document | Internet-Draft, version 16 (September 2026) |
| WebAuthn Level 3 | Passkeys in browsers | W3C Recommendation, August 2026 |
| Device authorization (RFC 8628) | Sign-in for command-line tools and TVs | Standard since 2019 |
| Token exchange (RFC 8693) | A service acting for a user | Standard since 2020 |
| AuthZEN Authorization API 1.0 | One request shape for permission checks across engines | OpenID Final, January 2026 |
| MCP authorization | OAuth between AI clients and tool servers | Spec version of July 28, 2026; optional; built on the OAuth 2.1 draft |
The mature standards cover sign-in and provisioning; the ones for machines, agents and authorization are newer, and several are drafts (the MCP specification still cites version 13 of the OAuth 2.1 draft while the IETF is on 16). SCIM says nothing about revoking sessions, which is the gap behind lingering access, and SAML's XML signature layer, where the ruby-saml bugs sat, is the riskiest part to build.
07
Networks and counterparties
Who sits between us and the outcome, and what do they want?
Login runs on federation, trust between systems that don't share a database. Customers' directories (Okta, Entra, Google Workspace) decide how enterprise users arrive and leave, and their quirks set your support load. Credential managers (Apple, Google, Microsoft, 1Password) hold passkeys. Phone carriers and email providers carry codes and reset links, so their weaknesses become yours. Outsourced help desks reset accounts on someone's behalf and are a favourite target: Marks and Spencer's 2025 breach and Clorox's suit against Cognizant both centre on one. Insurers write rules through the MFA questions on their applications.
The trust anchors are concrete: a customer's SAML signing certificate, an identity provider's published signing keys and the DNS record that proves domain ownership, each a way in if checked loosely.
08
Regulatory layering
Jurisdiction × activity × entity type: is it a license or a certification?
No single law covers login. The layers:
| Layer | Examples | What it means for an app |
|---|---|---|
| Platform mandates | Azure, AWS, Google Cloud, GitHub, Snowflake | MFA for your own admins |
| Sector rules | PCI DSS, PSD2, FFIEC and New York's DFS, HIPAA (proposed) | MFA where card, payment, bank or health data sits |
| Standards in contracts | NIST SP 800-63-4, CISA guidance | The password and MFA bar customers ask about |
| Privacy and consumer law | GDPR, the FTC Act, US state laws | "Appropriate" security, judged after a breach |
| Audits and questionnaires | SOC 2, ISO 27001, security reviews, insurers | The day-to-day bar for a B2B app |
For a B2B app the questionnaire usually bites before any law. The strictest layer you face sets your defaults, and enforcers of the vaguer layers use the specific ones as their yardstick: the UK's ICO and the US FTC have both cited missing MFA. Authorization has almost no law behind it.
09
Exceptions and reversals
What goes wrong, and how is it undone?
Every reversal is also an attack path: resets, passkey removal, token revocation, unlinking accounts, disconnecting SSO, role changes, transferring an organization's ownership.
| Exception | The way back | Who starts it |
|---|---|---|
| Lost device | A backup method; synced passkeys survive, device-bound keys don't | The user |
| Locked account | A timer, email link, admin or re-verification, each a recovery path | The user or the risk engine |
| Takeover | Revoke sessions and tokens, reset, notify, review recent changes | Detection, often by an outsider |
| SSO connection fails | The last working settings or a break-glass admin | The customer's admin |
| Leaver still active | Revoke tokens and keys; transfer what they own | An audit or an incident |
Recovery is the exception every MFA rule allows, which is why attackers target it. Money follows its own rules: in the US a consumer's liability for an unauthorized transfer depends on how fast they report it ($50, $500 or unlimited), while a payment someone was tricked into sending usually counts as "authorized". In the EU, if the payer's provider skipped strong authentication, the payer isn't liable unless they acted fraudulently.
10
Liability allocation
When it fails, who pays?
Who pays after a takeover is settled in the contract, by the regulator, in court and by the insurer.
| Failure | Who absorbs it first | How |
|---|---|---|
| Reused passwords, no MFA, on your app | You, then your users | Fines, class actions, notification costs |
| Your identity vendor is breached | You, toward your customers | The vendor's cap: a year of fees in the terms I read |
| A provider's own signing key or bug | The provider in engineering and reputation; customers in clean-up | No fine in Storm-0558 |
| A help desk resets the wrong person | The company that owns the help desk, then maybe its outsourcer | Contract, if proven; Clorox's suit is unresolved |
| A permission check fails | The app | I found no regulator case where that alone was the headline cause |
I read two vendors' terms directly. Okta's master subscription agreement caps liability at the fees paid in the 12 months before the incident, excludes lost data and consequential damages, has no separate cap for security incidents, and makes the customer responsible for activity under its users' logins. Clerk's standard terms (updated October 1, 2026) have the same 12-month cap, cumulative across claims, with no data-breach carve-out. I didn't confirm other vendors' current terms, and negotiated contracts can differ.
"Whoever skipped MFA pays" is only the opening rule. The cap limits what can move to a vendor to a year of fees, against losses that can run to millions. Insurance pays only if your MFA answers were true (in 2022 an insurer had a policy rescinded after the customer overstated its MFA), and 23andMe's class settlement came from insurance and then a bankruptcy estate.