# Okta SSO for AlmaForge

Last verified: December 1, 2026

Connect AlmaForge to Okta with OpenID Connect (OIDC) and map Okta groups to AlmaForge roles. Users sign in with their Okta account and receive roles from their current group memberships.

This guide uses an Okta **Custom Authorization Server** to configure the `groups` scope, claim, and access policy in one place. Okta's org authorization server also supports a `groups` claim in ID tokens if your organization does not have API Access Management. See [Okta's groups claim guide](https://developer.okta.com/docs/guides/customize-tokens-groups-claim/main/) and the [generic OIDC setup](https://almaforge.com/sso/oidc.md#configuration) for that path.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

### AlmaForge cluster[​](#almaforge-cluster "Direct link to AlmaForge cluster")

Use a running cluster. If you already have an admin CLI profile, run this on your workstation and confirm the active profile points to your cluster.

******Terminal

```bash
alma status
```

If Okta will be your first SSO connector, use the local admin identity on the Auth Service host to apply it. See [Connect your first identity provider](https://almaforge.com/deployment/standalone.md#step-5-connect-your-identity-provider).

Have the public HTTPS address of the Proxy Service ready. You will use its hostname to build the Okta redirect URI.

### Okta administrator[​](#okta-administrator "Direct link to Okta administrator")

You need an Okta administrator account that can create OIDC applications, manage groups, and configure custom authorization servers. The built-in **Super Admin** role covers all required permissions.

### Okta API Access Management[​](#okta-api-access-management "Direct link to Okta API Access Management")

Custom authorization servers require Okta's **API Access Management** feature. Okta Integrator Free Plan organizations provide a preconfigured custom authorization server for testing. Production organizations need a plan with the API Access Management add-on.

### Okta groups[​](#okta-groups "Direct link to Okta groups")

Have at least one Okta group ready to map to AlmaForge roles. Okta emits group names as strings (for example, `almaforge-admins`), not email addresses or UUIDs. Group name matching in AlmaForge is exact and case-sensitive. Copy each group name verbatim from **Directory → Groups** in Okta.

Use a direct member of a mapped group for the first sign-in test.

### Network access from Auth Service hosts[​](#network-access-from-auth-service-hosts "Direct link to Network access from Auth Service hosts")

The Auth Service uses your Okta domain to discover its OIDC configuration, verify token signatures, and exchange authorization codes for tokens. Allow outbound HTTPS (TCP port 443) from every Auth Service host to your Okta domain, such as `example.okta.com` or your custom domain.

Run this check from each Auth Service host, replacing `example.okta.com` with your Okta domain.

******Terminal

```bash
curl -sS --max-time 10 -o /dev/null \
    -w "example.okta.com: HTTP %{http_code}\n" \
    "https://example.okta.com/"
```

An HTTP response confirms connectivity. If `curl` reports `HTTP 000`, check DNS, firewall, proxy, or TLS settings before continuing.

## Step 1. Configure Okta with Terraform[​](#step-1-configure-okta-with-terraform "Direct link to Step 1. Configure Okta with Terraform")

If you do not use Terraform, follow [Okta Admin Console setup](#step-1-configure-okta-in-the-okta-admin-console) below instead.

Save [`almaforge-okta-sso.tf`](https://almaforge.com/examples/sso/okta/terraform/almaforge-okta-sso.tf) in a new private working directory. It creates the OIDC web application, custom authorization server, `groups` scope and claim, access policy and rule, and the `almaforge-admins` and `almaforge-developers` groups. It assigns both groups to the application. Keep Terraform state, state backups, and exported secrets out of source control.

Export your Okta API credentials, replace `almaforge.example.com` with your public Proxy Service hostname, and apply:

******Terminal

```bash
umask 077
export OKTA_ORG_NAME="example"
export OKTA_BASE_URL="okta.com"
export OKTA_API_TOKEN="<okta-api-token>"
terraform init
terraform apply -var='proxy_public_addr=almaforge.example.com'
terraform output -raw issuer_url
terraform output -raw client_id
terraform output -raw client_secret > okta-secret.txt
```

Continue to [Step 2](#step-2-apply-the-oidcconnector) to install `okta-secret.txt` and apply the connector manifest.

## Step 1. Configure Okta in the Okta Admin Console[​](#step-1-configure-okta-in-the-okta-admin-console "Direct link to Step 1. Configure Okta in the Okta Admin Console")

Use this section if you do not use Terraform. If you already provisioned Okta with Terraform above, skip to [Step 2](#step-2-apply-the-oidcconnector).

### Step 1.1. Create the OIDC application[​](#step-11-create-the-oidc-application "Direct link to Step 1.1. Create the OIDC application")

1. Sign in to the **Okta Admin Console**.

2. Open **Applications → Applications** and click **Create App Integration**.

3. Select **OIDC - OpenID Connect** as the Sign-in method and **Web Application** as the Application type, then click **Next**.

   ![Create app integration dialog in Okta with OIDC and Web Application selected](/examples/sso/okta/screenshots/okta-create-oidc-web-app.png)

4. Set these fields.

   * **App integration name**: `AlmaForge SSO`
   * **Grant type**: Select **Authorization Code**.
   * **Sign-in redirect URIs**: Enter `https://almaforge.example.com/api/v1/oidc/callback`. Replace `almaforge.example.com` with your public Proxy Service hostname. Keep `https://`, omit `:443`, and omit the trailing slash.
   * **Sign-out redirect URIs**: Optional. Leave blank or enter `https://almaforge.example.com/`.
   * **Controlled access**: Select **Limit access to selected groups** and pick the Okta groups that should access AlmaForge rather than allowing everyone.

   ![New Web App Integration form in Okta with AlmaForge SSO redirect URIs](/examples/sso/okta/screenshots/okta-oidc-app-redirect-uris.png)

5. Click **Save**.

6. On the application's **General** tab under **Client Credentials**, copy the **Client ID** and **Client secret**.

Treat the client secret as a password

Anyone with the client secret can impersonate AlmaForge to Okta's OAuth endpoints. Store it in the same secret manager you use for production credentials. Do not commit it to Git.

### Step 1.2. Create a custom authorization server[​](#step-12-create-a-custom-authorization-server "Direct link to Step 1.2. Create a custom authorization server")

1. In the left sidebar, open **Security → API**.

2. On the **Authorization Servers** tab, click **Add Authorization Server**.

3. Set these fields.

   * **Name**: `almaforge`
   * **Audience**: `almaforge` (Okta requires an audience value. AlmaForge verifies the ID token `aud` claim against `clientID`, so this value does not need to match anything in the connector.)
   * **Description**: `AlmaForge OIDC Authorization Server`

4. Click **Save**. Okta opens the new authorization server with five tabs across the top: **Settings**, **Scopes**, **Claims**, **Access Policies**, and **Token Preview**.

5. On the **Settings** tab, copy the **Issuer URI** (for example, `https://example.okta.com/oauth2/<auth-server-id>`).

### Step 1.3. Add the groups scope and claim[​](#step-13-add-the-groups-scope-and-claim "Direct link to Step 1.3. Add the groups scope and claim")

Scopes and claims are configured on the **custom authorization server** you created in [Step 1.2](#step-12-create-a-custom-authorization-server), not on the OIDC application. If you navigated away, open **Security → API → Authorization Servers** and click your `almaforge` authorization server.

1. Click the **Scopes** tab and click **Add Scope**.

2. Set **Name** to `groups`, **Display name** to `Groups`, and **Description** to `Return Okta group memberships`, then click **Create**.

3. Click the **Claims** tab right next to **Scopes** and click **Add Claim**.

4. Set these fields.

   * **Name**: `groups`
   * **Include in token type**: **ID Token** and **Always**
   * **Value type**: **Groups**
   * **Filter**: **Matches regex** with `.*` (or use **Starts with** to limit emitted groups to a prefix such as `almaforge-`)
   * **Include in**: **Any scope** (or **The following scopes** → `groups`)

5. Click **Create**. Confirm that `groups` appears in the **Claims** table with **Type** `id` and **Included** `Always`.

   ![Claims tab on an Okta custom authorization server showing the groups ID token claim](/examples/sso/okta/screenshots/okta-auth-server-groups-claim.png)

### Step 1.4. Add an access policy and rule[​](#step-14-add-an-access-policy-and-rule "Direct link to Step 1.4. Add an access policy and rule")

Still inside your `almaforge` custom authorization server (**Security → API → Authorization Servers → `almaforge`**), add an access policy and rule. Custom authorization servers do not ship with a default policy, so Okta will not issue tokens until you add one.

1. Click the **Access Policies** tab right next to **Claims** and click **Add Policy**.

   ![Access Policies tab on an Okta custom authorization server showing the Add Policy button](/examples/sso/okta/screenshots/okta-auth-server-access-policies.png)

2. Set **Name** to `Default`, select **Assign to → The following clients**, and pick the `AlmaForge SSO` application from [Step 1.1](#step-11-create-the-oidc-application). Click **Create Policy**.

3. Inside the new policy, click **Add Rule** and set these fields.

   * **Rule Name**: `Default`
   * **IF Grant type is**: **Authorization Code**
   * **AND User is**: **Any user assigned the app**
   * **AND Scopes requested**: **Any scopes** (or **The following scopes** including `openid`, `profile`, `email`, and `groups`)

   ![Add Rule dialog in Okta Access Policies showing Authorization Code and user settings](/examples/sso/okta/screenshots/okta-access-policy-add-rule.png)

4. Click **Create Rule**.

No policy means access\_denied at token exchange

Without an explicit access policy and rule on the custom authorization server, Okta returns `access_denied` at token exchange even though browser sign-in appears to succeed.

## Step 2. Apply the OIDCConnector[​](#step-2-apply-the-oidcconnector "Direct link to Step 2. Apply the OIDCConnector")

Store the client secret in a root-only file on each Auth Service host. `almad` runs as root, so only root needs read access to the file.

******Terminal

```bash
sudo install -o root -g root -m 0600 /dev/stdin /etc/almaforge/okta-secret.txt <<'EOF'
<client-secret-value>
EOF
```

In a multi-node Auth Service cluster, every host needs an identical secret file at this exact path. The instance that handles a login reads the file locally. See [High availability](#high-availability) to prevent intermittent login failures.

Write a YAML file describing the connector. Set `clientSecret` to a `${file:PATH}` reference so the Auth Service reads the secret from disk, and map Okta group names to AlmaForge roles under `claimsToRoles`:

[`okta.yaml`](https://almaforge.com/examples/sso/okta/almad.d/okta.yaml):

examples/sso/okta/almad.d/okta.yaml

```yaml
# Okta connector loading clientSecret from a local file.

apiVersion: almaforge.com/v1

kind: OIDCConnector

metadata:

  name: okta

spec:

  display: Okta

  issuerURL: https://<okta-domain>/oauth2/<auth-server-id>

  clientID: <okta-client-id>

  clientSecret: ${file:/etc/almaforge/okta-secret.txt}

  scope:

    - openid

    - profile

    - email

    - groups

  # Use exact, case-sensitive Okta group names under value and list existing

  # AlmaForge roles.

  claimsToRoles:

    - claim: groups

      value: almaforge-admins

      roles: [admin, access]

    - claim: groups

      value: almaforge-developers

      roles: [access]
```

Replace:

* `<okta-domain>` and `<auth-server-id>` with the **Issuer URI** from [Step 1](#step-1-configure-okta-with-terraform) (or [Step 1.2](#step-12-create-a-custom-authorization-server)).
* `<okta-client-id>` with the **Client ID** from [Step 1](#step-1-configure-okta-with-terraform) (or [Step 1.1](#step-11-create-the-oidc-application)).
* The path inside `${file:...}` with the path where you installed `okta-secret.txt` on every Auth Service host.
* The `claimsToRoles` entries with your Okta group names and AlmaForge roles. Matching is exact and case-sensitive.

`spec.scope` must include `groups` explicitly. Without it, Okta omits the `groups` claim even when configured on the authorization server.

Alternative: load the client secret from an environment variable or inline

`clientSecret` also accepts an environment variable reference (`${env:OKTA_CLIENT_SECRET}`) or an inline string. An inline value stores the secret directly in the cluster state store, where it is returned by `alma get oidcconnector/okta -o yaml --with-secrets` and included in backend backups. Prefer `${file:PATH}` or `${env:VAR}` in production. See [Secret storage](https://almaforge.com/sso/oidc.md#secret-storage).

Test break-glass before applying

AlmaForge has no local accounts. If this is the only connector, a wrong claim mapping or expired client secret prevents new logins. Confirm your [break-glass procedure](https://almaforge.com/break-glass.md) works before applying the connector to a production cluster.

If you have a cluster admin profile, apply the connector from your workstation.

******Terminal

```bash
alma apply -f okta.yaml
```

If this is your first connector, copy `okta.yaml` to the Auth Service host and apply it there using the local admin identity.

******Terminal

```bash
sudo alma apply -f okta.yaml
```

## Step 3. Verify the connector[​](#step-3-verify-the-connector "Direct link to Step 3. Verify the connector")

Open the cluster's [audit log](https://almaforge.com/reference/audit.md) for your test account. See [SSO verification](https://almaforge.com/sso/oidc.md#step-4-apply-and-verify) for event fields and the distinction from service logs.

Keep your admin session open. From a separate workstation or OS account, sign in as a direct member of a mapped Okta group. Replace the example proxy address with yours.

******Terminal

```bash
alma login --proxy=almaforge.example.com
```

Choose **Okta** in the browser. The test passes when `alma` prints the roles expected for that user.

If this is the cluster's first connector, also sign in with an account mapped to `admin`. Confirm that `alma` prints the `admin` role before closing the local admin session on the Auth Service host.

Audit events from a successful sign-in

A successful first-time login emits a `UserLogin` event and the `CertificateCreate` event for the certificate it mints:

JSON

```json
{

  "kind": "AuditEvent",

  "apiVersion": "almaforge.com/v1",

  "spec": {

    "id": "5a4b3c2d-1e0f-4958-8776-655443322110",

    "index": 0,

    "timestamp": "2026-03-30T15:58:58.999000Z",

    "clusterName": "almaforge.example.com",

    "code": "T1001I",

    "type": "UserLogin",

    "verb": "login",

    "actor": {

      "name": "alice@example.com",

      "type": "user"

    },

    "status": {

      "success": true

    },

    "userLogin": {

      "method": "oidc",

      "attributes": {

        "connector_id": "okta",

        "connector_type": "oidc",

        "email": "alice@example.com",

        "name": "Alice Example",

        "request_id": "8f0c1e6a-2f7e-4a7a-9f1e-1f0b6d0f1a2b",

        "username": "alice@example.com"

      }

    }

  }

}
```

JSON

```json
{

  "kind": "AuditEvent",

  "apiVersion": "almaforge.com/v1",

  "spec": {

    "id": "b1c2d3e4-f506-4718-8929-3a4b5c6d7e8f",

    "index": 0,

    "timestamp": "2026-03-30T15:58:58.999000Z",

    "clusterName": "almaforge.example.com",

    "code": "TC000I",

    "type": "CertificateCreate",

    "verb": "create",

    "certificateCreate": {

      "certType": "user",

      "identity": {

        "user": "alice@example.com",

        "roles": [

          "admin",

          "access"

        ],

        "logins": [

          "tester",

          "ec2-user",

          "root"

        ],

        "traits": {

          "email": [

            "alice@example.com"

          ],

          "groups": [

            "almaforge-admins",

            "engineering"

          ],

          "name": [

            "Alice Example"

          ],

          "preferred_username": [

            "alice@example.com"

          ]

        }

      }

    }

  }

}
```

Check `spec.certificateCreate.identity.traits.groups`. It contains the exact group names Okta emitted on the `groups` claim. If `groups` is missing or empty:

* `groups` is missing from `spec.scope` in `okta.yaml`.
* The `groups` claim is missing on the custom authorization server ([Step 1.3](#step-13-add-the-groups-scope-and-claim)), or its filter excludes the user's groups.
* The user is not assigned to the OIDC application in Okta ([Step 1.1](#step-11-create-the-oidc-application)).

Read the full audit-event breakdown on the [generic OIDC verification section](https://almaforge.com/sso/oidc.md#step-4-apply-and-verify).

## Troubleshooting[​](#troubleshooting "Direct link to Troubleshooting")

### access\_denied after the callback[​](#access_denied-after-the-callback "Direct link to access_denied after the callback")

Okta returned `access_denied` or `invalid_grant` at token exchange even though browser sign-in appeared to succeed. Open your authorization server under **Security → API → Authorization Servers → Access Policies**, confirm a policy is assigned to `AlmaForge SSO`, and verify an active rule allows the **Authorization Code** grant type ([Step 1.4](#step-14-add-an-access-policy-and-rule)).

### No roles match the login[​](#login-succeeds-but-no-roles-are-assigned "Direct link to No roles match the login")

The login is rejected when no mapping assigns a role. Check these conditions first:

* `spec.scope` in `okta.yaml` includes `groups`.
* Under **Claims** on the authorization server, the `groups` claim is set to **ID Token** and **Always**.
* Every `claimsToRoles` value matches the Okta group name verbatim (exact and case-sensitive).

With `ALMA_LOG_LEVEL=debug` on the Auth Service host, sign in again and inspect the claims Okta sent:

******Terminal

```bash
journalctl -u almad -f | grep 'Extracted claims'
```

After a successful login, inspect `spec.certificateCreate.identity.traits.groups` in the `CertificateCreate` audit event. See [Claims, traits, and role templates](https://almaforge.com/sso/oidc.md#claims-traits-and-role-templates).

### Invalid issuer URL[​](#invalid-issuer-url "Direct link to Invalid issuer URL")

For the custom authorization server setup in this guide, set `spec.issuerURL` to `https://<okta-domain>/oauth2/<auth-server-id>` from the authorization server's **Settings** tab. The bare org URL (`https://<okta-domain>`) applies only to the org-server alternative.

### unauthorized\_client[​](#unauthorized_client "Direct link to unauthorized_client")

The `clientID` in `okta.yaml` does not match the OIDC application assigned to the authorization server's access policy, or the user is not assigned to the application. Confirm both in the Okta Admin Console and re-apply.

### 429 Too Many Requests[​](#429-too-many-requests "Direct link to 429 Too Many Requests")

Okta enforces strict per-org rate limits on the token and userinfo endpoints. In a multi-node Auth Service cluster during a login spike, every Auth instance calls Okta independently. Monitor the Auth journal for HTTP 429 responses and contact Okta support for a rate-limit increase if legitimate login volume exceeds your limit.

## Operations[​](#operations "Direct link to Operations")

### Break-glass access[​](#break-glass-access "Direct link to Break-glass access")

Test [break-glass access](https://almaforge.com/sso/oidc.md#break-glass-access) before relying on this connector. Okta-specific recovery cases include a deleted authorization server or revoked access policy, alongside rotated client secrets and incorrect `claimsToRoles` mappings.

### Revocation[​](#revocation "Direct link to Revocation")

Removing a user from an Okta group takes effect on their next sign-in. Existing certificates remain valid until they expire. For an immediate cutoff, [lock the user](https://almaforge.com/revoking-access.md#lock-a-user).

### Secret storage[​](#secret-storage "Direct link to Secret storage")

Use `${file:PATH}` or `${env:VAR}` to keep `clientSecret` out of the cluster state store and its backups. Follow [Secret storage](https://almaforge.com/sso/oidc.md#secret-storage) to protect secrets in production.

### Client secret rotation[​](#client-secret-rotation "Direct link to Client secret rotation")

An Okta OIDC application can hold multiple active client secrets, so you can rotate one without downtime:

1. In the **Okta Admin Console**, open your OIDC application's **General** tab and click **Generate new secret** under **Client Credentials**. Do not delete the old secret yet.
2. Copy the new secret value.
3. Replace `/etc/almaforge/okta-secret.txt` on every Auth Service host using your configuration management tool (Ansible, Puppet, cloud-init, or Kubernetes secret mounts).
4. Confirm a test login works through `alma login`.
5. Delete the old secret in Okta.

The connector reads the file on the next login. No `almad` restart is required. If you configured an inline `clientSecret`, re-apply the connector with the new value.

### Lifecycle[​](#lifecycle "Direct link to Lifecycle")

Apply connector changes before testing the next login. No `almad` restart is needed. See [When connector changes take effect](https://almaforge.com/sso/oidc.md#when-connector-changes-take-effect) for discovery caching and IdP-side changes.

### High availability[​](#high-availability "Direct link to High availability")

AlmaForge reads `/etc/almaforge/okta-secret.txt` on the Auth Service instance that handles each login callback. In a multi-node Auth Service cluster, a missing or stale file on one instance causes intermittent login failures. Deploy the file through configuration management so every Auth Service host has an identical copy at the same path with mode `0600`.

Every Auth Service instance also calls Okta independently and caches the OIDC discovery document for one hour. See [High availability](https://almaforge.com/sso/oidc.md#high-availability) on the generic OIDC page for the full list of per-instance assumptions.

### Monitoring[​](#monitoring "Direct link to Monitoring")

Monitor the [audit log](https://almaforge.com/reference/audit.md) for login outcomes. For diagnostics, inspect the Auth journal for token validation and the Proxy journal for browser callbacks. On each service host, tail OIDC-related messages with:

******Terminal

```bash
journalctl -u almad -f | grep -Ei 'okta|oidc'
```

Check `UserLogin` failures and their `spec.status.error` field. See [SSO verification](https://almaforge.com/sso/oidc.md#step-4-apply-and-verify) for event codes, certificate fields, and debug-only journal copies. Collect records from [audit event storage](https://almaforge.com/storage.md#audit-events) for SIEM ingestion. Collect service diagnostics from the journal separately.

### Removal[​](#removal "Direct link to Removal")

Delete the connector resource:

******Terminal

```bash
alma delete oidcconnector/okta
```

Existing sessions issued through the connector remain valid until their certificates expire. No new sessions will be issued.

On the Okta side, remove `/etc/almaforge/okta-secret.txt` from Auth Service hosts and delete the OIDC application and custom authorization server. If other AlmaForge clusters share the same authorization server, leave it in place.

## References[​](#references "Direct link to References")

* [`OIDCConnector` resource reference](https://almaforge.com/reference/configuration.md#oidcconnector)
* [`AuthConfig` resource reference](https://almaforge.com/reference/configuration.md#authconfig)
* [Generic OIDC integration guide](https://almaforge.com/sso/oidc.md)
* [Break-glass access guide](https://almaforge.com/break-glass.md)
* [Okta: Create OIDC app integrations](https://help.okta.com/en-us/content/topics/apps/apps_app_integration_wizard_oidc.htm)
* [Okta: Build a custom authorization server](https://developer.okta.com/docs/guides/customize-authz-server/main/)
* [Okta: Customize tokens returned from Okta with a groups claim](https://developer.okta.com/docs/guides/customize-tokens-groups-claim/main/)
