Skip to content
Get started
Bastionary › Knowledge base › Identity fundamentals

Authentication for government and public-sector SaaS

By Bastionary · Identity fundamentals

A startup can win a government pilot on product quality and still lose the contract at the security questionnaire, because a procurement officer asks whether logins use phishing-resistant MFA, where the identity data physically resides, and how long audit records are retained, and the honest answers are "no," "wherever our SaaS login provider puts it," and "we don't know." Public-sector identity requirements are not negotiable add-ons; they are the gate that decides whether the deal exists.

Phishing-resistant MFA is the table stakes

Government buyers increasingly require that authentication resist phishing, which rules out the MFA most products ship: SMS codes and even TOTP apps can be relayed by a convincing fake login page. What survives is hardware-backed, origin-bound authentication, specifically FIDO2 security keys and passkeys, where the credential cryptographically refuses to authenticate to a domain that is not the real one. If your MFA story is "we send a text," you are not in the conversation.

The practical requirement is to support passkeys and roaming security keys as a first-class factor, allow an administrator to mandate them for a tenant, and refuse to let a phishing-resistant requirement be downgraded to SMS as a fallback, because the fallback is the hole.

// A tenant policy can require phishing-resistant factors only.
// No SMS/TOTP fallback is offered when the policy is strict.
type FactorPolicy = {
  allowed: ("webauthn_platform" | "webauthn_roaming" | "totp" | "sms")[];
  phishingResistantOnly: boolean;
};

function offeredFactors(policy: FactorPolicy): string[] {
  if (policy.phishingResistantOnly) {
    return policy.allowed.filter(f => f.startsWith("webauthn")); // keys/passkeys only
  }
  return policy.allowed;
}
"Phishing-resistant with an SMS fallback" is not phishing-resistant. Attackers simply trigger the fallback. If a tenant requires the strong factor, the weak factors must be removed from the enrollment and recovery flows entirely, including account recovery, which is where fallbacks love to hide.

Data residency decides where you can even sell

Government data frequently must stay within a specific country or region, and sometimes within accredited facilities. This is where multi-tenant SaaS login providers become disqualifying: if your identity data (user records, credentials, session state, audit logs) lives in a provider's global infrastructure you do not control, you cannot truthfully attest to residency. Being able to pin an entire tenant's identity data to a chosen region, and prove it, is often the difference between a yes and a no.

Self-hosting or region-pinned deployment is the usual answer. The requirement extends beyond the primary database to backups, replicas, and logs, all of which must honor the same boundary.

Audit that satisfies a reviewer, not just an engineer

Public-sector contracts come with audit and retention obligations: who authenticated, from where, what they accessed, what changed, held immutably for a defined period that can run to years. This is heavier than the operational logging most products keep. The audit trail must be tamper-evident, exportable in a form a human auditor can read, and retained long after the operational need has passed.

-- Append-only, hash-chained audit events for tamper evidence.
CREATE TABLE audit_log (
  seq         bigserial PRIMARY KEY,
  tenant_id   uuid NOT NULL,
  actor       text NOT NULL,
  action      text NOT NULL,        -- 'auth.login', 'role.grant', 'data.export'
  target      text,
  ip          inet,
  occurred_at timestamptz NOT NULL DEFAULT now(),
  prev_hash   bytea NOT NULL,       -- hash of the previous row
  row_hash    bytea NOT NULL        -- hash(this row || prev_hash)
);
-- Any deletion or edit breaks the chain and is detectable on verification.
Retention cuts both ways. Some records must be kept for years; others, under privacy rules, must be deleted on request or after a fixed window. A single "keep everything forever" policy violates data-minimization requirements as surely as deleting too early violates audit requirements. Model retention per data class.

Standards and interoperability

Agencies run their own identity infrastructure and expect your product to federate with it, which in practice means solid SAML and OIDC support so staff sign in with their existing government credentials rather than yet another password. Mature federation also means handling the agency as the identity authority: honoring their MFA, their session policies, and their deprovisioning, so that when they disable an employee, access to your product ends too.

Continuous checks, not just a login gate

Public-sector security models increasingly reject the idea that authenticating once at the door is enough. The expectation is that access is re-evaluated continuously against current context: the device still meets policy, the session has not exceeded its permitted lifetime, the user's clearance or role has not been revoked since they logged in. A session minted this morning should not grant access this afternoon to someone whose account was disabled at noon. Build revocation that takes effect in seconds across every active session, not at the next natural expiry, because "we disabled them but their session was still valid" is a finding no reviewer accepts.

Accessibility and the long tail

Public-sector software carries accessibility obligations that reach the login screen itself. An authentication flow that cannot be completed with a screen reader or keyboard is not merely poor UX; it can be non-compliant and disqualifying. Phishing-resistant factors complicate this, since hardware keys and passkeys must be enrollable and usable by people with a range of abilities. Provide at least two phishing-resistant enrollment options so a person who cannot use one form of key has another, document the accessible path, and design the auth UI to the same accessibility bar as the rest of the product, because reviewers test it directly rather than taking your word for it.

Winning government work is less about features than about being able to make specific, provable claims about where identity data lives, how strongly it is protected, and how completely it is audited. Those claims are far easier to make when you run the identity layer yourself and can point to the region, the hash-chained log, and the enforced key policy. That control, which a self-hosted platform like Bastionary is built to give, is what turns a security questionnaire from a dealbreaker into a differentiator.

Run it yourself

Bastionary is free, open-source software. Follow the quick start to have it running on your own server, or browse the releases on Git.

Get started