Single Sign-On
Single sign-on lets the members of your organization sign in with your company's identity provider (any OpenID Connect provider), and lets an Admin make it the only way in. It is set up per organization in Organization > Single sign-on, by an Admin.
How members sign in
On the sign-in page, Continue with SSO asks for your organization (its short name, as in acme-corp) and sends you to your identity provider. After you sign in there, you are back in Zenfra and signed in.
The first time someone signs in this way, Zenfra decides which account they get:
- An account already linked to them signs them in. Each account is linked to one identity at your provider (its issuer and subject), not to an email address, so renaming an email at the provider changes nothing.
- An existing account of your organization with the same email is linked, once, when the provider confirms the email is verified, the email's domain is one of your allowed domains, and the account does not already sign in with GitHub, GitLab or another single sign-on identity. Otherwise the sign-in is refused and the account is left as it was.
- No account creates one: a Member with no access to any space until an Admin adds them to a team with a grant. The provider must confirm a verified email in an allowed domain.
A user is never moved from one organization to another: an email that belongs to another organization's account, or to a deactivated one, is refused.
Single sign-on creates accounts but does not remove them. A person removed at your identity provider can no longer sign in through it, but their Zenfra account stays until an Admin removes it in Organization > Users.
Accounts created this way have no password. If one is later made an Admin, they can set a password with Forgot password.
Setting it up
- At your identity provider, register Zenfra as an application (a confidential client using the authorization code flow). Use the redirect URI shown in Organization > Single sign-on (
https://api.zenfra.cloud/api/v1/sso/callbackfor Zenfra Cloud) and allow the scopesopenidandemail. Zenfra uses PKCE and checks the ID token's issuer, audience, signature, expiry and nonce. - In Organization > Single sign-on, enter the provider's Issuer URL, the Client ID and Client secret it gave you, and the Allowed email domains (one or more, for example
example.com), then Set up single sign-on. Zenfra reads the issuer's OpenID configuration at once and refuses an issuer it cannot reach over HTTPS or one on a private or local network address. - Test sign-in: you sign in through the provider, and Zenfra records that the configuration works. A test signs nobody in and links or creates no account. The page then shows the configuration as Tested.
The client secret is stored encrypted and is never shown again. To rotate it, type the new one in New client secret and Save changes; the allowed domains change the same way. The issuer and client ID cannot change: to move to another one, delete the provider and set it up again.
Each change to the secret or the allowed domains is a new configuration that needs a new test before single sign-on can be required. Changing them while single sign-on is already required is allowed and does not turn it off. Existing sessions continue; new sign-ins use the new configuration, so a wrong secret stops them until an Admin fixes it with the emergency sign-in below. Sign-ins started before the change are asked to start again. Removing a domain affects only future first sign-ins, not accounts already linked.
Requiring single sign-on
Require single sign-on makes your identity provider the only way in for the organization's members. It can be switched on only when:
- the current configuration has passed a test sign-in,
- your own account has a password and multi-factor authentication enabled, so that you keep a way in if the identity provider is unavailable.
While it is required:
- Password, GitHub and GitLab sign-in are refused for members, with a prompt to continue with SSO. Sessions that did not come from single sign-on end on their next request, without signing out first.
- Admins keep an emergency sign-in: email and password followed by a second factor. It is recorded in the audit log as
auth.sso_break_glass. An Admin's GitHub or GitLab sign-in is refused like anyone's, and a member demoted from Admin loses this sign-in at once. - Password reset works only for Admins; for anyone else, a reset request sends nothing.
- Invitations cannot be sent, resent or accepted. New people join by signing in through your identity provider; an Admin then adds them to a team. Pending invitations stay pending.
- API keys keep working. They are not a sign-in; a key still acts with no more than its owner's current role.
Switching it off is always allowed and takes effect at once. The provider cannot be deleted while single sign-on is required.
Multi-factor authentication in Zenfra applies to its own sign-ins (password, GitHub, GitLab). A sign-in through your identity provider does not ask for a Zenfra second factor: configure MFA at the provider.
Deleting the provider
Delete removes the provider. Sessions that came from it end on their next request. Linked accounts keep their identity (issuer and subject): a provider set up again finds them only when it returns the same issuer and the same subject for each person, which some providers do not do for a new client registration. Moving your members to a different identity provider, or to new identities, is not supported yet.
API
| Action | API |
|---|---|
| View the provider | GET /api/v1/organizations/current/sso |
| Set it up, rotate the secret, change the allowed domains | PUT /api/v1/organizations/current/sso with issuer, client_id, client_secret and allowed_domains (afterwards only client_secret and allowed_domains) |
| Delete it | DELETE /api/v1/organizations/current/sso |
| Start a test sign-in | POST /api/v1/organizations/current/sso/test, which returns the authorize_url to open |
| Require single sign-on, or stop | PUT /api/v1/organizations/current/sso/require with required (true or false) |
All of these need the Admin role. GET /api/v1/organizations/current shows settings.require_sso.
Errors
| Status | Error code | Meaning |
|---|---|---|
401 / 403 |
sso_required |
Your organization requires single sign-on; sign in with SSO. The answer carries organization_slug |
409 |
sso_test_required |
Run a successful test sign-in of the current configuration first |
409 |
break_glass_unavailable |
Set a password and enable MFA on your own account first (or MFA is off on this Zenfra instance) |
409 |
sso_provider_immutable |
The issuer and client ID cannot change; delete the provider and set it up again |
409 |
sso_required_active |
Switch off Require single sign-on before deleting the provider |
409 |
sso_provider_changed |
The provider changed while you were saving; reload and retry |
409 |
access_boundaries_inactive |
Teams and the Member role are switched off on this Zenfra instance; single sign-on cannot be set up or required |
422 |
sso_discovery_failed |
Zenfra could not read the issuer's OpenID configuration |
A sign-in that cannot complete shows a message on the sign-in page instead. The ones you may see: the provider did not confirm a verified email in an allowed domain; the email belongs to an account that cannot be linked; the account already signs in another way; you have no account yet and new accounts cannot be created on this Zenfra instance (ask an Admin for an invitation); the organization's settings changed during the sign-in (start again).