diff --git a/content/docs/configure/authentication.mdx b/content/docs/configure/authentication.mdx index bcebfde..57bd1aa 100644 --- a/content/docs/configure/authentication.mdx +++ b/content/docs/configure/authentication.mdx @@ -1,7 +1,7 @@ --- title: Authentication seoTitle: "Authentication: OAuth, OIDC/SSO and Device Flow" -description: Configure sign-in, sessions, OAuth, OIDC/SSO, and device flow. +description: Configure sign-in, sessions, OAuth, OIDC/SSO, SSO providers registered in Setup (OIDC and SAML 2.0), and device flow. editions: [community, cloud, enterprise] --- @@ -18,7 +18,9 @@ support: - session management; - password reset and email verification; - social OAuth providers such as Google, GitHub, Microsoft, and Apple; -- enterprise OIDC/SSO such as Okta, Entra ID, Keycloak, and Ping; +- enterprise single sign-on through your identity provider (Okta, Entra ID, + Keycloak, Ping, …), over OIDC or SAML 2.0, registered by an administrator + in [Setup → SSO Providers](#setup--sso-providers); - two-factor authentication; - passkeys/WebAuthn; - magic links; @@ -143,7 +145,10 @@ two distinct callback paths and they are **not** interchangeable: | Provider type | Callback path | |---|---| | Built-in social (Google, GitHub, Microsoft, Apple, …) | `/api/v1/auth/callback/` | -| Generic OIDC / OAuth2 (Okta, Entra ID, Keycloak, Ping, …) | `/api/v1/auth/oauth2/callback/` | +| Generic OIDC / OAuth2 configured in code (Okta, Entra ID, Keycloak, Ping, …) | `/api/v1/auth/oauth2/callback/` | + +An SSO provider registered in **Setup → SSO Providers** uses a third set of +paths, listed in [that section](#setup--sso-providers). Examples: @@ -157,11 +162,15 @@ https://crm.example.com/api/v1/auth/oauth2/callback/entra Configure the matching redirect URI in the identity provider's application registration before enabling the provider in ObjectOS. -## Enterprise OIDC/SSO +## Enterprise OIDC/SSO in configuration -OIDC providers are registered as generic OAuth2 providers and use the -`/api/v1/auth/oauth2/callback/` path. A typical configuration -requires: +This section is about OIDC providers that the application package or the +deployment's configuration declares (the generic OAuth2 route, `genericOAuth`). +They are registered as generic OAuth2 providers and use the +`/api/v1/auth/oauth2/callback/` path. To let an administrator add +an identity provider from the console instead, without a configuration +change, use [Setup → SSO Providers](#setup--sso-providers). A typical +configuration requires: | Field | Description | |---|---| @@ -175,6 +184,52 @@ requires: For customer deployments, prefer OIDC discovery URLs over manually configured authorization/token/userinfo endpoints. +## Setup → SSO Providers + +**Setup → Access Control → SSO Providers** is where a platform administrator +connects the organization's own identity provider, over **OIDC** or **SAML +2.0**, without touching configuration. It is a different route from the +configuration-time providers above: its providers live in the database, are +added and changed in the console, and use their own callback paths. Use one +route per identity provider, not both. + +| | Configuration (`genericOAuth`, above) | Setup → SSO Providers | +|---|---|---| +| Who adds a provider | Whoever edits the package or deployment configuration | A platform administrator, in the console | +| Protocols | OIDC / OAuth2 | OIDC and SAML 2.0 | +| OIDC callback | `/api/v1/auth/oauth2/callback/` | `/api/v1/auth/sso/callback/` | +| SAML ACS URL | — | `/api/v1/auth/sso/saml2/sp/acs/` | +| SAML SP entity ID | — | `/api/v1/auth/sso/saml2/sp/metadata?providerId=` | +| How people reach the provider | As the application configures it | **Sign in with SSO**: people type their work email and are routed by its domain | +| Domain verification, just-in-time accounts, group → permission-set mapping | — | Per provider | + +The page appears once SSO is on: `OS_SSO_ENABLED=true` on a self-hosted +deployment; on ObjectOS Cloud, a plan that includes single sign-on with your +identity provider. From the list, a platform administrator: + +- registers a provider — **Register SSO Provider** (OIDC) or **Register SAML + Provider** — naming its **Provider ID** (the last segment of the URLs above) + and the **email domain** whose people it signs in; +- proves the domain with **Request Domain Verification** and **Verify + Domain** (a DNS TXT record). ObjectOS Enterprise and ObjectOS Cloud require + this before the provider signs anyone in; on Enterprise + `OS_SSO_DOMAIN_VERIFICATION=false` turns it off; +- sets **Edit Sign-In Options**: **Allow Just-in-Time Provisioning** (create + the account at a first sign-in, instead of requiring an invitation), **Allow + IdP-Initiated Sign-In**, and for OIDC **Read Claims From the ID Token + Only**; +- adjusts the provider later with **Edit OIDC Settings**, **Edit SAML + Settings** (for example a new signing certificate), **Edit Attribute + Mapping** and **Edit Groups Claim**; +- maps the identity provider's groups to permission sets in **Setup → IdP + Group Mappings → Map SSO Group**. + +Step-by-step guides, with the exact values to paste on each side: + +- [SSO with Okta](/docs/configure/sso-okta) — OIDC and SAML 2.0; +- [SSO with Microsoft Entra ID](/docs/configure/sso-entra-id) — OIDC and + SAML 2.0. + ## Platform SSO In cloud-connected deployments, ObjectOS can use the control-plane login diff --git a/content/docs/configure/meta.json b/content/docs/configure/meta.json index 82c5df2..a0840f4 100644 --- a/content/docs/configure/meta.json +++ b/content/docs/configure/meta.json @@ -1,5 +1,5 @@ { "title": "Configure", "defaultOpen": false, - "pages": ["index", "users", "runtime", "data-sources", "authentication", "permissions", "storage", "ai", "mcp", "system-settings", "localization", "notifications", "api-access", "webhooks", "email"] + "pages": ["index", "users", "runtime", "data-sources", "authentication", "sso-okta", "sso-entra-id", "permissions", "storage", "ai", "mcp", "system-settings", "localization", "notifications", "api-access", "webhooks", "email"] } diff --git a/content/docs/configure/sso-entra-id.mdx b/content/docs/configure/sso-entra-id.mdx new file mode 100644 index 0000000..0414101 --- /dev/null +++ b/content/docs/configure/sso-entra-id.mdx @@ -0,0 +1,335 @@ +--- +title: SSO with Microsoft Entra ID +seoTitle: "Single Sign-On with Microsoft Entra ID (OIDC and SAML 2.0)" +description: Connect Microsoft Entra ID (Azure AD) to ObjectOS with OIDC or SAML 2.0 — the exact URLs, claims and values to paste in Entra and in Setup → SSO Providers, users without a mailbox, MFA, assignment on Entra ID Free, domain verification and group mapping. +editions: [community, cloud, enterprise] +--- + +This guide connects a Microsoft Entra ID tenant to ObjectOS, so that people +sign in with their Microsoft work account. It covers both protocols: pick one, +then follow its section. Everything on the ObjectOS side happens in the +console, under **Setup → Access Control → SSO Providers** (see +[Authentication](/docs/configure/authentication#setup--sso-providers) for what +that page is and how it differs from configuring OAuth providers in code). + +The steps and values below were verified end to end against a real Entra ID +tenant, with Entra multi-factor authentication on, and ObjectOS Enterprise; +the OIDC steps on the released ObjectOS Enterprise 4.4.0. Okta has its own +guide: [SSO with Okta](/docs/configure/sso-okta). + +## OIDC or SAML + +Both work with Entra ID, including group mapping. + +| | OIDC (app registration) | SAML 2.0 (enterprise application) | +|---|---|---| +| Set up in Entra | **App registrations** | **Enterprise applications**, non-gallery | +| Users without a mailbox | Map the email to `preferred_username` (see below) | Send the UPN as the email (see below) | +| Groups → permission sets | Yes | Yes | +| Signing certificate rotation | Picked up automatically | Paste the new certificate with **Edit SAML Settings** | + +Register **one** provider per email domain. People are routed to a provider +by the domain of the email address they type on the sign-in page. + +## Before you start + +- **ObjectOS with SSO turned on.** On a self-hosted deployment, set + `OS_SSO_ENABLED=true` in `.env` and restart (`docker compose up -d`). No + other setting is needed for Entra ID — in particular, do **not** add + `graph.microsoft.com` to `OS_TRUSTED_ORIGINS`. On ObjectOS Cloud, see + [On ObjectOS Cloud](#on-objectos-cloud). +- **A platform administrator account** in ObjectOS. Registering a provider, + verifying its domain and mapping groups are platform-administrator actions. +- **Access to the DNS of your email domain**, to publish one TXT record + (see [Verify your email domain](#verify-your-email-domain)). +- **An Entra role that can create applications**, such as Application + Administrator, and your **Tenant ID** (Entra admin center → **Overview**). +- **The public `https://` address of ObjectOS.** This guide writes it as + `https://objectos.example.com`; replace it with yours everywhere. + +### The URLs you paste in Entra + +Each URL ends with the **Provider ID** you give the provider in ObjectOS. This +guide uses `entra-oidc` and `entra-saml`; if you choose other IDs, use them in +these URLs too. The two sides must match exactly. + +| Entra field | Value | +|---|---| +| OIDC: **Redirect URI** (platform **Web**) | `https://objectos.example.com/api/v1/auth/sso/callback/entra-oidc` | +| SAML: **Reply URL (Assertion Consumer Service URL)** | `https://objectos.example.com/api/v1/auth/sso/saml2/sp/acs/entra-saml` | +| SAML: **Identifier (Entity ID)** | `https://objectos.example.com/api/v1/auth/sso/saml2/sp/metadata?providerId=entra-saml` | + +The SAML identifier is also the address of ObjectOS's SP metadata: once the +provider is registered, open it in a browser to check the entity ID and reply +URL Entra should have. + +## Multi-factor authentication and assignment + +Multi-factor authentication, Conditional Access and every other sign-in rule +stay in Entra ID: ObjectOS adds no second factor of its own to an SSO sign-in. + +- **MFA registration.** A tenant with **security defaults** on (the default + for new tenants) makes each person register an authenticator method the + first time they sign in, before they reach ObjectOS. Tell people to expect + that prompt on their first SSO sign-in. +- **Who may sign in.** On the enterprise application, **Properties → + Assignment required?** set to **Yes** limits sign-in to the users and groups + assigned under **Users and groups**. On **Entra ID Free**, you can assign + users only one by one; assigning a **group** needs Entra ID P1 or P2. + +## Option A: OIDC + +### In Entra + +1. **App registrations → New registration.** Name it (for example + "ObjectOS"), choose who may use it (usually **Accounts in this + organizational directory only**), and under **Redirect URI** choose **Web** + and paste the OIDC URL from the table above. +2. **Certificates & secrets → New client secret.** Copy the secret's + **Value** now — Entra shows it once. From **Overview**, copy the + **Application (client) ID**. +3. **API permissions.** Make sure Microsoft Graph's delegated `openid`, + `profile` and `email` permissions are present, and grant admin consent if + your tenant requires it. +4. **Token configuration** (only if you will map groups to permission sets): + **Add groups claim** → **Security groups**, and for the **ID** token keep + **Group ID**. Entra then sends each group's object ID in a `groups` claim. + +### In ObjectOS + +**Setup → Access Control → SSO Providers → Register SSO Provider**: + +| Field | Value | +|---|---| +| Provider ID | `entra-oidc` — the same ID as at the end of the redirect URI | +| Issuer URL | `https://login.microsoftonline.com/YOUR-TENANT-ID/v2.0` | +| Email Domain | The domain of your people's email addresses, for example `acme.com` | +| Client ID / Client Secret | The values from step 2 | +| Map: Groups claim | `groups` — or leave it blank if you will not map groups | + +Leave the other fields blank unless some of your users have no mailbox +(next section). ObjectOS reads Entra's endpoints from the issuer's discovery +document, including Entra's userinfo endpoint on `graph.microsoft.com`; it +trusts that endpoint for an Entra issuer without any configuration. Groups are +read from the ID token, so group mapping works without further settings. + +### Users without a mailbox + +Entra sends no `email` claim for a user who has no mailbox (an empty **mail** +attribute) — common for cloud-only accounts without an Exchange license. +Such a sign-in is refused with the cause `email_claim_missing`. If any of your +users has no mailbox, set two things on the provider, before people start +signing in: + +1. **Map: Email claim** = `preferred_username` (on the registration form, or + **Edit Attribute Mapping** → **Email attribute** on an existing provider). + Entra's `preferred_username` is the user principal name, for example + `jane@acme.com`. +2. **Read Claims From the ID Token Only** turned on (on the registration form, + or **Edit Sign-In Options** on an existing provider). Entra's userinfo + endpoint does not return `preferred_username`, so the claim has to come + from the ID token. + +With both set, people with and without a mailbox sign in with their user +principal name as their email. The email decides which ObjectOS account a +sign-in belongs to, so choose the mapping before people sign in rather than +change it later. + +Next: [verify your email domain](#verify-your-email-domain), then +[sign in](#signing-in). + +## Option B: SAML 2.0 + +### In Entra + +1. **Enterprise applications → New application → Create your own + application.** Name it (for example "ObjectOS") and choose **Integrate any + other application you don't find in the gallery (Non-gallery)**. +2. **Single sign-on → SAML → Basic SAML Configuration**: + - **Identifier (Entity ID)**: the SAML identifier from the table above. + - **Reply URL (Assertion Consumer Service URL)**: the SAML reply URL from + the table above. +3. **Attributes & Claims**: keep the default claims. Two optional changes: + - **Groups** (only if you will map groups to permission sets): **Add a + group claim** → **Security groups**, source attribute **Group ID**. Keep + the claim's default name. + - **Users without a mailbox**: the + `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress` + claim is filled from `user.mail`, which such a user does not have. + ObjectOS reads the email from the attribute in **Map: Email attribute** + and, when a response does not carry it, from the NameID instead. To give + these users an email attribute of their own, set the claim's source + attribute to `user.userprincipalname` instead of `user.mail`. +4. **SAML Certificates**: download **Certificate (Base64)**. Under **Set up + ObjectOS**, copy the **Login URL** and the **Microsoft Entra Identifier**. +5. **Users and groups**: assign the people who should sign in (see + [assignment](#multi-factor-authentication-and-assignment)). + +### In ObjectOS + +**Setup → Access Control → SSO Providers → Register SAML Provider**: + +| Field | Value | +|---|---| +| Provider ID | `entra-saml` — the same ID as at the end of the reply URL and the identifier | +| IdP Entity ID | The **Microsoft Entra Identifier**: `https://sts.windows.net/YOUR-TENANT-ID/` | +| Email Domain | The domain of your people's email addresses | +| IdP SSO URL | The **Login URL**: `https://login.microsoftonline.com/YOUR-TENANT-ID/saml2` | +| IdP Signing Certificate | The content of the certificate file | +| NameID Format | Leave blank | +| Map: Email attribute | `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress` | +| Map: First name attribute | `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname` | +| Map: Last name attribute | `http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname` | +| Map: Display name attribute | `http://schemas.microsoft.com/identity/claims/displayname` | +| Map: Groups attribute | `http://schemas.microsoft.com/ws/2008/06/identity/claims/groups` — or leave it blank if you will not map groups | + +Entra names its claims with these URIs, while ObjectOS reads `email`, +`givenName` and `surname` by default, so the **Map:** fields are what makes +the account's email and name right. Without them, a new account is named +after its email address. You can change them later with **Edit Attribute +Mapping** on the provider. + +Then open the SAML identifier URL in a browser and check that the entity ID +and reply URL it shows are the ones in the Entra application. + +Next: [verify your email domain](#verify-your-email-domain), then +[sign in](#signing-in). + +### Keep IdP-initiated sign-in off + +Starting a sign-in from **My Apps** (IdP-initiated sign-in) is off for every +new provider. Keep **Allow IdP-Initiated Sign-In** (under **Edit Sign-In +Options**) off for an Entra SAML provider until a release carries the fix for +[objectstack#32146](https://github.com/objectstack-ai/objectstack/issues/32146). +An IdP-initiated response from Entra carries an opaque persistent +NameID, and with the option on ObjectOS creates a **second** account whose +email is that identifier — and grants it the mapped permission sets. This +happens even with the domain verified. Have people start at the ObjectOS +sign-in page instead; with the option off, a click on the My Apps tile signs +no one in. + +### Certificate rotation (SAML) + +When Entra switches to a new signing certificate, ObjectOS refuses sign-ins +signed with it until it has the certificate. Rotate without downtime: + +1. In Entra, under **SAML Certificates**, add the new certificate but keep the + current one active. +2. In ObjectOS, run **Edit SAML Settings** on the provider: paste the new + certificate in **New IdP Signing Certificate** and turn on **Keep trusting + the current certificate**. ObjectOS now accepts either. +3. In Entra, make the new certificate active. +4. Run **Edit SAML Settings** again with the new certificate and without + **Keep trusting the current certificate**, to drop the old one. + +Do not delete and re-register the provider to change its certificate: +deleting a provider unlinks every person who signs in through it. + +## Verify your email domain + +A provider routes everyone whose email address is on its domain, so ObjectOS +can require proof that you control that domain before the provider signs +anyone in: + +- **ObjectOS Enterprise** requires it by default. Until the domain is + verified, every sign-in through the provider is refused with *Provider + domain has not been verified*. `OS_SSO_DOMAIN_VERIFICATION=false` in `.env` + turns the requirement off; every boot logs one `[sso]` line saying which + state applies. +- **ObjectOS Cloud** always requires it, and it cannot be turned off. +- **ObjectOS Community** does not require it unless you set + `OS_SSO_DOMAIN_VERIFICATION=true`. + +To verify: + +1. In **Setup → Access Control → SSO Providers**, run **Request Domain + Verification** on the provider. It shows a DNS TXT record once: the name is + `_better-auth-token-entra-oidc.acme.com` (your Provider ID and domain), the + value a one-time token. Copy both; the request stays valid for 7 days. +2. Publish that TXT record at your domain's DNS provider. +3. Run **Verify Domain** on the provider. When the record resolves, **Domain + Verified** turns on. If ObjectOS cannot see the record yet, wait for DNS to + propagate and run it again. + +Verify the domain your people's addresses are on (for example `acme.com`), +not the tenant's `onmicrosoft.com` domain, which you cannot publish records +on. ObjectOS looks the record up from its own server, so that server's DNS +resolver must be able to see it. Changing a provider's email domain clears its +verification. + +## Map Entra groups to permission sets + +With a groups claim (OIDC) or groups attribute (SAML) on the provider, each +sign-in grants the [permission sets](/docs/configure/permissions/permission-sets) +mapped to the person's Entra groups: + +1. Open **Setup → IdP Group Mappings** and choose **Map SSO Group**. +2. **SSO Provider ID**: `entra-oidc` (or `entra-saml`). +3. **Group External ID**: the group's **Object ID** (Entra admin center → + **Groups** → the group → **Overview**). Entra sends group object IDs, not + names, so leave **Group Display Name** blank. Renaming the group in Entra + does not affect the mapping. +4. **Permission Set**: the set members of the group receive. + +A mapping applies at each member's **next** sign-in: someone added to the +group gets the set when they next sign in, and someone removed from it loses +the set at their next sign-in. Members who are not in the group get nothing +from it. A group can grant an ordinary permission set only — administrator +sets are refused, so an IdP group never makes anyone an administrator. + +When someone belongs to more groups than fit in a token, Entra sends a +reference to Microsoft Graph instead of the groups, and that sign-in grants +nothing from groups. If that applies to your tenant, have the application +emit only **Groups assigned to the application** in its groups claim. + +## Signing in + +People sign in from the ObjectOS sign-in page: they type their work email +address and choose **Sign in with SSO**, which sends them to Microsoft. + +- **People who were not invited.** Under the default sign-up setting + ([who may sign up](/docs/configure/authentication#who-may-sign-up-objectstack-173)), + a first SSO sign-in by someone with no account and no invitation is refused + with *Your account isn't set up for this system yet. Ask your administrator + to invite you.*, and no account is created. Either invite people first + (**Setup → Users → Invite User**), or run **Edit Sign-In Options** on the + provider and turn on **Allow Just-in-Time Provisioning**: their first SSO + sign-in then creates the account, shown as **IdP-Provisioned** in the Users + list. +- **An existing account with the same email** that was never linked to this + provider is refused (`account_not_linked`). This keeps an identity provider + from taking over an account it did not create. +- **Signing out** ends the ObjectOS session only. The Microsoft session + stays, so the next **Sign in with SSO** on the same browser goes straight in + without a password. On a shared computer, sign out of the Microsoft account + too ([objectstack#32087](https://github.com/objectstack-ai/objectstack/issues/32087)). +- **When a sign-in is refused**, the sign-in page may say *the sign-in link + expired or was already used* even when that is not the reason — for + example for a user without a mailbox before the email mapping above is set + ([objectstack#32087](https://github.com/objectstack-ai/objectstack/issues/32087)). + The real reason, such as `email_claim_missing`, is in the page's + **Technical details** and in the server log. + +## On ObjectOS Cloud + +On ObjectOS Cloud, signing in through your own identity provider is part of a +plan that includes it — today the Legacy Enterprise plan, by contract (see +[Plans](/docs/cloud/plans-and-seats)). On such a plan: + +- Configure it in your **environment's** console + (`https://YOUR-ENVIRONMENT-DOMAIN/_console`), under **Setup → Access Control + → SSO Providers**, as an environment administrator. In every URL above, + replace `objectos.example.com` with the environment's domain. One Entra + application can list several identifiers and reply URLs, so the same + application can serve a self-hosted deployment and a Cloud environment. +- **Domain verification is required** and cannot be turned off: verify the + domain before anyone signs in. +- **Sign in with SSO** appears on the sign-in page, next to **Continue with + ObjectOS Cloud**, once at least one provider is registered. + +## Known limitations + +| Limitation | What to do | Tracked in | +|---|---|---| +| An IdP-initiated SAML sign-in creates a second account; a just-in-time account's email is not checked against the provider's verified domain | Keep **Allow IdP-Initiated Sign-In** off; map the email from an attribute people cannot edit themselves | [objectstack#32146](https://github.com/objectstack-ai/objectstack/issues/32146) | +| Signing out keeps the Microsoft session; some refusals say the sign-in link expired | Sign out of Microsoft on shared computers; read **Technical details** | [objectstack#32087](https://github.com/objectstack-ai/objectstack/issues/32087) | diff --git a/content/docs/configure/sso-okta.mdx b/content/docs/configure/sso-okta.mdx new file mode 100644 index 0000000..f2b87d2 --- /dev/null +++ b/content/docs/configure/sso-okta.mdx @@ -0,0 +1,288 @@ +--- +title: SSO with Okta +seoTitle: "Single Sign-On with Okta (OIDC and SAML 2.0)" +description: Connect Okta to ObjectOS with OIDC or SAML 2.0 — the exact URLs and values to paste in Okta and in Setup → SSO Providers, the Okta policies sign-in needs, domain verification, and group-to-permission-set mapping. +editions: [community, cloud, enterprise] +--- + +This guide connects an Okta organization to ObjectOS, so that people sign in +with their Okta account. It covers both protocols: pick one, then follow its +section. Everything on the ObjectOS side happens in the console, under +**Setup → Access Control → SSO Providers** (see +[Authentication](/docs/configure/authentication#setup--sso-providers) for what +that page is and how it differs from configuring OAuth providers in code). + +The steps and values below were verified end to end against a real Okta +organization and ObjectOS Enterprise. Microsoft Entra ID has its own guide: +[SSO with Microsoft Entra ID](/docs/configure/sso-entra-id). + +## OIDC or SAML + +| | OIDC | SAML 2.0 | +|---|---|---| +| Use it when | You are starting fresh. Recommended. | Your organization's IdP standard allows SAML only. | +| Okta signing-key rotation | Picked up automatically; nothing to change in ObjectOS. | Paste the new certificate with **Edit SAML Settings** (see [Certificate rotation](#certificate-rotation-saml)). | +| Groups → permission sets | Yes | Yes | + +Register **one** provider per email domain. People are routed to a provider +by the domain of the email address they type on the sign-in page. + +## Before you start + +- **ObjectOS with SSO turned on.** On a self-hosted deployment, set + `OS_SSO_ENABLED=true` in `.env` and restart (`docker compose up -d`). On + ObjectOS Cloud, see [On ObjectOS Cloud](#on-objectos-cloud). +- **A platform administrator account** in ObjectOS. Registering a provider, + verifying its domain and mapping groups are platform-administrator actions. +- **Access to the DNS of your email domain**, to publish one TXT record + (see [Verify your email domain](#verify-your-email-domain)). +- **An Okta administrator account.** +- **The public `https://` address of ObjectOS.** This guide writes it as + `https://objectos.example.com`; replace it with yours everywhere. + +### The URLs you paste in Okta + +Each URL ends with the **Provider ID** you give the provider in ObjectOS. This +guide uses `okta-oidc` and `okta-saml`; if you choose other IDs, use them in +these URLs too. The two sides must match exactly. + +| Okta field | Value | +|---|---| +| OIDC: **Sign-in redirect URIs** | `https://objectos.example.com/api/v1/auth/sso/callback/okta-oidc` | +| SAML: **Single sign-on URL** (the ACS URL) | `https://objectos.example.com/api/v1/auth/sso/saml2/sp/acs/okta-saml` | +| SAML: **Audience URI (SP Entity ID)** | `https://objectos.example.com/api/v1/auth/sso/saml2/sp/metadata?providerId=okta-saml` | + +The SAML entity ID is also the address of ObjectOS's SP metadata: once the +provider is registered, open it in a browser to check the entity ID and ACS +URL Okta should have. + +## Option A: OIDC + +### In Okta + +1. **Applications → Applications → Create App Integration.** Choose + **OIDC - OpenID Connect** and **Web Application**. +2. On the new app: + - **Sign-in redirect URIs**: the OIDC URL from the table above. + - **Client authentication**: **Client secret**. + - **Assignments**: assign the groups (or people) who should sign in. + + Save, then copy the **Client ID** and the **Client secret**. +3. **Security → API → Authorization Servers → `default`.** + - **Claims → Add Claim** (only if you will map groups to permission sets): + Name `groups`, Include in token type **ID Token**, **Always**, Value type + **Groups**, Filter **Matches regex** `.*` (or a narrower filter that + matches only the groups you will map). + - **Access Policies → Add Policy**, assigned to the app from step 1, with a + rule that allows the **Authorization Code** grant. + + > **This policy is required.** An authorization server with no access policy + > for the app lets Okta sign the person in and then answers *You are not + > allowed to access this app*, so the sign-in never reaches ObjectOS. + +4. **Sign-on policy.** Multi-factor authentication and every other sign-in + rule stay in Okta: ObjectOS adds no second factor of its own to an SSO + sign-in. The app uses whichever **authentication policy** it is assigned + (**Security → Authentication Policies**); a new app usually gets the + organization's default, which may require two factors. That is fine for + people. When you test with an account that has no second factor enrolled, + create a separate policy whose only rule allows **Password** alone and + assign it to the test app — not to the app your organization uses. + +### In ObjectOS + +**Setup → Access Control → SSO Providers → Register SSO Provider**: + +| Field | Value | +|---|---| +| Provider ID | `okta-oidc` — the same ID as at the end of the redirect URI | +| Issuer URL | `https://YOUR-OKTA-DOMAIN/oauth2/default` | +| Email Domain | The domain of your people's email addresses, for example `acme.com` | +| Client ID / Client Secret | The values from step 2 | +| Map: Groups claim | `groups` — or leave it blank if you will not map groups | + +Leave every other field blank: ObjectOS reads Okta's endpoints from the +issuer's discovery document. The client secret is stored encrypted and is +never shown again; **Edit OIDC Settings** replaces it. + +Next: [verify your email domain](#verify-your-email-domain), then +[sign in](#signing-in). + +## Option B: SAML 2.0 + +### In Okta + +1. **Applications → Applications → Create App Integration.** Choose + **SAML 2.0**. +2. **Configure SAML**: + - **Single sign-on URL**: the ACS URL from the table above. Tick **Use this + for Recipient URL and Destination URL**. + - **Audience URI (SP Entity ID)**: the SP entity ID from the table above. + - **Name ID format**: `EmailAddress`. **Application username**: `Email`. + - **Attribute Statements** (format **Basic**, names exactly as written): + + | Name | Value | + |---|---| + | `email` | `user.email` | + | `givenName` | `user.firstName` | + | `surname` | `user.lastName` | + + - **Group Attribute Statements** (only if you will map groups): Name + `groups`, Filter **Matches regex** `.*` (or a narrower filter). + + These are the attribute names ObjectOS reads by default, so nothing needs + mapping on the ObjectOS side. Without `givenName` and `surname`, a new + account is named after the email address. If your Okta app already sends + other names (for example a single `name` attribute), map them in ObjectOS + instead: **Map: Display name attribute** on the registration form, or + **Edit Attribute Mapping** on the provider. +3. **Assignments**: assign the groups (or people) who should sign in. +4. **Sign On** tab → **View SAML setup instructions**. Copy the **Identity + Provider Single Sign-On URL**, the **Identity Provider Issuer** and the + **X.509 Certificate**. + +### In ObjectOS + +**Setup → Access Control → SSO Providers → Register SAML Provider**: + +| Field | Value | +|---|---| +| Provider ID | `okta-saml` — the same ID as at the end of the ACS URL and the entity ID | +| IdP Entity ID | Okta's **Identity Provider Issuer** (it looks like `http://www.okta.com/exk…`) | +| Email Domain | The domain of your people's email addresses | +| IdP SSO URL | Okta's **Identity Provider Single Sign-On URL** | +| IdP Signing Certificate | The X.509 certificate | +| NameID Format | Leave blank | +| Map: Groups attribute | `groups` — or leave it blank if you will not map groups | + +Leave the other **Map:** fields blank when Okta sends the attribute names +above. Then open the SP entity ID URL in a browser and check that the entity +ID and ACS URL it shows are the ones in the Okta app. + +Next: [verify your email domain](#verify-your-email-domain), then +[sign in](#signing-in). + +### Leave IdP-initiated sign-in off + +Starting a sign-in from the Okta dashboard tile (IdP-initiated sign-in) is off +for every new provider, and this guide leaves it off: people start at the +ObjectOS sign-in page. With it off, a click on the Okta tile does not sign +anyone in. Keep **Allow IdP-Initiated Sign-In** (under **Edit Sign-In +Options**) off for SAML providers until a release carries the fix for +[objectstack#32146](https://github.com/objectstack-ai/objectstack/issues/32146): +an unsolicited SAML response is not bound to a request ObjectOS +made, and a response whose NameID is not the email address can create a +second account. + +### Certificate rotation (SAML) + +When Okta switches to a new signing certificate, ObjectOS refuses sign-ins +signed with it until it has the certificate. Rotate without downtime: + +1. In Okta, create the new certificate but keep the old one active. +2. In ObjectOS, run **Edit SAML Settings** on the provider: paste the new + certificate in **New IdP Signing Certificate** and turn on **Keep trusting + the current certificate**. ObjectOS now accepts either. +3. In Okta, make the new certificate the active one. +4. Run **Edit SAML Settings** again with the new certificate and without + **Keep trusting the current certificate**, to drop the old one. + +Do not delete and re-register the provider to change its certificate: +deleting a provider unlinks every person who signs in through it. + +## Verify your email domain + +A provider routes everyone whose email address is on its domain, so ObjectOS +can require proof that you control that domain before the provider signs +anyone in: + +- **ObjectOS Enterprise** requires it by default. Until the domain is + verified, every sign-in through the provider is refused with *Provider + domain has not been verified*. `OS_SSO_DOMAIN_VERIFICATION=false` in `.env` + turns the requirement off; every boot logs one `[sso]` line saying which + state applies. +- **ObjectOS Cloud** always requires it, and it cannot be turned off. +- **ObjectOS Community** does not require it unless you set + `OS_SSO_DOMAIN_VERIFICATION=true`. + +To verify: + +1. In **Setup → Access Control → SSO Providers**, run **Request Domain + Verification** on the provider. It shows a DNS TXT record once: the name is + `_better-auth-token-okta-oidc.acme.com` (your Provider ID and domain), the + value a one-time token. Copy both; the request stays valid for 7 days. +2. Publish that TXT record at your domain's DNS provider. +3. Run **Verify Domain** on the provider. When the record resolves, **Domain + Verified** turns on. If ObjectOS cannot see the record yet, wait for DNS to + propagate and run it again. + +ObjectOS looks the record up from its own server, so that server's DNS +resolver must be able to see it. Changing a provider's email domain clears +its verification. + +## Map Okta groups to permission sets + +With a groups claim (OIDC) or groups attribute (SAML) on the provider, each +sign-in grants the [permission sets](/docs/configure/permissions/permission-sets) +mapped to the person's Okta groups: + +1. Open **Setup → IdP Group Mappings** and choose **Map SSO Group**. +2. **SSO Provider ID**: `okta-oidc` (or `okta-saml`). +3. **Group Display Name**: the Okta group's name, exactly as Okta sends it. + Okta sends group names, not IDs, so leave **Group External ID** blank. +4. **Permission Set**: the set members of the group receive. + +A mapping applies at each member's **next** sign-in: someone added to the +group gets the set when they next sign in, and someone removed from it loses +the set at their next sign-in. A group can grant an ordinary permission set +only — administrator sets are refused, so an IdP group never makes anyone an +administrator. If you rename the group in Okta, save the mapping again with +the new name. + +## Signing in + +People sign in from the ObjectOS sign-in page: they type their work email +address and choose **Sign in with SSO**, which sends them to Okta. + +- **People who were not invited.** Under the default sign-up setting + ([who may sign up](/docs/configure/authentication#who-may-sign-up-objectstack-173)), + a first SSO sign-in by someone with no account and no invitation is refused, + and no account is created. Either invite people first + (**Setup → Users → Invite User**), or run **Edit Sign-In Options** on the + provider and turn on **Allow Just-in-Time Provisioning**: their first SSO + sign-in then creates the account, shown as **IdP-Provisioned** in the Users + list. +- **An existing account with the same email** that was never linked to this + provider is refused (`account_not_linked`). This keeps an identity provider + from taking over an account it did not create. +- **Signing out** ends the ObjectOS session only. The Okta session stays, so + the next **Sign in with SSO** on the same browser goes straight in without + a password. On a shared computer, sign out of Okta too + ([objectstack#32087](https://github.com/objectstack-ai/objectstack/issues/32087)). +- **When a sign-in is refused**, the sign-in page may say *the sign-in link + expired or was already used* even when that is not the reason + ([objectstack#32087](https://github.com/objectstack-ai/objectstack/issues/32087)). + The real reason is in the page's **Technical details** and in the server + log. + +## On ObjectOS Cloud + +On ObjectOS Cloud, signing in through your own identity provider is part of a +plan that includes it — today the Legacy Enterprise plan, by contract (see +[Plans](/docs/cloud/plans-and-seats)). On such a plan: + +- Configure it in your **environment's** console + (`https://YOUR-ENVIRONMENT-DOMAIN/_console`), under **Setup → Access Control + → SSO Providers**, as an environment administrator. In every URL above, + replace `objectos.example.com` with the environment's domain. +- **Domain verification is required** and cannot be turned off: verify the + domain before anyone signs in. +- **Sign in with SSO** appears on the sign-in page, next to **Continue with + ObjectOS Cloud**, once at least one provider is registered. + +## Known limitations + +| Limitation | What to do | Tracked in | +|---|---|---| +| An IdP-initiated SAML sign-in can create a second account, and a just-in-time account's email is not checked against the provider's verified domain | Keep **Allow IdP-Initiated Sign-In** off; map the email from an attribute people cannot edit themselves | [objectstack#32146](https://github.com/objectstack-ai/objectstack/issues/32146) | +| Signing out keeps the Okta session; some refusals say the sign-in link expired | Sign out of Okta on shared computers; read **Technical details** | [objectstack#32087](https://github.com/objectstack-ai/objectstack/issues/32087) | diff --git a/content/docs/resources/faq.mdx b/content/docs/resources/faq.mdx index 00764ed..b7b4f9d 100644 --- a/content/docs/resources/faq.mdx +++ b/content/docs/resources/faq.mdx @@ -160,6 +160,10 @@ and the UI. See [Permission Sets](/docs/configure/permissions/permission-sets). OIDC. Configure the discovery URL + client id/secret in **Setup → Authentication** (or via env). Provider callback URL is `/api/v1/auth/oauth2/callback/`. See [Authentication](/docs/configure/authentication). +An administrator can also connect the identity provider from the console, +over OIDC or SAML 2.0, in **Setup → SSO Providers**: see +[SSO with Okta](/docs/configure/sso-okta) and +[SSO with Microsoft Entra ID](/docs/configure/sso-entra-id). ## Integrations