Authentication setup
This page shows how to choose who may sign in to your cetra instance and how, and how to connect GitHub, Google or your own identity provider.
Set public_url to the address your members open, for example https://cetra.example.com. cetra builds every callback URL from it. See Configuration.
Sign-up policy
Section titled “Sign-up policy”| Setting | Environment | Default | Effect |
|---|---|---|---|
auth.signup |
CETRA_AUTH_SIGNUP |
invite_only |
invite_only: only invited emails can register. open: anyone can. disabled: no new accounts. |
auth.signup_domains |
CETRA_AUTH_SIGNUP_DOMAINS |
empty | With open, restrict sign-up to these email domains. |
auth.disable_password |
CETRA_AUTH_DISABLE_PASSWORD |
false |
Refuse password sign-in and sign-up. Needs a configured provider. |
auth.require_email_verification |
CETRA_AUTH_REQUIRE_EMAIL_VERIFICATION |
false |
New accounts must verify their email. Needs SMTP. |
The first user to sign up, on the setup page the server prints at first start, becomes the instance admin. After that, the default invite_only keeps strangers out of an instance that is reachable from the internet.
Password login
Section titled “Password login”Passwords must be 10 to 128 characters and not in a list of common passwords. After 20 failed sign-ins for one email, cetra locks password sign-in for that email for 15 minutes. A password reset clears the lock.
With auth.disable_password, members sign in through a provider only. Instance admins can still use a password at /login?password=1, so a broken provider does not lock you out.
Without SMTP, run cetra admin reset-password --email <EMAIL> to print a reset link. See Email.
GitHub
Section titled “GitHub”- In GitHub, create an OAuth app.
- Set its callback URL to
<public_url>/api/auth/callback/github. - Copy the client ID and generate a client secret.
- Add them to the configuration:
[auth.github]client_id = "<CLIENT_ID>"client_secret = "<CLIENT_SECRET>"To keep the secret out of the file, leave client_secret out and set CETRA_AUTH__GITHUB__CLIENT_SECRET in the service’s environment file.
cetra uses the primary verified email of the GitHub account. By default, a sign-in links to an existing account with the same email. Set link_existing_by_email = false to turn that off.
- In the Google Cloud console, create an OAuth client of the web application type.
- Add
<public_url>/api/auth/callback/googleas an authorized redirect URI. - Copy the client ID and secret.
- Add them to the configuration:
[auth.google]client_id = "<CLIENT_ID>"client_secret = "<CLIENT_SECRET>"allowed_domains = ["acme.com"]The environment form of the secret is CETRA_AUTH__GOOGLE__CLIENT_SECRET. allowed_domains restricts sign-in to those email domains, and cetra also checks Google’s hd claim.
Generic OpenID Connect
Section titled “Generic OpenID Connect”Any provider that supports OpenID Connect with the authorization code flow works. Each provider is one [[auth.oidc]] table:
[[auth.oidc]]name = "okta"display_name = "Okta"issuer = "https://acme.okta.com"client_id = "<CLIENT_ID>"scopes = ["openid", "email", "profile"]allowed_domains = ["acme.com"]link_existing_by_email = falseauto_provision = { org = "acme", role = "member" }| Key | Meaning |
|---|---|
name |
The provider’s ID, 1 to 32 characters of a-z, 0-9 and -. |
display_name |
The text on the sign-in button. |
issuer |
The issuer URL. It must be https, or http on a loopback host. |
client_id, client_secret |
The OAuth client from your provider. |
scopes |
Must include openid. The default is openid, email and profile. |
allowed_domains |
Only these email domains can sign in. |
link_existing_by_email |
Link a verified email to an existing account. Default false. |
auto_provision |
The org (by slug) and the role (admin, member or viewer) a new user gets. It counts as an invitation, so it works with invite_only. |
Set the client secret in the environment, not in the file. The variable is CETRA_AUTH__OIDC__<NAME>__CLIENT_SECRET, with the provider’s name in upper case and - written _: my-idp becomes MY_IDP.
For every provider, register the callback URL <public_url>/api/auth/callback/oidc:<name>. cetra signs members in with the authorization code flow and PKCE, and checks the ID token’s signature, issuer, audience, expiry and nonce. The provider must report the email as verified. Instance providers use OIDC; an org can use SAML for its own provider (Single sign-on).
- Create an OIDC web application in the Okta admin console.
- Set the sign-in redirect URI to
<public_url>/api/auth/callback/oidc:okta. - Copy the client ID and secret.
- The issuer is your Okta domain, such as
https://acme.okta.com, orhttps://acme.okta.com/oauth2/defaultfor the default authorization server. Use the issuer your provider’s discovery document reports.
Microsoft Entra ID
Section titled “Microsoft Entra ID”- Register an application in your Entra tenant, as a web platform.
- Add the redirect URI
<public_url>/api/auth/callback/oidc:entra. - Create a client secret and copy the application (client) ID.
- The issuer is
https://login.microsoftonline.com/<TENANT_ID>/v2.0.
cetra refuses the multi-tenant issuers common, organizations and consumers. Use your tenant’s ID.
Keycloak
Section titled “Keycloak”- In your realm, create a client with client authentication on.
- Add the valid redirect URI
<public_url>/api/auth/callback/oidc:keycloak. - Copy the client ID and the secret from the client’s credentials.
- The issuer is
https://<HOST>/realms/<REALM>. Older Keycloak versions put/authbefore/realms.
The redirect URIs above assume name = "entra" and name = "keycloak". They change with the name you choose.
Linking accounts
Section titled “Linking accounts”When someone signs in through a provider with an email that already has an account, cetra links them only if the provider has link_existing_by_email on, reports the email as verified, and the account is not an instance admin. Linking ends the account’s other sessions and revokes its personal access tokens. If cetra had not verified the email before, it also removes the account’s password.
Require single sign-on
Section titled “Require single sign-on”To require a provider for some email domains, set auth.enforce_sso_domains. It needs a licence key that includes sso_enforcement. See Plans and licence.
A Teams add-on org can also set up its own provider and verified domains without server configuration. See Single sign-on.
Check the setup
Section titled “Check the setup”- Restart cetra.
- Open the login page and look for the provider’s button. With password login off, one provider and no org-level provider, the page sends you straight to the provider instead, except right after a sign-out or a failed sign-in.
- Sign in with a test account.
- If you are sent back to
/login?error=<code>, the code says why. Common ones aredomain_not_allowed,email_not_verifiedandsignup_closed.