Docs Version v0.2
Docs menu

The sign-in experience

Sign-in flows

Changed 22 min readv0.2

On this page

Introduction

A "flow" is the sequence of things somebody is asked for on the way in: a challenge, a password, a second factor, a notice they have to accept. Signari has built-in flows, which signari flow show prints. To change what people are asked for, you write your own flow as a file.

Because it is a file, you can review it like code and test it in CI, with no database. Signari also refuses to load a flow that could sign somebody in without proving who they are.

This flow asks for a passkey or a password, then a second factor if the person has one. Its two tests say which steps each kind of person sees:

YAMLversion: 1flows:  - name: sign-in    on: authentication    stages:      - {stage: captcha, when: captcha_required}      - one_of:          - {stage: passkey, when: user_has_passkey}          - {stage: password}      - {stage: mfa, when: user_has_second_factor}      - session    tests:      - name: passkey holder        given: {user_has_passkey: true}        expect: [passkey, session]      - name: password and a second factor        given: {user_has_second_factor: true}        expect: [password, mfa, session]

Test it, list every path through it, and install it:

Shellsignari flow test  -flow-file flows.yaml              # in CI: no database neededsignari flow paths -flow-file flows.yaml              # every journey it admitssignari flow apply -org <uuid> -flow-file flows.yaml  # install itsignari flow show                                     # the built-in flows

The Admin API reads and applies the same file at /admin/organizations/{orgID}/sign-in-flow, parsed and tested the same way before it is stored; see the Admin API.

What is different here

A flow that could issue a session without proving who the subject is does not load.

That is checked when the file is parsed: by signari flow test in CI, and again by the engine before it serves anything. It is not a warning and cannot be waived.

A flow that proves nothing

The simplest flow that must never load has two steps:

YAMLstages:  - identify  - session

It asks for a username, finds the account, and signs the person in. Nothing was proved: knowing a username is not evidence of owning it.

A flow that enrols a factor before checking one

This flow looks safer, and is refused too:

YAMLstages:  - identify  - enrol_mfa  - mfa  - session

It appears to enrol a factor and then ask for it. In fact it lets a stranger name an account, attach their own authenticator to it, present that authenticator, and be signed in as its owner. The mfa stage passes, because it proves possession of a secret that the person being asked created two steps earlier.

So there is a second rule: a stage that changes a credential may not run before one that checks a credential. The rule covers password_change as well, which has the same flaw.

The file

Designations

on:what it isrulesendpoint
authenticationsigning inmust prove the subject before a session/login
enrolmentcreating an accountexempt from proof, and may not reach a session/signup
recoveryrestoring lost accessmust prove the subject, from a narrower set of factors/recover, /recover/reset
unenrolmentdeleting one's own accountmust prove the subject before done/account/delete

All four run. unenrolment is the person deleting their own account from /account/delete. The page needs a recent sign-in, refuses an impersonation session, and has the person type their address or username to confirm. The proving stage is that sign-in, each proof counting only for itself as at sign-in. done erases the account as signari erase subject does: the key their data is sealed under is destroyed, every session is ended with each application told through Back-Channel Logout, and the account is deleted, audited account.deleted. The address is then sent one last message. An unenrolment's done is held to the proof rule a session is held to, so [done] is refused. The built-in flow accepts every way in; stages: [deny] closes self-service deletion, and stages: [passkey, done] lets only a passkey sign-in delete.

What a recovery flow governs, and what it refuses

Recovery is two requests separated by an email, so the flow is consulted twice: captcha and identify at /recover, then email_otp, mfa, password_change and the terminal at /recover/reset.

mfa before password_change asks whoever holds the link for a second factor before the new-password form appears: an authenticator app's code, a recovery code, or a code texted to the account's phone. Never an emailed code, which goes to the mailbox the link already proved. Somebody with none is told to ask an administrator, and nothing is changed. The terminal may be session, which ends the reset signed in through the organisation's ordinary sign-in from there; a sign-in flow that wants more than the new password and any factor proven on the way asks for it.

A second factor proven on the link's page also waives the reset delay, with or without an mfa stage. The delay is the window in which somebody who took over the mailbox can be stopped by the owner cancelling, and a second factor is what that somebody does not have. While the delay runs, the page offers the factor in place of waiting, and the reset is recorded as waived by it (account.recovery_factor_proven, then account.password_reset with waived_by).

A stage the engine cannot execute in a recovery journey, such as sms_otp as the proving channel or passkey recovery, refuses the file when it is parsed, like any stage a journey does not run (see Stages). Skipping it would reset the password having proved less than the file requires. A flow that reaches the journey some other way still stops it with a 501 before anything is written, so the credential is left untouched.

The captcha stage at /recover reads the default organisation's flow, not the account's. /recover answers identically whether or not an account exists, and a journey that varied by account would reveal which accounts exist.

Requests at /recover are paced whatever the flow says. An account gets at most one reset link a minute and five an hour, and one address may make twenty requests an hour. A request over the pace writes nothing and sends nothing. In particular it does not supersede the link the person already has, so an attacker cannot keep a victim's link from ever working by asking again every few seconds. It answers with the same page as any other request, so the pace gives nothing away.

Recovery counts fewer factors on purpose. Asking for the password cannot recover a forgotten one, and asking for a second factor on a phone that was lost cannot succeed. What counts: email_otp, sms_otp, passkey, certificate, kerberos, federated, of which a recovery journey runs email_otp today.

Enrolment is exempt from the proof rule because there is no account yet to prove. In exchange it may not issue a session: sign-up decides who exists, and an authentication flow decides who is signed in. A sign-up that issued a session would turn a self-service form into an endpoint that creates an account and signs in to it.

Stages

Proving (these establish the subject):

password, passkey, mfa, email_otp, sms_otp, certificate, kerberos, federated, delegated

Not proving:

identify, captcha, consent, prompt, password_change, enrol_mfa, verify_email, create_user, invitation, external_factor

Terminal (a flow ends in exactly one, and it must be last):

session (issues one), done (finished, no session), redirect (finished, no session, and the browser sent to the step's to), deny (refused)

identify is in the second list because naming an account proves nothing. password_change is there too, because it takes a password but sets a credential rather than checking one.

A flow may name only the stages its journey runs. A file that names any other is refused when it is parsed, naming the stage.

on:stages it runs
authenticationmfa, enrol_mfa, verify_email, external_factor, prompt, password_change and the terminals, which the sign-in acts on; identify, captcha, password, passkey, kerberos, federated, email_otp and consent, which the route that reached the walk settles before it: the sign-in form, the passkey ceremony, the Negotiate exchange, a provider's callback, the emailed code's page, the authorization endpoint
enrolmentcaptcha, prompt, invitation, create_user, deny, done, redirect
recoverycaptcha, identify, email_otp, mfa, password_change, deny, done, session, redirect
unenrolmentpassword, passkey, kerberos, federated, email_otp, settled by the recent sign-in that reached /account/delete, each only by its own proof; deny; done, where the account is erased

The rest wait for a driver: certificate, and sms_otp as a first factor at sign-in. delegated needs none: a password checked against the provider being migrated off arrives as password, so that stage is what names it. The safety rules still know them, so a file naming one is refused for the right reason rather than read as a typo.

Sign-up by invitation, and ending somewhere else

invitation lets a sign-up through only with an invitation that is still good, whatever self-signup rule the organisation has. The invited condition says whether this one carries one, so invited people can be asked less:

YAMLon: enrolmentstages:  - invitation          # sign-up by invitation alone  - create_user  - {stage: redirect, to: "https://intranet.example.com/welcome"}

To ask only the people with no invitation to solve a CAPTCHA, add a stage such as:

YAML  - {stage: captcha, when: not invited}

redirect ends an enrolment or a recovery by sending the browser to to instead of the built-in page: after a sign-up, to an onboarding page; after a reset, back to the application. to is checked when the file is read. It must be an https URL with no credentials in it, or a path on this server starting with a single slash. Another scheme, //elsewhere, and to on any stage but a redirect are refused by name. A sign-up an application asked for with prompt=create still ends on the page that leads back to that application, which is waiting for its answer. A sign-in may not end in a redirect, since its end is the session the parked request resumes from. Nor may an unenrolment, whose done is where the account is erased; that done is also the stage that deletes a person, so the language has no second one.

Requiring somebody to enrol a second factor

enrol_mfa holds the sign-in of somebody with no second factor until they enrol an authenticator app: the enrolment page, then their recovery codes, then the sign-in goes on through the rest of the flow. Somebody with a factor passes it. Written with the challenge, it is "ask for the factor, or make them enrol one":

YAML- password- {stage: mfa, when: user_has_second_factor}- {stage: enrol_mfa, when: not user_has_second_factor}- session

Enrolling proves nothing about who is signing in, since anyone with the password could have done it, so it adds nothing to the session: under this flow the new authenticator is asked for its next code at once, and the session is multi-factor; under password, enrol_mfa, session it is password-only. The enrolment pages answer only a sign-in this stage held, and never for somebody who has a factor, so a password cannot be used through them to replace an existing authenticator. Only an authenticator app can be enrolled here; a passkey is added from the account page.

Confirming a self-sign-up's address

verify_email holds a sign-in until a code sent to the account's address comes back, for an account self-sign-up made under a rule that requires a proved address (signari signup enable, on by default). The built-in flow runs it straight after the proof:

YAML- {stage: verify_email, when: email_verification_pending}

The right code sets the address verified, so ID tokens and /userinfo say email_verified: true, and the sign-in goes on from the start. Accounts an administrator made, or self-sign-ups under a rule with -verify-email=false, have nothing outstanding and pass. A wrong code counts against the same per-account budget as a second factor, and twenty across codes close the confirmation; resetting the password from the emailed link then proves the address instead, as any completed reset does.

A sign-in's proving stage is the proof presented

Somebody reaches a sign-in by exactly one of five routes, and the flow's proving stage must be that route's proof: password for the sign-in form (including a password checked against the provider being migrated off), passkey for the passkey ceremony, kerberos for a Negotiate ticket, federated for an upstream provider, email_otp for a code emailed to the account's address. A sign-in by any other proof is refused, and the refusal is audited as login.failed with the reason flow_requires_another_proof, the stage required and the one presented. Three flows show how a file chooses among the routes:

YAML# Passkeys only: a password, a ticket or a provider is refused.stages: [passkey, session]# Everybody who arrives today, each by name; the built-in flow is this.stages:  - one_of:      - {stage: passkey,   when: proved_by_passkey}      - {stage: kerberos,  when: proved_by_kerberos}      - {stage: federated, when: proved_by_federated}      - {stage: password}  - session# A second factor only for people who came in with a password.  - {stage: mfa, when: proved_by_password}

The proved_by_password, proved_by_passkey, proved_by_kerberos, proved_by_federated and proved_by_email conditions say which route was taken. A journey asking for two of these proofs could only refuse whoever walks it, since nobody arrives by two routes, so it is refused when the file is parsed, naming both: password, kerberos, session is refused, and a second check belongs in mfa. In the example at the top of this page, a passkey holder must use their passkey, and Kerberos and provider sign-ins are refused, because neither is offered.

A federated stage can be pinned to a provider by its slug:

YAML# Everybody signs in through Corp.stages:  - {stage: federated, provider: corp}  - session

A sign-in through any other provider is then refused, audited as login.failed with the reason flow_requires_another_provider. When a pinned provider is the only way in, the sign-in page is skipped and an authorization request goes straight to it, ahead of any login_hint routing. Several federated branches may each name one, and any of those will do; one that names none lets any provider through, whatever the others say. flow apply refuses a provider the organisation does not have enabled, since it would refuse everybody who signs in.

A flow a Kerberos ticket is the only way into (kerberos, session) skips the page the same way: an authorization request goes to /login/kerberos carrying itself, and the ticket comes back to it signed in. That happens only on a host with a keytab for the organisation, its own Kerberos realm's or, on a host with none, the deployment's for its first organisation; anywhere else the page is shown, since the Negotiate route there answers 404. See Kerberos.

A flow that names only password refuses passkey, Kerberos and provider sign-ins. Add them as one_of alternatives to admit them. signari flow paths shows every journey a file admits.

Asking a service of your own

{stage: external_factor, factor: push} sends the browser to a service you registered and believes the answer it signs: signed challenge out, JWS back from a public key you registered, amr from a set you declared. It is asked of somebody already proved, so it follows a proving stage rather than replacing one, and factor is required. Steps answered by your own service is the contract.

Signing in with an emailed code

No built-in flow takes a code to the mailbox as the whole sign-in, because it is no more secure than the mailbox. A flow that names it turns it on, and the sign-in page then offers Email me a code instead:

YAMLstages:  - one_of:      - {stage: email_otp, when: proved_by_email}      - {stage: password}  # Ask an emailed sign-in for an authenticator, when the person has one.  - {stage: mfa, when: user_has_second_factor}  - session

The session records amr otp, one factor. After an emailed code, user_has_second_factor does not count email as a second factor, and the code page neither sends nor accepts an email code, because the same mailbox twice is still one factor. Email codes covers the pages, the pacing and what is withheld from somebody guessing names.

Conditions

A when: is one condition, optionally negated with not. There is no and or or: a flow needing two facts writes two steps.

user_has_second_factor, user_has_passkey, user_is_new, password_change_required, prompts_pending, consent_required, captcha_required, risk_elevated, device_managed, device_compliant, network_trusted, client_requires_mfa, kerberos_available, migration_pending, federated_source, email_verification_pending, proved_by_password, proved_by_passkey, proved_by_kerberos, proved_by_federated, proved_by_email, invited, provider_condition

The list is closed, and a condition outside it is refused at parse. So a typo is an error, not a stage that never runs. The closed list also makes the analysis possible: these are the only things a flow can branch on, so "every path" is a set that can be walked.

A flow may branch only on what its journey evaluates. A condition the engine cannot answer would read false every time, so a step-up written as {stage: mfa, when: user_is_new} would pass its own tests (which set the condition true) and never ask anybody for anything. Such a flow is refused when it is parsed, naming the condition: by signari flow test, by signari flow apply and by the engine's load alike.

on:conditions it evaluates
authenticationuser_has_second_factor, user_has_passkey, password_change_required, prompts_pending, client_requires_mfa, risk_elevated, email_verification_pending, and the five proved_by_*; provider_condition, device_managed, device_compliant and network_trusted, which your own service answers through the flow_condition hook; captcha_required only as the condition of the captcha stage, because a sign-in settles the challenge at the form before the flow is walked
enrolmentcaptcha_required, invited (the sign-up carries an invitation that is still good), prompts_pending (always false: there is no account yet to have one)
recoverycaptcha_required
unenrolmentthe five proved_by_*: which way the person signed in to reach the page

The rest of the list (user_is_new, consent_required, kerberos_available, migration_pending, federated_source) is part of the language, so a file naming one is understood rather than mistaken for a typo, and no journey evaluates it yet.

What a provider answers reads false when no provider is registered, or when one registered fail_open does not answer, and signari doctor warns about a flow that asks with nobody to answer. One registered fail_closed that does not answer refuses the sign-in. A flow's own tests set these like any other condition, so both branches can be tested in CI with no service running.

risk_elevated holds when the sign-in could not have followed the person's last one (impossible travel), or comes from a country they have never signed in from. Both need a GeoIP source, SIGNARI_GEOIP_DB or SIGNARI_GEOIP_STATIC (see configuration), and history: with neither, nothing fires, so a first sign-in, or a deployment with no database, is never stopped for want of a signal. {stage: mfa, when: risk_elevated} asks for the second factor only then.

A stored flow that breaks this rule, as one written to the table directly can, does not load. That organisation is served the last flow that loaded, or the built-in one after a restart. The engine logs the refusal once per document, and signari doctor reports it as critical, naming the organisation.

one_of

A group of branches, of which exactly one runs, is written like this:

YAML- one_of:    - {stage: passkey, when: user_has_passkey}    - {stage: password}

Exactly one branch runs: the first whose condition holds, and the last branch has no condition, so there is always one. The last branch must be the default, so that the group always has a branch to run.

Written instead as two conditional stages:

YAML- {stage: passkey,  when: user_has_passkey}- {stage: password, when: not user_has_passkey}

…the file is refused. A person reads those two conditions as exhaustive; the analysis cannot, so it must consider the path where both are false, and that path reaches a session having proved nothing. one_of states the same thing in a form the analysis can check.

This is the one place the analysis refuses something safe. It is sound (it never admits an unsafe flow) and deliberately incomplete: a false refusal costs an error message, and a false acceptance gives a stranger a session.

Tests are required

A flow file with no tests: does not load, and the cases run every time the file is parsed, not only under flow test. A flow whose stated intent disagrees with its behaviour is refused rather than deployed. The same rule applies to policy files.

expect: is the exact ordered sequence, not a set. A test fails on a flow that runs a stage it did not expect, and on one that skips a required stage, which is the kind of fault that lets someone in.

flow paths

With no file given, it lists the journeys of the built-in flows:

Text$ signari flow paths  the built-in flows (no -flow-file given)  default-sign-in (authentication)    password -> session                                         nothing in particular    captcha -> password -> session                              captcha_required    passkey -> session                                          proved_by_passkey    captcha -> passkey -> session                               captcha_required, proved_by_passkey    kerberos -> session                                         proved_by_kerberos    federated -> session                                        proved_by_federated    password -> mfa -> session                                  user_has_second_factor    ...

It prints every journey the file admits, and the conditions that produce each. A file is written one step at a time, but people go through it one journey at a time, and listing the journeys shows a misconfiguration that reading the steps can miss.

Defaults

A deployment that has written no flow file runs the built-in ones, which give this journey:

Textcaptcha (if required) -> password, passkey, kerberos or federated (whichever was presented)  -> verify_email (if a self-sign-up's address is unproved) -> mfa (if enrolled)  -> prompt (if pending) -> password_change (if flagged) -> session

signari flow show prints that file verbatim, to start from. It is parsed by the same Parse, so the safety analysis and its own test cases run against it in CI: the default journey is held to the same rules as an administrator's file.

What the flow controls today

Applied with flow apply, the file drives the live sign-in:

  • whether a second factor is demanded: when: user_has_second_factor demands one of everybody who has one enrolled; unconditional demands one of everybody; when: client_requires_mfa demands one only when an application sends acr_values=2, or the client requires it (below)
  • which of the post-authentication stages run, and in what order: the prompt and the forced password change
  • refusing outright, with deny

It does not control the password check, the credential lookup, the sign-in throttle, or the rate limiter. Those are not sequencing decisions, and putting them in a file would mean an administrator could turn them off.

The mfa stage binds every way in: password, passkey, Kerberos, Duo and the federated sources all reach a session through the same walk. A sign-in whose factors already add up to multi-factor passes the stage without being asked again. Otherwise the person is asked for a factor enrolled here, and under an unconditional stage somebody with none is refused. A federated sign-in counts as multi-factor only when the provider's ID token asserts it with a value you chose to trust; see a provider's multi-factor authentication.

A registered security key or passkey is one of those factors: after a password, the code page offers a button that asks for it, and password plus key gives a multi-factor session. Anybody who has registered a passkey and signs in with a password is asked for the key as well.

Remembering a device

signari instance remember-device -org <id> -days 30 puts a "remember this device" box on the code page. A browser that ticked it, after a second factor, passes the mfa stage on later sign-ins for that many days, unless the application requires multi-factor, by asking with acr_values=2 or through a floor (below). Such a session records what was proved, the password, so it is single-factor, and a requirement for more is met by asking for the factor again. The browser holds a random token and the database its hash, checked at every sign-in, so a device stops counting at the next one when the person forgets it at /account/devices, when they sign out everywhere, or when the organisation sets -days 0. Off unless set.

Requiring multi-factor for one application

signari client set-acr -client-id payroll -minimum-acr 2 requires multi-factor of that client whatever its request says. An application can ask with acr_values=2; this is for the one that does not, and for a request a person can edit, since the parameter can be removed from the URL. The floor is checked wherever a person's session here gives the client tokens:

  • authorization. A session with a single factor is not reused: the person is asked for a second, and someone with none enrolled is refused with unmet_authentication_requirements rather than shown the sign-in form again. So is someone with a factor whose flow never asks a password sign-in for one and who has no passkey, for acr_values=2 as well: the form could only give them one factor, and would bring them back to it. client_requires_mfa holds for the client's sign-ins, so a flow that demands a factor only on request demands it here
  • a device or backchannel approval from a single-factor session is refused, saying to sign in again with a second factor
  • every refresh. A refresh token from a single-factor session is refused with invalid_grant, so raising the floor reaches the tokens already issued

Token exchange and the JSON Web Token (JWT) bearer grant are not held to it, because neither starts from a session here: one carries a token already issued, the other an assertion from an issuer you trust.

Above multi-factor: a passkey or security key

Two rungs go above 2, as a floor (-minimum-acr 3 or 4) or in a request's acr_values:

3multi-factor that includes a WebAuthn assertion: a passkey that verified the person holding it, or a security key after a password. The assertion is bound to this server's origin, so a page that relays the sign-in cannot obtain one. An authenticator app, a text or a federated sign-in does not reach it
4the same with a key bound to its device. A synced passkey can be copied to another device, so it does not reach 4

These are this engine's rungs, not values another server will recognise. A session records 1 or 2, and an ID token says one of those. A request that asked for 3 or 4 and got it is told that value instead. An account with no key that reaches the rung is refused with unmet_authentication_requirements. With one, the sign-in form says which sign-in the application wants. The floor reaches approvals and refreshes as 2 does.

An organisation with no flow applied runs the built-in file, so nothing changes until somebody applies one.

Not a graph

Flows are a list, when is one condition, and the only branching construct states its own exhaustiveness. Those three restrictions keep the safety question decidable. With arbitrary expressions and a general graph it would become a satisfiability problem, which Signari would have to solve or stop making the guarantee.

See also