The Simplest Way to Make SAML and Webauthn Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Using saml and webauthn together binds strong hardware keys to central user roles. This setup lets teams log in with phishing-resistant keys while passing group rules to apps. SAML handles how an identity provider shares user roles with a service provider. WebAuthn checks the person at the keyboard using a local device key or touch sensor. When you pair them, you get both strong local checks and central role control. How saml and webauthn share login state and roles The login flow starts whe

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Using saml and webauthn together binds strong hardware keys to central user roles. This setup lets teams log in with phishing-resistant keys while passing group rules to apps.

SAML handles how an identity provider shares user roles with a service provider. WebAuthn checks the person at the keyboard using a local device key or touch sensor. When you pair them, you get both strong local checks and central role control.

How saml and webauthn share login state and roles

The login flow starts when an engineer opens an internal app or tool. The app sends a SAML request back to the central identity provider. Before the provider signs a SAML response, it asks for a WebAuthn check.

The browser talks to the hardware key or laptop sensor to sign a challenge. WebAuthn checks the domain name so a fake site do not receive unmasked the login. Once the key signs the challenge, the identity provider knows the user is real.

Next, the provider builds an XML assertion that holds the user email and group roles. It signs this message and sends it back to the waiting app. The app reads the group claims and sets up the right local permissions.

This division of work keeps your systems clean and easy to run. WebAuthn stops phishing at the front door using public key crypto on the device. SAML moves the user identity across domain lines without sharing raw passwords.

Common failure modes and how to scope roles

Teams still hit big security gaps when they stop at browser sign-in. Many internal databases and command line tools cannot read SAML messages or WebAuthn prompts. Engineers often fall back to shared service accounts or long-lived static keys for these tools.

Broad tokens and shared logins erase the trail of who ran which query. If five people share one admin account, your logs show only that shared name. Worse, an attacker who steals a local token skips your SAML and WebAuthn checks.

SAML 2.0 + FIDO2 / WebAuthn: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Another failure happens when apps ignore the auth context inside the SAML message. If an app does not check that WebAuthn ran, weak passwords might slip through. You must set rules so the app rejects any login without a hardware key check.

To fix this, scope every SAML role to the smallest set of permissions needed. Map specific groups in your identity provider to narrow roles inside each target system. Keep session times short so users must tap their WebAuthn key again for sensitive work.

You should also watch for sensitive data returning from those sessions. Masking rules can rewrite emails, phone numbers, card numbers, and national IDs in query results. This keeps private records safe even after a user passes every login check.

Keeping audit logs clear across both tools

Good security needs a clear link between the hardware key check and the final action. When the identity provider finishes the WebAuthn step, it logs a unique event ID. Pass user traits from that event into your downstream app logs.

Review these logs often to spot unused roles or odd login times. Drop old group claims from SAML responses so retired roles cannot grant lingering permissions. Clean role mapping makes every login check count from start to finish.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

Can WebAuthn replace SAML on its own?

No, WebAuthn only checks the user and device at login time. You still need SAML or a similar protocol to send user roles between domains.

How do we make sure SAML required a WebAuthn key?

Your identity provider sets an auth context value inside the signed SAML assertion. Set up your target app to read that value and reject weak login methods.

What happens if an engineer loses their WebAuthn hardware key?

Let users register at least two keys in your central identity provider. An admin can also revoke the lost key and issue a temporary recovery check.

The query runs. The emails stay hidden.