ClouisleClouisle

Configure Single Sign-On

Configure OIDC, SAML 2.0, or CAS login connections and manage the SSO user lifecycle

Login identity sources are managed in one place under Site Settings → Integrations (/site-settings/integrations): login identity sources, email, webhooks, and the Feishu directory share one integration list, but their capabilities and permissions stay separate. Turn on the global SSO policy under Site Settings → Security first, then add login integrations one by one.

Each login integration's protocol configuration is a JSON document whose fields depend on the type. Before saving, have the identity provider's callback address, client credentials, and certificate ready.

Prerequisites:

  1. The global SSO switch is on; otherwise the sign-in page shows no SSO buttons.
  2. The operator has permission to view or modify login integrations (Super Admins always do).
  3. The identity provider can reach Clouisle's public backend address; otherwise callbacks never arrive (see the next section).

Supported Scope

TypePurposeWhere it is managed
OAuth2, OIDC, SAML 2.0, CASWeb sign-inThe login integration dialog under Site Settings → Integrations
Email, WebhookNotification deliveryTheir own dedicated forms
FeishuSign-in and directory syncThe Feishu integration card (one set of app credentials, capabilities toggled separately)

Feishu is one integration that offers both directory sync and web sign-in: enabling the Feishu integration does not by itself grant sign-in, which must be explicitly switched on in the same card; disabling the integration turns off both directory sync and sign-in but keeps that choice. Email, webhook, and Feishu are single-instance integrations; this page covers the sign-in part only.

Callback Address

The callback (redirect) address to register with the identity provider is:

https://your-domain.com/api/v1/sso/callback/<integration-name>
  • your-domain.com is the public address the browser actually uses to reach the backend: behind a reverse proxy, use the proxy's forwarded public address; if the frontend proxies the API paths, use the public frontend domain. It is not an internal service address and not a frontend page address — using the wrong one makes the callback fail or redirect to the wrong domain.
  • Build the address from the pattern above (domain + integration name); the Feishu integration card displays a copyable redirect address directly.
  • <integration-name> must exactly match the integration name registered in Clouisle, is case-sensitive, and stays stable after creation. A mismatched callback address is the most common cause of SSO sign-in failures.

Adding a Login Integration

Under Site Settings → Integrations, add a login integration. The dialog has three tabs: Basic Info, Configuration, and Attribute Mapping. Basic info:

FieldRequiredConstraint
Integration NameYesStarts with a lowercase letter; only lowercase letters, digits, -, _; up to 100 characters; globally unique (a duplicate reports that the name already exists)
ProtocolYesOAuth2 / OIDC / SAML 2.0 / CAS
Display NameYesShown in the list and on connected-account cards, up to 100 characters
Button TextNoSign-in button label, up to 50 characters, e.g. "Continue with GitHub"
Icon URLNoMust start with http:// or https://, up to 512 characters
Enabled—When off, the integration does not appear on the sign-in page
Allow Signup—Lets this integration create accounts on first sign-in
Require Approval—New accounts need administrator approval before they can sign in
Default RoleNoInitial global role for new accounts; empty falls back to the site default role

The integration name and protocol cannot be changed after creation. Name it to match your identity provider's configuration; renaming means recreating the integration, and existing user identity connections stay on the original integration.

Protocol Configuration

On the Configuration tab, fill in two JSON documents:

  • Configuration JSON: protocol parameters. Field names must match the tables below; a typo is not caught on save and instead surfaces as a configuration error at sign-in.
  • Credentials JSON: sensitive values such as the client secret, e.g. {"client_secret": "..."}. Never put secrets in Configuration.

Credentials are stored encrypted and never echoed back: when editing, you see which keys are configured, and leaving the JSON empty preserves the saved secret.

OAuth2 / OIDC

FieldRequiredDescription
client_idYesClient ID issued by the provider
authorization_urlYesAuthorization endpoint
token_urlYesToken exchange endpoint
userinfo_urlYesUserinfo endpoint (its response is what sign-in reads)
scopesNoSpace-separated scopes, default openid email profile

Sign-in uses the authorization code + PKCE (S256) flow and generates a nonce.

The current implementation has no Issuer URL field and performs no ID Token signature/JWKS validation: user information always comes from the userinfo_url response. A wrong client secret or an expired certificate therefore only surfaces during the actual token exchange — see Test Connection.

SAML 2.0

FieldRequiredDescription
sp_entity_idYesService Provider Entity ID (this instance's identifier)
idp_entity_idYesIdP Entity ID
sso_urlYesIdP single sign-on URL (HTTP-Redirect binding)
x509_certYesIdP X.509 certificate: PEM content without the -----BEGIN/END CERTIFICATE----- lines
acs_urlYesACS address; a placeholder/reference only — the actual callback address always overrides it at runtime
slo_urlNoSP single logout address
idp_slo_urlNoIdP single logout address
name_id_formatNoNameID format, default urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified
{
  "sp_entity_id": "clouisle",
  "idp_entity_id": "https://idp.example.com/metadata",
  "sso_url": "https://idp.example.com/sso",
  "x509_cert": "MIIC...omitted...",
  "acs_url": "https://your-domain.com/api/v1/sso/callback/azure-ad"
}

Strict mode is on: SAML responses must pass signature validation, and a large clock skew between the IdP and Clouisle fails them outright.

slo_url / idp_slo_url are stored only — SP-initiated single logout is not implemented: signing out at the IdP does not sign the user out of Clouisle.

CAS

FieldRequiredDescription
server_urlYesCAS server base URL
versionNoProtocol version 1 / 2 / 3, default 3, which decides the validation endpoint (/validate, /serviceValidate, /p3/serviceValidate)
service_urlNoHas no effect: the service parameter always uses the runtime callback address

The CAS user identifier comes from <cas:user> in the validation response; version 3 also reads attributes from <cas:attributes> for attribute mapping.

Attribute Mapping

The Attribute Mapping tab holds a JSON document that maps provider response data to the fields Clouisle needs:

Clouisle fieldPurpose
emailAccount email (required; missing means sign-in fails)
usernameUsername; duplicates get a numeric suffix
avatar_urlAvatar address

Two path styles:

  • Dot notation (default): {"email": "email", "username": "profile.name"} reads nested objects.
  • JSONPath: starts with $, suits arrays or filtering, e.g. {"email": "$.emails[0].value"}; the first match wins.

Default values for a new integration:

{
  "email": "email",
  "username": "name",
  "avatar_url": "picture"
}

GitHub returns different fields from the OIDC standard, so change it to {"email": "email", "username": "login", "avatar_url": "avatar_url"}.

Mapped results are merged with the provider's raw response, and same-named raw fields win. In other words, the mapping only takes effect for keys absent from the raw response; if the provider already returns email, the mapped email is overwritten. When debugging mismatched fields, inspect the raw response first.

The final data must contain a non-empty email; otherwise new-user creation fails with a missing-email error. The OIDC sub/id, the SAML NameID, and the CAS <cas:user> become the external identity identifier; an empty identifier also fails sign-in.

Configuring GitHub Sign-In

  1. Make Clouisle externally reachable, and keep a working administrator sign-in method.
  2. Configure the global SSO policy under Site Settings → Security: the SSO switch, password sign-in, automatic user creation, approval, and email matching.
  3. In GitHub's Settings → Developer settings → OAuth Apps, create an OAuth app and set the callback to https://your-domain.com/api/v1/sso/callback/github.
  4. Create an OAuth2 login integration named github with a display name, button text, and icon; enable Allow Signup / Require Approval as needed and choose a default role.
  5. In Configuration, enter the Client ID, authorization URL, token URL, userinfo URL, and scope (read:user user:email); set Attribute Mapping to {"email": "email", "username": "login", "avatar_url": "avatar_url"}.
  6. In Credentials, enter {"client_secret": "..."} — not in Configuration. After saving and testing, complete a real sign-in in a private browser session; a passing configuration test does not mean a full sign-in works.

Configuring Feishu Sign-In

Feishu web sign-in is an optional capability of the Feishu integration and shares the same App ID / App Secret as directory sync, so no additional identity source is needed.

  1. In the Feishu developer console, add the Feishu card's redirect address (https://<backend-host>/api/v1/sso/callback/<integration-name>, e.g. …/api/v1/sso/callback/feishu) to the app's redirect URL allowlist; the address can be copied from the card in one click.
  2. Grant the app the scopes needed for sign-in: contact:user.base:readonly contact:user.email:readonly.
  3. Under Site Settings → Integrations → the Feishu card, turn on the Feishu sign-in switch in the capabilities area and optionally set the login button text. The sign-in switch belongs to login-integration permissions while the rest of the Feishu card belongs to integration-settings permissions, so the operator usually needs both.
  4. If app credentials are not configured yet, fill them in on the same card; they are shared with directory sync, and leaving the secret blank preserves the current value. Keep the integration enabled.

Members can link a Feishu identity to an existing account from the Connected Accounts area under Personal Settings → Account by clicking Link Feishu; this entry also appears only after an administrator enables Feishu user login.

The sign-in page shows the Feishu button only when global SSO is enabled, the integration is enabled, and the Feishu sign-in switch is on. Without that option, Feishu only provides directory sync. Disabling the integration turns off both capabilities but keeps the option.

The sign-in identity is stored using union_id from the Feishu profile as the external identity identifier, falling back to open_id when it is missing, so changing the app within the same developer account does not break already-linked accounts.

Feishu accounts with no email in the directory receive a deterministic placeholder email (the same one directory sync uses), so sign-in and sync converge on one local account instead of creating separate ones. Deriving that address requires the Feishu user_id, hence the contact:user.employee_id:readonly scope; without it such accounts have no user_id and their first sign-in is rejected rather than creating a placeholder identity.

Test Connection

The Test Connection button on an integration card builds an authorization address locally on the server once (with a placeholder callback) and checks whether the required configuration keys are present:

  • Success only means the configuration can produce an authorization address.
  • It never contacts the identity provider, so a wrong client secret, a mismatched callback address, or an expired certificate cannot be detected — verify with a real sign-in.

General Flow

  1. Under Site Settings → Security, enable SSO and adjust the global policy (allow password sign-in, auto-create, require approval, match by email).
  2. Under Site Settings → Integrations, add a login integration: fill in the basic info and choose the protocol.
  3. On the Configuration tab, enter the protocol's JSON configuration; put secrets in Credentials, not Configuration.
  4. On the Attribute Mapping tab, map email, username, and avatar to the provider's fields.
  5. After saving, put the callback address (https://your-domain.com/api/v1/sso/callback/<integration-name>) into the identity provider's allowlist/redirect settings.
  6. Verify three cases in a private window: a new user, an existing user, and a wrong callback.
SSO connection configuration
SSO connection configuration

User Lifecycle

Global policy and per-integration settings combine with OR semantics:

OutcomeRule
Link an existing accountGlobal "match existing accounts by email" is on (the default) and the returned email matches an existing user; linking also ensures the user joins the default team
Create a new accountGlobal "auto-create users" or the integration's own "allow signup" is on
Creation refusedGlobal auto-create is off and the integration's allow-signup is also off
Approval requiredGlobal "new accounts require approval" or the integration's "require approval" is on → the account is pending and cannot sign in
SSO onlyGlobal "allow password sign-in" is off, so password sign-in is rejected

New SSO users have these traits:

  • No local password, so they cannot sign in with a password.
  • The email is marked verified (the provider's email is trusted).
  • The username comes from the mapped username; when missing, the part of the email before @; when that is missing too, the first 8 characters of the external identity identifier with a prefix. Duplicates get a numeric suffix.
  • The role comes from the integration's default role, falling back to the global default role; the user then joins the default team per the default-team setting.

Upgrade Notes

When upgrading from the legacy SSO provider model to the unified integration model: the upgrade preserves integration identifiers, user identity connections, and external identity IDs — accounts do not need re-linking and identity providers do not need callback changes.

Back up the database before upgrading and update all components in the order the upgrade guide specifies; rolling deployment with mixed versions is not supported. A rollback must restore the pre-switch database, a matching application version, and the encryption key together. See Upgrading Clouisle for the full upgrade and rollback steps.

Troubleshooting

No SSO Button on the Sign-In Page

  1. Check that the global SSO switch under Site Settings → Security is on.
  2. Check that the integration is enabled and, for Feishu, that the Feishu sign-in switch is on.
  3. Confirm the callback address configured at the identity provider matches the pattern above.

Callback Errors / Stuck on the Same Page

  1. Verify that the callback address's public domain and integration name exactly match the configuration.
  2. Confirm the public address is reachable by the identity provider.
  3. Check whether the user lingered on the consent page (the sign-in session is valid for 10 minutes; retry after that).
  4. Look for failed SSO sign-in entries and error messages in the audit log.

Sign-In Succeeds but Fields Are Wrong

  1. Check the path style used in attribute mapping (dot notation vs $ JSONPath).
  2. Remember that same-named raw fields override mapped values.
  3. Non-OIDC-standard providers such as GitHub need explicit mapping (login, avatar_url).

SAML Validation Fails

  1. The certificate must be PEM content with the header/footer lines removed.
  2. Confirm the IdP and the server are time-synchronized (large skew makes responses invalid).
  3. Confirm idp_entity_id exactly matches the Entity ID in the IdP metadata.

Feishu Callback Rejected or No Account Created

  1. Confirm the app has registered the integration's callback address (as shown on the Feishu card).
  2. Confirm the sign-in scopes include contact:user.email:readonly; accounts with no email in the directory also need contact:user.employee_id:readonly, otherwise there is no user_id to derive the placeholder email and first sign-in is rejected.
  3. If browsing or syncing Feishu departments says the integration is disabled: save the App ID and App Secret first, then enable the Feishu integration and turn on directory sync.

Nobody Can Reach the Admin Area After Disabling Password Sign-In

This is the classic SSO-only accident: confirm that at least one Super Admin has a linked identity connection first. If you are already locked out, platform operations must restore the password sign-in switch on the server.

How is this guide?

On this page