Quick answer: A break-glass account is a tightly limited local login that still works when a tenant's SSO fails. Keep one or two per tenant, protect them with a hardware-key MFA factor, alert on every use, and expire their sessions fast. Log every SSO event with tenant, subject, result and reason, in UTC, hash-chained so tampering shows.
Enforced SSO is the goal of most enterprise deals. Then one morning the customer's certificate rotates, or their Entra ID tenant has an outage, or an admin deletes the app assignment by mistake, and 400 people cannot reach your product. If enforced SSO means there is no other way in, you now have a support incident you cannot fix from your side without bypassing your own security.
Break-glass access and good audit logs are the two pieces that make enforced SSO safe to sell. This last part of the series covers both. I wrote it with help from AI tools and checked it against NIST SP 800-63B guidance on authenticators and the Okta and Microsoft Entra ID documentation on emergency access accounts. Everything here is defensive design for your own application.
📚 Series Navigation — Enterprise SSO & Identity for B2B SaaS
- Part 1: Enterprise SSO Readiness: SAML vs OIDC for B2B SaaS
- Part 2: Validating SAML Responses: Signatures, Audience & Clock Skew
- Part 3: SCIM Provisioning & Deprovisioning That Actually Removes Access
- Part 4: Multi-Tenant Login Routing: Domain Discovery & Enforced SSO
- Part 5: Just-in-Time Provisioning & Role Mapping From IdP Groups
- Part 6 (This Post): Break-Glass Accounts & SSO Audit Logs
Related earlier posts: Step-Up Authentication for Sensitive Actions · Session Lifecycle Hardening: Rotation, Timeouts & Server-Side Revocation
What break-glass is, and what it is not
Break-glass is a deliberately inconvenient emergency door. It is not a second normal login. The design goals:
- It works when the IdP, the SAML certificate or the OIDC discovery endpoint is broken.
- Only a named, tiny set of people per tenant can use it.
- Every use is loud: alerts, audit entries and a short session.
- It cannot become the everyday path that quietly defeats enforced SSO.
Three ways to provide emergency access
| Approach | How it works | Pros | Risks |
|---|---|---|---|
| Tenant break-glass user | 1–2 local accounts per tenant, password + hardware key, exempt from SSO enforcement | Customer stays in control; works offline from IdP | Credentials forgotten or shared; must be tested |
| Vendor-assisted bypass | Your support temporarily disables enforcement after verified request | No standing credentials | Social-engineering target; slow at 3 a.m. |
| Secondary IdP connection | Backup SAML/OIDC connection to another IdP | Still SSO | Rarely set up; same misconfig risk |
In practice I ship the first option as the default and keep the second as a documented, heavily verified fallback. The secondary connection is nice for very large customers, but almost nobody maintains it.
Modelling it in the database
I keep break-glass status as an explicit flag on the membership, never as "user has a password set", because JIT and SCIM users sometimes end up with passwords from old flows.
ALTER TABLE tenant_memberships ADD COLUMN break_glass boolean NOT NULL DEFAULT false, ADD COLUMN break_glass_last_used_at timestamptz, ADD COLUMN break_glass_last_tested_at timestamptz; -- At most two break-glass members per tenant CREATE UNIQUE INDEX one_or_two_break_glass ON tenant_memberships (tenant_id, break_glass_slot) WHERE break_glass = true; ~~~{% endraw %} The {% raw %}`break_glass_slot`{% endraw %} column is 1 or 2, which gives a hard limit without a trigger. ## The login rule Enforced SSO blocks password login for everyone except flagged break-glass members, and those members must use a phishing-resistant factor:{% raw %} ~~~php public function canUsePasswordLogin(Membership $m): bool { if (! $m->tenant->sso_enforced) { return true; } return $m->break_glass && $m->user->hasWebAuthnCredential(); // hardware key or platform passkey only } public function afterBreakGlassLogin(Membership $m, Request $request): void { $m->forceFill(['break_glass_last_used_at' => now()])->save(); session()->put('max_lifetime_minutes', 60); // short session, no remember-me AuditLog::record('auth.break_glass.used', $m, $request, severity: 'critical'); Notification::send($m->tenant->securityContacts(), new BreakGlassUsed($m)); } ~~~{% endraw %} Three details matter. No SMS or email codes for this account: they are the weakest factors and the exact thing an attacker targets. No remember-me cookie. And the alert goes to the tenant's security contacts, not only to the person logging in. ## Testing it before you need it An untested break-glass account is a password nobody remembers. I nudge tenant admins to test quarterly and record the result in {% raw %}`break_glass_last_tested_at`. In the admin UI, a tenant with enforced SSO and no successful test in 90 days gets a visible warning. For timestamps in alerts and support tickets, I keep everything in UTC; when someone sends a Unix time from a log line, a quick [Unix timestamp converter](https://pixelvalut.com/tools/unix-timestamp-converter?utm_source=devto&utm_medium=series&utm_campaign=break-glass-accounts-sso-audit-logs) avoids off-by-five-hours mistakes across time zones. ## What to log for every SSO event Most SSO incidents I have debugged were slow because the logs said "login failed" and nothing else. This is the shape I use: ~~~json { "ts": "2026-11-22T07:14:03.512Z", "event": "auth.sso.failed", "tenant_id": "t_8f21", "connection_id": "saml_okta_01", "subject": "00u1a2b3c4", "email_domain": "example.com", "reason": "audience_mismatch", "detail": "expected https://app.example.io/saml/t_8f21", "ip": "203.0.113.24", "user_agent_hash": "9c1f...", "request_id": "req_71b9", "prev_hash": "4e07...", "hash": "b2d9..." } ~~~ Things I deliberately include: a machine-readable `reason` from a fixed list (signature_invalid, audience_mismatch, clock_skew, unknown_connection, user_deprovisioned), the connection ID, and the request ID that ties the log to traces. Things I deliberately leave out: the raw SAML assertion, ID tokens, and full email addresses in high-volume logs. Domain is usually enough for debugging, and tokens in logs are a breach waiting to happen. The events I always record: - SSO login success and failure, with reason - Break-glass login, failed break-glass attempt, and break-glass flag changes - Enforcement turned on or off, and by whom - SAML certificate or OIDC client secret rotated - Group-to-role mapping edits (from Part 5) - SCIM deactivation and reactivation (from Part 3) ## Making logs tamper-evident An attacker who gets admin access will try to clean up after themselves. A simple hash chain makes deletion or editing visible. Each entry stores the hash of the previous one: ~~~php $prev = AuditLog::where('tenant_id', $tenantId)->latest('id')->value('hash') ?? str_repeat('0', 64); $payload = json_encode($entry, JSON_UNESCAPED_SLASHES); $entry['prev_hash'] = $prev; $entry['hash'] = hash('sha256', $prev . $payload); ~~~ A nightly job walks each tenant's chain and alerts on a break. For extra safety, ship a daily digest of the last hash to a separate write-once bucket. When I want to check a value by hand during a review, the [hash generator](https://pixelvalut.com/tools/hash-generator?utm_source=devto&utm_medium=series&utm_campaign=break-glass-accounts-sso-audit-logs) on PixelValut is a quick way to confirm a SHA-256 of a known payload. This is not a replacement for a proper append-only store or a SIEM. It is a cheap layer that makes "someone deleted the evidence" detectable. ## Giving customers their own logs Enterprise buyers will ask for audit log export in security reviews. Offer a filtered view in the admin UI, a CSV/JSON export, and, for larger plans, a streaming option to their SIEM through a webhook or S3 delivery. Keep at least 12 months of retention for auth events; many customer questionnaires ask for it. ## Diagnostic checklist - [ ] Each SSO-enforced tenant has 1–2 break-glass members, no more - [ ] Break-glass login requires a WebAuthn factor, no SMS or email OTP - [ ] Break-glass sessions are short and have no remember-me - [ ] Every break-glass use alerts the tenant's security contacts - [ ] Untested break-glass accounts (90+ days) show a warning - [ ] SSO failures log a fixed reason code and connection ID - [ ] Raw assertions and tokens are never written to logs - [ ] Audit entries are hash-chained and verified nightly - [ ] Customers can export or stream their auth logs ## FAQ ### Doesn't a break-glass account defeat the point of enforced SSO? Only if it is easy and quiet. Limiting it to two people, requiring a hardware key, alerting on every use and keeping sessions short keeps it an emergency path, not a back door. ### Who should own the break-glass accounts, us or the customer? The customer. Your staff should not hold standing credentials into customer tenants. Your fallback is a verified support process, not a password. ### What if the customer loses the hardware keys? Treat it like any account recovery: a verified request from a known security contact, a waiting period, and an audit entry. Do not shortcut it because the customer is in a hurry. ### How long should SSO audit logs be kept? Twelve months is a common minimum in enterprise questionnaires. Some regulated customers ask for longer; make retention a per-plan setting. ### Should failed logins include the email address? In the tenant's own audit view, it is useful. In high-volume platform logs, prefer the domain or a hashed identifier to limit personal data exposure. ### Is a hash chain enough to prove logs were not changed? It proves the chain is internally consistent. Pair it with a daily anchor stored somewhere the application cannot overwrite, and an external SIEM for high-value tenants. ## Wrapping up the series Over six parts we went from choosing SAML or OIDC to validating responses, SCIM, tenant routing, JIT role mapping, and now the emergency door and the evidence trail. Together they are what an enterprise security review actually checks. If you are debugging tokens along the way, the [JWT decoder](https://pixelvalut.com/tools/jwt-decoder?utm_source=devto&utm_medium=series&utm_campaign=break-glass-accounts-sso-audit-logs) and the rest of the [PixelValut tools](https://pixelvalut.com/tools/?utm_source=devto&utm_medium=series&utm_campaign=break-glass-accounts-sso-audit-logs) run right in the browser. Thanks for following the whole series. --- ### Follow & Connect - **Website:** [PixelValut Tools](https://pixelvalut.com/tools/?utm_source=devto&utm_medium=series&utm_campaign=break-glass-accounts-sso-audit-logs) - **Watch on YouTube:** [Resume Boost AI](https://www.youtube.com/@resume-boost-ai) · [PixelValut](https://www.youtube.com/@pixel-valut) · [Daily AI News By Ali](https://www.youtube.com/@AIDailyNewsByAli) - **TikTok:** [PixelValut (@pixelvalut007)](https://www.tiktok.com/@pixelvalut007) - **GitHub:** [Muhammad Ali Mughal (@ali111887)](https://github.com/ali111887) - **LinkedIn:** [Muhammad Ali Mughal](https://www.linkedin.com/in/muhammad-ali-m-03434a120/) 