Skip to content

Sign in with the organization's own identity provider, and require it #618

Done

Description

@fctl-sh

An organization that runs fctl for its people wants them to sign in the way they sign in everywhere else:

  • with Okta, Microsoft Entra ID, Google Workspace, JumpCloud, OneLogin, Keycloak or another identity provider;
  • under the provider's policies (MFA, device checks, offboarding);
  • with no separate fctl password to forget, phish or leave behind when someone leaves.

fctl signs people in only with a password (with a second factor or passkeys) or with Google, and no setting turns passwords off. Organizations that standardized on Google can't require Google either: an account with a password can still use it. docs/organizations.md says so plainly: "fctl doesn't sign people in through SAML or another OpenID Connect provider".

How it works now

  • Google sign-in (crates/fctl-control/src/api/google.rs) is OpenID Connect with PKCE against Google's fixed endpoints, configured with GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET (Config::google).
    • It links the identity in D1's identities (provider = 'google', subject).
    • It trusts an address only where Google hosts it: Gmail, or a Workspace account's hd (fctl_domain::google::vouches_for).
  • Passwords (argon2id), passkeys and two-factor sign-in (ADR 0022, 0023): InstanceSettings.require_two_factor and two_factor_google, and a workspace's own requirement (workspaces.require_two_factor). That requirement closes the workspace to people who don't meet it (fctl_domain::two_factor::workspace_blocked, fctl_domain::workspace::Membership.blocked).
  • Who may sign up is an allowlist of addresses and *@domain patterns (crates/fctl-domain/src/allowlist.rs), plus invitations.
  • Provisioning. Admin tokens create accounts without a password (ADR 0085, crates/fctl-control/src/api/provision.rs). The docs say their people then sign in with Google, but a Google sign-in refuses any address whose account has no Google identity linked (google_link_required), so in practice they need a reset link first (Accounts that admin tokens create can't sign in with Google, though the docs say they can #613).
  • Sign-ins. A browser's sign-in is a tokens row of kind web; CLI sign-ins (cli) come from the device flow, approved in a browser. Neither records how its person signed in.

What should happen

  • Sign-in providers. Instance admins add OpenID Connect providers under Admin → Sign-in, or with fctl admin sign-in add:
    • Okta, Entra ID, Google Workspace, JumpCloud, OneLogin, Keycloak, authentik, or any issuer with a discovery document;
    • with a name and icon for the button, the client id and secret, the scopes, and the claim that carries groups.
    • Providers live in D1, the secret sealed with the master key, so adding one needs no restart.
    • FCTL_OIDC_* environment variables configure one too, for infrastructure as code.
    • Google becomes one such provider, with what it has today kept as it is.
  • Identities keyed the way each provider is stable.
    • Keyed by (issuer, sub) in identities; for Entra, tid and oid.
    • Never by address: Microsoft says Entra's email claim "isn't guaranteed to be correct and is mutable… Never use it for authorization", and a single-tenant app, which a self-hosted instance's would be, can still receive unverified addresses.
    • A provider's address makes or matches an account only for domains the admin says the provider is authoritative for ("Okta vouches for acme.com and acme.dev"), generalizing vouches_for.
    • OneLogin and authentik (2025.10 and later) don't send email_verified unless set up to, and the setup says so.
    • Existing accounts. A provider's first sign-in links to an existing account at its address only when the provider is authoritative for that domain, and either the account has no sign-in method yet (made by an admin token or SCIM), or the provider is required for the domain, which moves everyone off passwords.
    • Elsewhere, people link a provider from Settings, as they link Google today: linking silently would let one account take over another.
  • A test sign-in first. Saving a provider asks the admin to sign in with it once. fctl shows what it sent (subject, name, address, groups) before anyone else can use it.
  • Requiring a provider. InstanceSettings.sign_in says, per domain, how people at it sign in: "acme.com and acme.dev: Okta only".
    • Passwords and other providers then stop working for those addresses. Passkeys keep working only if the admin allows them (they are quick, but skip the provider's checks).
    • People at other domains (contractors) sign in as before, with the instance's two-factor requirement.
    • The sign-in page asks for the address first and sends people at such domains straight to their provider.
  • A way in when the provider is down. The primary instance owner always keeps their password and passkeys, and the page that requires a provider says so. Optionally, a few named break-glass accounts.
  • A workspace's own requirement: "Acme requires signing in with Okta", beside its two-factor requirement. (for Google: feat(control): let a workspace require Google sign-in of its members #659)
    • Each sign-in records how it was made: a new tokens.auth_method, with CLI sign-ins taking the method of the browser sign-in that approved them.
    • workspace_blocked closes the workspace to sign-ins made another way, until its person signs in again with the provider.
  • Accounts only from the directory (InstanceSettings.self_sign_up, off): nobody creates an account by signing in or with a domain entry, only admin tokens, SCIM (Provision people with SCIM, and give roles from the identity provider's groups #619) and invitations. The sign-in page tells a stranger who to ask.
  • Fields the directory manages are read-only. A provisioned or provider-managed account's name, addresses and picture show "Managed by Okta" in Settings, and change only through the provider, an admin token or SCIM.
  • Session policies (Admin → Sign-in): (feat(control): limit how long sign-ins last, and where they come from #657)
    • how long a browser stays signed in, and how long it may sit unused;
    • how long a CLI sign-in lasts;
    • the longest an access token may last, and whether members may make them at all;
    • optionally, the addresses (IP ranges) the app and API take sign-ins and requests from, with runners' connections and fctl's webhooks exempt.
  • Signing out from the provider. Okta's Universal Logout and OpenID back-channel logout, where a provider offers them, revoke the person's fctl sign-ins at once. Elsewhere, disabling the account through an admin token or SCIM does it, as it does today.
  • SAML through a bridge, documented. Larger organizations ask for SAML, and Google sends groups only to SAML apps. Verifying XML signatures in a WebAssembly Worker is hard to do safely: the Rust crates need OpenSSL and xmlsec, or are young and unaudited, and SAML libraries keep turning up signature bypasses (ruby-saml, March 2025). So document SAML through Keycloak or authentik as an OIDC bridge, and keep native SAML for later.
  • app.fctl.sh only: domain verification. A workspace proves a domain with a DNS TXT record before it may require a provider for that domain or send its people to its provider. Without it, one customer could claim another's domain. Self-hosted instances don't need it: their admins own the allowlist.
  • CLI and docs.
    • fctl admin sign-in (list, add, test, require, policies) with --json.
    • docs/self-hosting.md (a section per provider, with screenshots of each provider's own setup), docs/organizations.md, docs/security.md, docs/api.md, docs/cli.md and docs/llms.txt.
    • fctl-site's privacy policy, if app.fctl.sh takes providers.

Design and UX

Setting up single sign-on is usually a nervous afternoon. In fctl it should take five calm minutes, with no way to lock yourself out and a clear picture of who is affected before anything changes.

  • Admin → Sign-in reads like the instance's front door. A sentence of how people sign in today ("Everyone signs in with a password or Google; 38 people use a password"), then the providers, then the policies.

  • Adding a provider is a guided sheet:

    1. Pick the provider from logos.
    2. Copy fctl's redirect URL, with a one-click copy.
    3. Paste the issuer, client id and secret. Each field says where to find it in that provider's console, with a link.
    4. Test it: sign in in a popup, then see "Okta says you are Ada Lovelace, ada@acme.com, in groups eng, eng-web".
    5. Choose the domains it covers.

    Mistakes show in words: "Okta answered that the redirect URL isn't allowed: add https://fctl.acme.dev/api/v1/auth/oidc/callback to the app's sign-in redirect URIs".

  • Requiring it shows its consequences first. "38 people at acme.com sign in with a password today: their next sign-in goes through Okta, and their passwords stop working. 4 people at other domains keep theirs. You keep your password as the way in if Okta is down." Then one button.

    • The people affected get an email, where the instance sends email.
    • Next time they come back, a banner on the sign-in page explains the change.
  • The sign-in page leads with the provider's button in its own colors and logo ("Continue with Okta"). Typing an address at a covered domain turns the form into that button.

  • In Settings, a managed account shows "Your name and address come from Okta" where the fields were. The sign-in methods section explains why there's no password.

  • The CLI prints the same consequences before fctl admin sign-in require, and asks to confirm unless --yes.

  • Follow hyperstructure/design's docs: docs/principles.md; docs/web-app/explaining.md for pages that set something up (a headline that names the outcome, a lead built from this place's facts, a preview of the result, one primary action, and who can act); docs/web-app/kit.md for controls.

  • Design every state before building it: the first visit, loading, errors and refusals, waiting, partial setups and long lists.

  • Say what happens, plainly, and never leave someone at a disabled control without saying who can act.

  • Prototype the main screens with realistic data (cargo xtask demo's world) and review them before building the rest.

  • Check both themes, a phone's width, the keyboard, screen readers and reduced motion, and show screenshots in each pull request.

  • Give the CLI the same care: readable output, --json, and errors that say what to do next.

  • Add or update the pages of hyperstructure/design's docs for each new component, with the reasons behind its choices.

Compatibility

  • Control plane only. Hosts and agents are untouched.
  • Data.
    • New D1 tables for providers and domain rules, and a new tokens.auth_method column. Sign-ins from before it count as "unknown" and meet no provider requirement, so a workspace that turns one on asks everyone to sign in again once.
    • InstanceSettings gains fields that clients which don't send them keep (fctl_domain::settings::keep_unsent). Older CLIs can't change them.
  • Google sign-in keeps working as it does through the move to providers: same callback URL, same identities.

Decisions for a person

  • Where providers can be set: self-hosted instances only at first, or app.fctl.sh too (which brings domain verification and per-workspace providers).
  • Passkeys under a required provider: allowed by default or not.
  • Break-glass: whether named break-glass accounts exist beyond the primary instance owner.
  • SAML: a documented bridge only, or native SAML on the roadmap.

Related: #619, #614, #613

Session: https://app.fctl.sh/s/ses_01M8450BECFP8DN88R0ZP0N0MS

Activity

  1. added
    enhancement
    control-plane
    web
    cli
    security
    on Nov 23, 2026
  2. fctl-sh commented on Nov 23, 2026

    @fctl-sh
    ContributorAuthor

    Progress: #642 (open) does the part for Google on self-hosted instances, as Carl Oscar asked: "Relevant mostly for Google sign-in currently but make it flexible if we want to support other providers in the future. This is mostly relevant for self-hosted instances of fctl."

    In it:

    • Requiring a provider per domain (InstanceSettings.sign_in, Admin → Sign-in, fctl admin sign-in require acme.com acme.dev). Covered accounts sign in with Google alone as an address there: passwords, personal Google accounts and passkeys alone (unless the rule allows them) stop working. The sign-in page says which domains sign in with Google and turns its form into Google's button for an address there.
    • Each sign-in records how it was made (tokens.auth_method, auth_domain). CLI sign-ins take it from the browser that approved them, and access and admin tokens from the sign-in that made them. Every request checks it, and saving a rule deletes the covered people's sign-ins it doesn't meet, those from before it included.
    • Identities stay keyed by provider and subject, and keep the domain the provider vouched for. A provider's address matches an account only where it vouches for it (Google: Gmail or a Workspace account's). Its first sign-in links to an existing account at a covered domain, unless another Workspace account at those domains is linked already (a recycled address), and once whole it takes the account's password. Admins unlink a recreated account's old one (fctl admin unlink).
    • A way in while Google is down: the primary instance owner keeps their password and passkeys, and the pages say so. An admin can't save a rule that would sign them out until they sign in with Google, which is the test sign-in for Google.
    • Consequences before saving: the preview in the web app and the CLI ("38 people sign in with a password today: their next sign-in goes through Google…"), and an email to each person affected.
    • Accounts only from the directory (InstanceSettings.self_sign_up off).
    • Covered addresses are read-only to their person.
    • Google is one provider: its module hands what Google said to a provider-neutral api::sign_in, which another OpenID Connect provider can use.
    • Docs: self-hosting.md, organizations.md, security.md, api.md, cli.md, llms.txt, architecture.md and ADR 0099. The design docs and the privacy policy are in companion pull requests.

    Left for later pull requests:

    • Other OpenID Connect providers in D1 and FCTL_OIDC_* (Okta, Entra ID keyed by tid/oid, JumpCloud, OneLogin, Keycloak, authentik), with the guided setup sheet, their test sign-in and the domains each vouches for.
    • SAML through Keycloak or authentik as an OIDC bridge, documented, which needs the item above.
    • Session policies: how long a browser and a CLI stay signed in, the longest access token and who may make them, IP ranges.
    • Signing out from the provider (Okta's Universal Logout, OpenID back-channel logout).
    • A workspace's own requirement, and domain verification on app.fctl.sh. For Google, a workspace requirement can't tell an organization's accounts from personal ones without naming domains, so it waits for org-specific providers.
    • Names and pictures managed by the directory ("Managed by Okta"), likely with Provision people with SCIM, and give roles from the identity provider's groups #619.
    • Named break-glass accounts beyond the primary instance owner, if wanted.

    Decisions taken there, listed under its "Worth confirming": rules are instance-wide; passkeys alone are off by default; only the primary instance owner is exempt; a covered person's password goes at their first Google sign-in; requiring Google ends the other sign-ins of covered people at once.

  3. fctl-sh commented on Nov 24, 2026

    @fctl-sh
    ContributorAuthor

    hyperstructure/fctl-site#141 merged (51fc64e) and is live at fctl.sh/privacy: it says each browser session, CLI sign-in and access token keeps how its sign-in was made, and which Google details each sign-in refreshes. app.fctl.sh starts keeping that once #642 merges and deploys; until then the policy describes a little more than it keeps.

  4. fctl-sh commented on Nov 24, 2026

    @fctl-sh
    ContributorAuthor

    hyperstructure/design#78 merged (4926abf): docs/web-app/explaining.md now documents Admin → Sign-in, the sign-in page's provider-led form and what Settings says to someone a rule covers. It is docs only, so the web app needs no new design tag. The section says it was written from #642 ahead of its merge; that note can go once #642 merges.

  5. fctl-sh commented on Nov 24, 2026

    @fctl-sh
    ContributorAuthor

    #642 merged (2eb0658) and is deployed to app.fctl.sh (CI's deploy, 2026-11-24 07:27 UTC). Its CLI commands (fctl admin sign-in, fctl admin unlink, fctl admin set --self-sign-up) ship with the release after v0.37.1. hyperstructure/design#81 merged too: the design docs now name the decision's record, ADR 0099.

    I ticked three items #642 does and verified, with tests and a run against cargo xtask serve (see its description):

    • Requiring a provider: for Google, through the provider-neutral InstanceSettings.sign_in (Admin → Sign-in, fctl admin sign-in require).
    • A way in when the provider is down: the primary instance owner keeps their password and passkeys, and Admin → Sign-in and the docs say so. The optional break-glass accounts weren't built; they stay among the leftovers in my earlier comment.
    • Accounts only from the directory: self_sign_up off. Allowed exact addresses still sign up, as an admin named them, while domain entries don't.

    #647 follows up on three findings from #642's last review round, which merged unanswered:

    • An admin's unlink now signs the person out everywhere.
    • A second-factor code that a rule refuses no longer counts as a wrong attempt.
    • The unlink has tests.

    The rest of this issue (other OIDC providers, session policies, a workspace's own requirement, provider sign-out, the SAML bridge docs, managed fields, domain verification for app.fctl.sh) is still to do.

  6. fctl-sh commented on Nov 24, 2026

    @fctl-sh
    ContributorAuthor

    #647 merged (c545d87) and is deployed to app.fctl.sh (CI's deploy, 2026-11-24 08:31 UTC), with its docs pinned on fctl.sh. An admin's unlink now signs the person out everywhere, and a second-factor code that a rule refuses no longer counts as a wrong attempt. Its CLI wording ships with the release after v0.37.1, with #642's commands. The leftovers listed above are unchanged.

  7. fctl-sh commented on Nov 26, 2026

    @fctl-sh
    ContributorAuthor

    Carl Oscar scoped what's left of this issue to Google sign-in, with other providers moved to new issues. Here's where each open item stands:

    Once #657 and #659 merge, this issue can close, with its leftovers in #650–#653.

  8. fctl-sh commented on Nov 28, 2026

    @fctl-sh
    ContributorAuthor

    #657 merged (ed926ea) and is deployed to app.fctl.sh (CI's deploy, 2026-11-28 10:07 UTC), with its docs pinned on fctl.sh. Its CLI command, fctl admin sign-in policies, ships with the release after v0.38.1. Admins can now set how long browsers and CLIs stay signed in, the longest an access token lasts, whether members make access tokens, and the networks sign-ins come from (ADR 0102).

    The design docs for it, and for #659's pages, are in hyperstructure/design#84. What's left of this issue for Google is #659, a workspace's own requirement: it's up to date with main and all its checks pass. Its privacy policy line is hyperstructure/fctl-site#144, a draft to merge with it. Once #659 merges, this issue can close, with its leftovers in #650–#653.

  9. fctl-sh commented on Nov 29, 2026

    @fctl-sh
    ContributorAuthor

    #659 merged (81f4253) and is deployed to app.fctl.sh (CI's deploy, 2026-11-29 09:07 UTC), with its docs pinned on fctl.sh. A workspace's admins can now require Google of its members at their domains, in its Settings → Access or with fctl workspaces set --require-google acme.com (ADR 0103). --require-google ships with the release after v0.38.1, with #657's fctl admin sign-in policies. The companions are merged too: hyperstructure/design#84 (the design docs for both) and hyperstructure/fctl-site#144 (the privacy policy now says a workspace keeps those domains, live at fctl.sh/privacy).

    I ticked the two items those merges did: session policies (#657) and a workspace's own requirement, for Google (#659). This finishes the issue for Google, as Carl Oscar scoped it, so I'm closing it. What's left lives in new issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    clicontrol-planeenhancementsecurityweb

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions