This article documents the steps for setting up Okta with MongoDB Compass by using a Native OpenID Connect app.
- Okta Integrator Free Plan org
- API Access Management
- OpenID Connect
- MongoDB Compass
NOTE:
- API Access Management Product or access to a Custom Authorization Server, such as "default", is needed to complete these steps. If this setup is needed, reach out to the Account Executive before proceeding.
- An Okta Integrator Free Plan org is pre-configured with a custom authorization server named "default".
OKTA SIDE
- In the Admin Dashboard, select Applications > Applications in the sidebar.
- Click Create App Integration.
- Under Sign-in method, select OIDC - OpenID Connect.
- Under Application type, select Native Application.
- Confirm creating the application by clicking Next.
- In the application creation screen:
- Name the application.
- In the Grant Type section, allow Authorization Code, Refresh Token, and Device Authorization.
- In the Sign-in redirect URIs section, allow the redirect URL http://localhost:27097/redirect.
- Delete sign-out redirect URIs.
- In the Controlled access section, choose Allow everyone in your organization to access.
- Check Enable immediate access with Federation Broker Mode.
- Click Save to complete the application.
- In the application configuration screen:
- Ensure Require PKCE as additional verification is checked (should be by default).
- Write down the Client ID value somewhere:
- In the dashboard sidebar, go to Security > API.
- Click Add Authorization Server.
- Fill in any name.
- Copy the Client ID value from the previous step into the Audience field.
- Click Save.
- In the Authorization Server configuration screen:
- Write down the first part of the URI listed under Metadata URI, before the
.well-knownpart (without a trailing slash). This value is now called "Issuer URI". - Go to the Claims tab, click Add Claim.
- Name: groups
- Include in token type: Access Token
- Value type: Groups
- Filter: Matches regex, .*
- Disable claim: unchecked
- Include in: Any scope
- Click Create.
- Write down the first part of the URI listed under Metadata URI, before the
- Go to the Access Policies tab and click Add Policy.
- Name: Atlas OIDC AuthZ Policy.
- Description: Whatever is desired.
- Assign to: All clients.
- Click Create Policy.
- In the policy configuration, click Add Rule.
- Rule Name: Default Rule
- Client acting on behalf of itself: Client Credentials
- Client acting on behalf of a user: Authorization code, Implicit (hybrid), Resource Owner Password, SAML 2.0 Assertion, Device Authorization, Token exchange
- And user is: Any user assigned the app
- And scopes requested: any scopes
- Then use this inline hook: None (disabled)
- And access token lifetime is: 1 hours
- And refresh token lifetime is: Unlimited
- But will expire if not used every: 7 days
- Create rule
- Navigate to Directory > Groups.
- Add group.
- Name: Atlas OIDC.
- Description: as desired.
- Add users to this group as desired.
ATLAS SIDE
- Navigate to FMC > Identity Providers > Set Up Identity Provider.
- Select OIDC for Data Access:
- Config details:
- Configuration Name: As desired.
- Configuration Description: As desired.
- Issuer URI: Value from Metadata URI from Okta Authorization Server.
- Client ID: Value from Okta App Settings.
- Audience: Value from Okta Authorization Server.
- Requested scopes: Do not put anything here.
- User claim: keep as "sub".
- Groups claim: keep as "groups".
- Save and Finish.
- Associate Domains: add a federated domain here:
- Click Connect Organizations.
- Select Configure Access on the desired org.
- Click Connect Identity Provider.
- Check the box for the IdP created in step 3 here.
- Click Connect.
- Go to the project where the MongoDB 7.0 cluster is deployed in the org selected above:
- Database Access > Add New Database User or Group.
- Select Federated Auth.
- Select Identity Provider: Select the IdP that was just created.
- Group Identifier: Type the group name created in Okta Directory.
- Give it a role.
- Add group.
- Click Connect Organizations.
- Select OIDC for Data Access:
