Directory sign-in

Sign staff in with Active Directory or LDAP, Microsoft Entra ID, Google Workspace or any OpenID Connect provider, with groups mapped to roles.

See it in the tour: Sign in with a company account

On this page

Staff can sign in to Stater with their company account instead of a separate Stater password. Owners set it up in Admin › Sign-in. Four kinds of directory are supported:

Kind How people sign in Groups to roles Licence
Active Directory, or another LDAP server The usual username and password form, with their network password AD groups (nested included), memberOf, or a group search Enterprise (directory)
Microsoft Entra ID (Azure AD) A "Sign in with Microsoft" button App roles (recommended) or group object IDs Business and up (sso)
Google Workspace A "Sign in with Google" button None: Google does not tell Stater about groups Business and up (sso)
Any other OpenID Connect provider (Keycloak, Authentik, Okta and the like) A "Sign in with …" button A groups claim Business and up (sso)

Stater passwords keep working alongside any directory for everyone who has one.

How it works#

  • LDAP and Active Directory. Stater connects with a read-only service account, finds the person by the login they typed, then checks their password by binding as them. The connection is always LDAPS or StartTLS with a verified certificate. An empty password is never sent, so an "unauthenticated bind" cannot get anyone in. Wrong passwords count against the same limits as Stater passwords (10 per username and address in 15 minutes). jsmith, EXAMPLE\jsmith and [email protected] share one count, as they are the same account. A directory that does not answer is not counted.
  • Microsoft, Google and OpenID Connect. The button sends the browser to the provider (the authorisation code flow with PKCE). When it comes back, Stater checks the state (bound to the browser by a cookie, used once, valid for 10 minutes), swaps the code for an ID token, and checks its signature, issuer, audience, expiry and nonce. Stater keeps no tokens.
  • Linking accounts. Someone added in People › Staff with "Signs in with" set to a directory (when adding them, or later on their record) is linked on their first sign-in, by their login: for LDAP the username they type; for Microsoft their user principal name (the tenant is always checked); for Google and other providers a verified email, or a subject ID you enter. After that only the directory's stable ID (objectGUID, entryUUID, Microsoft's object ID or sub) counts, so a renamed account stays linked. Stater never links an account just because a username or email matches.
  • Creating accounts. With "Create accounts for people in matching groups", anyone the directory lets in who matches a row in Groups and roles gets a Stater account with that row's role and store, while the licence has staff accounts free. Google needs its Workspace domain set before it may create accounts: Stater refuses to save or switch on a Google directory that creates accounts without one. If a directory account is deleted and created again (a new objectGUID or sub) while its login is still linked to the old one, Stater does not move the link: the person is asked to have an owner or manager link them again on their record.
  • Roles. Rows are checked in order; the first that matches decides. Only an owner can map a group to the owner role. With "Keep roles in step with the directory", each sign-in sets the role and store from the first matching row, and someone in no matching group cannot sign in; their role can then only be changed through their groups. The last owner, and the last owner with a Stater password, are never demoted this way.
  • Sessions. "Sign in again after" (12 hours by default for Microsoft, Google and OpenID Connect) ends a directory session that long after sign-in however busy it is, so someone switched off in the directory loses access within that time. Switching a directory off signs out everyone who signed in with it.
  • PINs. Approval PINs stay Stater PINs. To set one, people who sign in with LDAP confirm with their network password; people who sign in with Microsoft, Google or OpenID Connect choose Confirm with … on their profile. Stater asks the provider to have them type their credentials again even when it remembers them (prompt=login, or prompt=consent for Google, with max_age=0), and only accepts the sign-in when the ID token's auth_time is within the last 10 minutes. They then have 10 minutes to set the PIN. A provider that does not send auth_time cannot confirm a PIN.

Setting up#

  1. Make sure STATER_SECRET_KEY is set (see Secrets): the bind password or client secret is saved encrypted under it.
  2. For Microsoft, Google and OpenID Connect, set STATER_PUBLIC_URL (Settings reference) to the https address people use. The redirect URI on the directory's page is built from it; providers refuse localhost and plain http.
  3. In Admin › Sign-in, choose Add a directory, fill in the connection, save, then Check connection. A directory can only be switched on after a check passes, and only while at least one owner keeps a Stater password.
  4. Add the rows under Groups and roles, and either add people in People › Staff (choose Signs in with on their record) or turn on account creation.

Active Directory#

  • Create a service account that can read people and groups. It never needs to change anything.
  • Use LDAPS on port 636, or StartTLS on 389. For a private certificate authority, paste its certificate into CA certificate. The Global Catalog (3269 over LDAPS) works too when people are spread over several domains.
  • The base DN is where people are, such as OU=Staff,DC=example,DC=com. The default filter finds user accounts; switched-off accounts (userAccountControl) are refused.
  • Groups default to Active Directory's nested lookup, so a rule on an outer group covers people in groups inside it. Rows match the group's full DN, written any way (cn=shop managers, ou=groups, … matches).
  • People may type jsmith, EXAMPLE\jsmith or [email protected].
  • Stater allows 10 wrong passwords per username and address in 15 minutes. If your domain locks accounts after fewer, wrong guesses through Stater can lock the account in AD: set a fine-grained password policy for staff, or tell people to use their usual network password carefully.

OpenLDAP and other LDAP servers#

Choose Other LDAP: the login is uid, the ID is entryUUID, and groups are found with (|(member={dn})(uniqueMember={dn})(memberUid={login})). {dn} and {login} are escaped before use.

Microsoft Entra ID (Azure AD)#

  1. In the Entra admin centre, register an application for accounts in this organisational directory only (single tenant).
  2. Add the redirect URI from Stater as a Web redirect URI.
  3. Create a client secret and paste it into Stater, with the directory (tenant) ID and application (client) ID from the Overview page. common, organizations and consumers are refused: only your own tenant can sign in.
  4. Recommended: create app roles (such as Stater.Manager) and assign groups to them, then map the app role values in Stater. Alternatively send group object IDs; Microsoft lists at most 200 groups in a token, and someone in more cannot sign in until you use app roles.

Google Workspace#

  1. In Google Cloud, create an OAuth client of type Web application, with the consent screen's user type Internal.
  2. Add the redirect URI from Stater as an authorised redirect URI, and paste the client ID and secret into Stater.
  3. Enter your Workspace domain, so only accounts from it can sign in.
  4. Google does not send groups. Add people in Stater ahead of time, or create accounts with one row for everyone in the domain and adjust roles in Stater.

Other OpenID Connect providers#

Enter the issuer address (for Keycloak, https://id.example.com/realms/<realm>; for Authentik, the application's OpenID configuration issuer; for Okta, https://<org>.okta.com or your authorisation server), the client ID and secret, any extra scopes such as groups, and the claim that lists groups. Add the redirect URI to the client. Only a verified email links an existing account; enter the person's subject ID instead if your provider does not verify emails.

Leavers#

  • LDAP checks the account at every sign-in: someone removed or switched off in the directory cannot sign in again.
  • Directory sessions end after "Sign in again after" hours.
  • Switching someone off in Stater (People › Staff › Deactivate) ends their sessions at once. Directory sign-in never switches anyone back on.

A scheduled sync that switches off leavers without waiting for them to sign in is not part of this release.

When the directory is down#

  • An owner with a Stater password can always sign in. Stater refuses to switch a directory on without one, and while a directory is on it refuses to remove the last such owner's password, demote them or switch them off, by hand or by role sync; tick Keep their Stater password for an owner who also signs in with the directory.
  • If nobody can get in, run stater user add -role owner <username> on the server: it creates a local owner and prints a temporary password.

Troubleshooting#

Check connection says what went wrong in plain words: a host name that cannot be found, a certificate that is not trusted, a service account that was refused, a base DN with nobody in it. For LDAP, enter someone's login to see their DN, their groups and the role they would get.

  • "Stater's public address is http://localhost:8080": set STATER_PUBLIC_URL and restart, then add the new redirect URI to the provider.
  • "is on a private or internal network": tick On my own network for a directory in your office or VPN (it needs STATER_PRIVATE_CONNECTORS=true, the default). Cloud metadata addresses are always refused.
  • A sign-in that comes back to the sign-in page shows why: not set up in Stater yet, in no matching group, switched off, too many groups, and so on. Every refusal of a sign-in that really started (a start from this browser, within 10 minutes) is in the audit log as auth.sso_refused; calls to the callback address that never started a sign-in are only redirected, so they cannot fill the audit log.

API#

The directories are under /api/v1/directory/providers (owners, signed in to the web app; API tokens cannot change them). GET /api/v1/directory/login/providers lists the sign-in buttons, and /api/v1/directory/login/{key}/start and /callback are the OpenID Connect redirect. GET and PUT /api/v1/staff/{id}/sign-in read and change how someone signs in, and POST /api/v1/staff takes an optional sign_in (provider_id, login, subject) to add someone who signs in with a directory from the start, with no temporary password. start?reauth=true asks the provider to sign them in again, to confirm who they are before they set a PIN. Secrets are write-only: bind_password or client_secret in, bind_password_set or client_secret_set out.

Audit actions: directory.create, directory.update, directory.remove, directory.rules, directory.test, staff.sign_in, directory.link, directory.provision, directory.role_sync, directory.role_kept, auth.sso_refused, and auth.sign_in with method and provider.