For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.
Docs Menu

Configure Workforce Identity Federation from Okta

This guide shows you how to configure Workforce Identity Federation using Okta as your IdP.

After integrating Okta and Atlas, your workforce can use their Okta credentials to access Atlas clusters with OIDC authentication.

To manage federated authentication, you must have Organization Owner access to one or more organizations that are delegating federation settings to the instance.

To use Okta as an IdP for Atlas, you must have:

Throughout the following procedure, it is helpful to have one browser tab open to your Atlas Federation Management Console and one tab open to your Okta account.

Use your Okta account to configure Okta as an OIDC IdP.

To register your OIDC application with Okta:

1

In your Okta Admin dashboard, use the left navigation pane to go to Applications → Applications.

  1. On the Applications screen, click Create App Integration.

  2. In the Sign-in method section, select OIDC - OpenID Connect.

  3. In the Application type section, select Native Application.

  4. Click Next.

To learn more, see Create OIDC app integrations.

2

After you create an app integration, you are automatically redirected to the New Native App Integration screen.

  1. In the App integration name field, enter a name for your application.

  2. In the Grant type field, select grant types.

    Enable the following grant types:

    • Authorization Code or Device Authorization

    • (Optional) Refresh Token

      Enabling refresh tokens provides a better user experience. When refresh tokens are not enabled, users must re-authenticate with the identity provider once their access token expires.

  3. In the Sign-in redirect URIs section, enter a URL.

    Enter the following URL: http://localhost:27097/redirect.

  4. In the Assignments section, configure the Controlled access and Enable immediate access fields.

    1. For the Controlled access field, select Allow everyone in your organization to access.

    2. For Enable immediate access field, ensure Enable immediate access with Federation Broker Mode is checked.

  5. Click Save.

To learn more, see Create OIDC app integrations.

3

On your application dashboard, go to the General tab and configure the following:

  1. In the Client ID field, click the icon to copy the client ID for later use.

  2. In the Proof Key for Code Exchange (PKCE) field, ensure Require PKCE as additional verification is enabled (checked by default).

4

In the left navigation pane, go to Security → API. Click Add Authorization Server.

  1. In the Name field, enter a name for your server.

  2. In the Audience field, paste the client ID from the previous step.

  3. (Optional) In the Description field, enter a description of your server.

  4. Click Save.

To learn more, see Create an Authorization Server.

5

After you create your authorization server, you are automatically redirected to your authorization server's screen.

Under the Settings tab, save the issuer URI by copying the first part of the Metadata URI up to the .well-known section. The URI structure should be similar to: https://trial4238026.okta.com/oauth2/ausabgmhveoOQSMsE697.

6

On your authorization server screen, go to the Claims tab and click Add Claim.

  1. Configure Groups claim with the following configuration information:

    Field
    Value

    Name

    Enter a name for your claim.

    Include in token type

    Click the drop-down and select Access Token.

    Value type

    Click the drop-down and select Groups.

    Filter

    Click the drop-down and select Matches regex. Next to the drop-down, enter a regular expression that matches only groups used for Atlas authorization. For example, if your Atlas authorization groups use a common naming prefix, enter ^<mongodb-atlas-group-prefix>.* where <mongodb-atlas-group-prefix> is your chosen prefix.

    Disable claim

    Do not check.

    Include in

    Select Any scope.

  2. Click Create.

Important

Avoid using .* as the filter value. The .* expression matches every group assigned to the user, including groups unrelated to Atlas authorization. A broad filter increases the access token size and can cause authentication failures when the token exceeds the preAuthMaximumMessageSizeBytes limit (16 KiB by default).

To reduce token size, create a dedicated naming convention for Atlas authorization groups and filter on that convention.

If your deployment intentionally requires a large groups claim, you can increase the preAuthMaximumMessageSizeBytes parameter on your cluster. However, increasing this limit has resource and security implications and should not be used as a workaround for an unnecessarily broad claim.

To learn more, see Create Claims.

7

On your authorization server screen, go to the Access Policies tab and click Add Policy.

  1. In the Name field, enter a policy name.

  2. In the Description field, enter a description for the policy.

  3. In the Assign to field, select All clients.

  4. Click Create Policy.

To learn more, see Create an Access Policy.

8

Under the Access Policies tab, click Add Rule.

  1. In the Rule Name field, enter a name for the access policy.

  2. For IF Grant Type is, select a grant type.

    When configuring grant types, select the appropriate option based on the client behavior:

    • If the client is acting on behalf of itself, select Client Credentials.

    • If the client is acting on behalf of a user, select the following:

      • Authorization Code

      • Device Authorization

  3. Add rule configurations based on your organization's security policy.

    Example Okta rule configuration:

    Field
    Value

    AND user is

    Select Any user assigned to the app.

    AND Scopes requested

    Select Any scopes.

    THEN Use this inline hook

    None (disabled)

    AND Access token lifetime is

    1 Hours

    AND Refresh token lifetime is

    Click the second drop-down and select Unlimited.

    but will expire if not used every

    Enter 7 days.

  4. Click Create Rule.

To learn more, see Create Rules for each Access Policy.

9

In the left navigation pane, go to Directory → Groups and click Add Group.

  1. In the Name field, name your directory OIDC.

  2. (Optional) In the Description field, enter a description for your rule.

  3. Click Save.

    To learn more, see Create a group.

  4. Follow the Okta documentation to manually assign people to the group.

10

In the left navigation pane, go to Directory → People and click Add Person.

  1. Provide user details by entering the following values in the corresponding fields:

    Field
    Value

    User type

    Select User.

    First name

    Provide name as needed.

    Last name

    Provide name as needed.

    Username

    Enter an email as a username.

    Primary email

    Enter an email. The email must be same as the one used for the Username field.

    Secondary email

    Optional.

    Groups

    Enter OIDC.

    Activation

    Select Activate Now and check I will set password.

    Password

    Enter a password.

    User must change password on first login

    Select Optional

  2. Click Save.

To learn more, see Add Users Manually.

Note

Prerequisite

This procedure requires you to have Organization Owner access and assumes you already have an OIDC application created in your IdP. To learn how to configure an IdP, see Configure Okta as an Identity Provider.

To configure a Workforce Identity Provider in Atlas:

1
  1. If it's not already displayed, select your desired organization from the Organizations menu in the navigation bar.

  2. In the sidebar, click Federation under the Identity & Access heading.

  3. Click Open Federation Management App.

The Federation page displays.

2
  1. Click Identity Providers in the left sidebar.

  2. Do one of the following steps:

    • If you do not have any Identity Providers configured yet, click Set Up Identity Provider.

    • Otherwise, on the Identity Providers screen, click Configure Identity Provider(s).

  3. Select Workforce Identity Federation and click Continue.

  4. Select OIDC for Data Access.

3
Setting
Necessity
Value
Configuration Name

Required

Human-readable label that identifies this configuration. This label is visible to your Atlas users.

Configuration Description

Optional

Human-readable label that describes this configuration.

Issuer URI

Required

Issuer value provided by your registered IdP application. Using this URI, MongoDB finds an OpenID Provider Configuration Document, which should be available in the /.well-known/openid-configuration endpoint.

Client ID

Required

Unique identifier for your registered application. Enter the clientId value from the app you registered with external Identity Provider.

Audience

Required

Entity that your external identity provider intends the token for. Enter the audience value from the app you registered with external Identity Provider. Generally, this value is the same as the Client ID.

Requested Scopes

Optional

Tokens that give users permission to request data from the authorization endpoint. If you plan to support refresh tokens, this field must include the value offline_access.

For each additional scope you want to add, click Add more scopes.

Authorization Type

Required

Select Group Membership to grant authorization based on IdP user group membership, or select User ID to grant an individual user authorization.

Customize Groups Claim

Required

Identifier of the claim that includes the principal's IdP user group membership information. Accept the default value unless your IdP uses a different claim, or you need a custom claim. This field is only required if you select Group Membership.

Default: groups

Customize User Claim

Required

Identifier of the claim that includes the user principal identity. Accept the default value unless your IdP uses a different claim.

Default: sub

4
5

Note

This step is required only if you need to connect multiple Workforce IdPs to the same organization with different domains. Atlas supports a maximum of two Workforce IdPs connected to an organization: one OIDC IdP (for database access) and one SAML IdP (for UI access).

  1. In your Workforce Identity Provider card, click Associate Domains.

  2. In the Associate Domains with Identity Provider modal, select one or more domains.

  3. Click Submit.

6
  1. Click Connect Organizations.

  2. For the organization you want to connect to Workforce Identity Provider, click Configure Access.

  3. Click Connect Identity Provider.

    Note

    If you have another IdP configured, this button says Connect Identity Provider(s).

7

In the Connect Identity Provider(s) modal, select a Workforce Identity Provider where the Purpose is Workforce Identity Federation.

8

When you connect your Workforce Identity Provider to an organization, Atlas enables your Workforce Identity Provider for all the projects within that organization.

1
  1. If it's not already displayed, select the organization that contains your project from the Organizations menu in the navigation bar.

  2. If it's not already displayed, select your project from the Projects menu in the navigation bar.

  3. In the sidebar, click Database & Network Access under the Security heading.

The Database & Network Access page displays after you complete the preceding steps.

2

Click Add New Database User or Group.

Note

Until you apply your Workforce IdP to Atlas, this button says Add New Database User.

3

In the Authentication Method section, select Federated Auth.

Note

Until you enable Workforce IdP for your organization, you can't select this box.

4

In the Select Identity Provider section, select a configured OIDC Identity Provider.

Specify either the user identifier or group identifier associated with your configured Workforce Identity Provider.

Note

For Azure Entra ID users, this value maps to the Object Id of your Azure user group rather than user group name.

5

To assign privileges to the new user or group, do one or more of the following tasks:

  • Select a built-in role from the Built-in Role dropdown menu.

    • You can select one built-in role per database group in the Atlas UI.

    • If you delete the default option, you can click Add Built-in Role to select a new built-in role.

  • Select or add custom roles.

    • If you have any custom roles defined, you can expand the Custom Roles section and select one or more roles from the Custom Roles dropdown menu.

    • Click Add Custom Role to add more custom roles.

    • Click the Custom Roles link to see the custom roles for your project.

  • Add privileges.

    • Expand the Specific Privileges section and select one or more privileges from the Specific Privileges dropdown menu.

    • Click Add Specific Privilege to add more privileges. This assigns the group specific privileges on individual databases and collections.

  • Remove an applied role or privilege.

    • Click Delete next to the

      role or privilege to delete.

    Note

    Atlas doesn't display the Delete icon next to your Built-in Role, Custom Role, or Specific Privilege selection if you selected only one option. You can delete the selected role or privilege once you apply another role or privilege.

Atlas can apply a built-in role, multiple custom roles, and multiple specific privileges to a database group.

To learn more about authorization, see Role-Based Access Control and Built-in Roles in the MongoDB manual.

6

By default, groups can access all the clusters and federated database instances in the project. To restrict access to specific clusters and federated database instances:

  1. Toggle Restrict Access to Specific Clusters/Federated Database Instances to On.

  2. Select the clusters and federated database instances to grant the group access to from the Grant Access To list.

7

Toggle Temporary User or Temporary Group to On and choose a time after which Atlas can delete the user or group from the Temporary User Duration or Temporary Group Duration dropdown. You can select one of the following time periods for the group to exist:

  • 6 hours

  • 1 day

  • 1 week

In the Database Users tab, temporary users or groups display the time remaining until Atlas deletes the users or group. After Atlas deletes the user or group, any client or application that uses the temporary user's or group's credentials loses access to the cluster.

8

Do one of the following steps:

  • If you added a user, click the Add User button.

  • If you added a group, click the Add Group button.

The following lists the ways you can connect a client to MongoDB with Workforce Identity Federation authentication:

Note

If you configured Device Authorization Flow, you must pass the --oidcFlows=device-auth flag when connecting with mongosh. For example:

mongosh "<connection-string>" \
--authenticationMechanism MONGODB-OIDC \
--oidcFlows=device-auth