Skip to content

OIDC


This article describes how to configure single sign-on (SSO) based on the OIDC/OAuth 2.0 protocol in a TrueWatch workspace.

TrueWatch supports two OIDC configuration methods:

Standard OIDC Configuration: for identity providers that conform to the OpenID Connect standard

Non-Standard OIDC Configuration: for identity providers that are based on OAuth 2.0 but differ in API specifications

Prerequisites

Before you begin, make sure you have the following ready:

Item Description
IdP admin permissions You need to create an application in your enterprise identity provider (such as Keycloak, Authing, Auth0, self-built OIDC service, etc.)
Client credentials The Client ID and Client Secret obtained from the IdP
Service discovery address The Issuer URL of the IdP, e.g., https://****.example.com
Enterprise email domain The email suffix used to identify SSO users, e.g., example.com

Standard OIDC Configuration

Step 1: Enter the Configuration Page

  1. Go to Management > Member Management > SSO Management > User SSO;
  2. Select the OIDC access type;
  3. Click Add Identity Provider.

Step 2: Connection Configuration

  1. Identity provider name: the name of the platform that provides identity management services (❗️This name is used as the IdP alias and appears on the IdP selection screen of single sign-on. To ensure you can quickly locate the IdP you need to log in to, enter an appropriate name);
  2. Remarks: user-defined description for recording notes about the identity provider;
  3. Identity provider URL: the full URL of the identity provider, which is also the service discovery address. For example: https://guance.example.com;
  4. Client ID: the unique identifier provided by the authentication service, used to identify the client application;
  5. Client secret: used together with the Client ID to authenticate the client application;
  6. Authorization request scope: the scope of the authorization request. By default it includes openid, profile, and email; you can add the address and phone claims as needed.

Step 3: Mapping Configuration

To enable SSO login, you need to map the account fields of the identity provider (IdP) to those of TrueWatch. The main fields are as follows:

  1. Username: required; the "username" field of the identity provider, e.g., referred_username;
  2. Email: required; the "email" field of the identity provider, e.g., email;
  3. Phone number: optional; the "phone" field of the identity provider, e.g., phone.

Step 4: Login Control

  1. Access restriction: validates whether the domain suffix of the login email matches the configured domain. Only matching emails are allowed to access the SSO login link. First-time users can have their TrueWatch member account created dynamically at login, without needing to create it in advance in the workspace;
  2. Role authorization: assigns a role to SSO accounts on first login; accounts that have already logged in are not affected;
  3. If SAML mapping is enabled in the workspace, roles are assigned according to the mapping rules first.
  4. Session duration: set the idle session duration and the maximum session duration for SSO login sessions.

Session Duration Configuration

Configuration Item Range Default Description
Idle login session duration 180–1440 minutes 180 minutes Time before automatic logout after user inactivity
Maximum login session duration 0–7 days 7 days Forces logout after this duration regardless of user activity. 0 means the session never expires

After changing the session duration, members who are already logged in keep their previous settings; new members are subject to the latest settings.

Relationship Between Role Authorization and Role Mapping

  • If OIDC role mapping is not enabled in the workspace: all SSO users logging in for the first time receive the default role configured here;
  • If OIDC role mapping is enabled in the workspace: roles are assigned according to the mapping rules first; users who do not match any rule receive the default role configured here.

Notes on User-Side OIDC Configuration

  • Grant type: only the authorization_code grant type is supported; its response type must be code;

  • id_token signing algorithm: only HS256 is currently supported;

  • Client authentication methods for exchanging code for token:

    • Supported by default: client_secret_basic

    • Custom methods supported: client_secret_post, client_secret_basic, none

  • scope values:

    • Default scope: openid, profile, email, phone

    • Custom requirements: must include openid; the rest is customizable, but the returned result must include email, and may optionally return phone_number.

Step 5: Obtain the Callback URL

After the identity provider is created, click the Edit button to obtain the following URLs and provide them to your IdP:

  1. Callback URL: the address to which users are redirected back to TrueWatch after successful IdP authorization;
  2. Login initiation URL: the SSO login entry address of TrueWatch.

Step 6: Configure the Callback Address in the IdP

Based on the callback URL obtained in Step 5, complete the following configuration in your IdP:

  1. Callback address (Redirect URI): enter the callback URL provided by TrueWatch;
  2. Grant type: ensure authorization_code is supported;
  3. Response type: ensure code is supported.

Non-OIDC Standard Configuration

This applies to identity providers that are based on OAuth 2.0 but do not conform to the standard OIDC specification, commonly seen in the following scenarios:

  • The IdP does not provide a standard OIDC discovery endpoint (.well-known/openid-configuration);
  • The API path or response format for retrieving user information differs from standard OIDC;
  • The casing style of API parameters is inconsistent with the standard.

Configuration Steps

  1. Go to Management > Member Management > SSO Management > OIDC > Create Identity Provider;
  2. Click in the upper-right corner to switch to the standard OIDC configuration page;
  3. Connection configuration:

    • Identity provider name: custom display name (up to 64 characters)
    • Configuration file upload: download the template, fill in the authorization endpoint, Token endpoint, user information endpoint, field mapping, and other information, then upload it
    • Remarks: custom description for recording notes about the identity provider
  4. Login configuration: same configuration as standard OIDC (access restriction, role authorization, session duration);

  5. Save and enable.

Login Verification

  1. Open the SSO login page and enter your complete enterprise email address;
  2. Select the identity provider corresponding to the account and complete the login as required on the enterprise authentication page;
  3. After successful authentication, select and enter an accessible workspace on the workspace selection page.

For accounts that already have an SSO identity, the identity provider is looked up by the SSO identity corresponding to the full email; if no SSO identity has been established, the email or domain is matched according to the access restrictions. For specific rules, see User Login.

Notes

  1. When role mapping is enabled: if a user does not match any role mapping rule, or role mapping is disabled, "No access permission" will be prompted after login;
  2. After deleting an identity provider: users logging in via SSO will no longer be able to see the workspace corresponding to the deleted IdP;
  3. Multiple IdPs: a single workspace supports up to 10 IdPs. Users are matched to an available identity provider by their account and, after completing enterprise authentication, are granted access according to workspace authorization;
  4. Account binding: on the first SSO login, if the email matches an existing TrueWatch account, the account is automatically bound and historical data is retained;
  5. Mapping field errors: if the configured mapping fields do not match the fields actually returned by the IdP, user information cannot be retrieved and login will fail.

Further Reading

You may also be interested in the following: