> This page location: /docs.md > /docs/management.md > /docs/atlas/operator/current.md > /docs/atlas/operator/current/configure-ak8so-access-to-atlas.md

> For the complete MongoDB documentation index, see www.mongodb.com/docs/llms.txt

# Configure Federated Authentication for Atlas

Atlas Kubernetes Operator doesn't support Atlas Infinite Database clusters in public preview. To learn which features Atlas Infinite Database supports in public preview, see [Atlas Infinite Database Edition](https://www.mongodb.com/docs/atlas/infinite/atlas-infinite-landing/). To learn more about preview features, see [Preview Features](https://www.mongodb.com/docs/preview-features/).

The Atlas Kubernetes Operator (AKO) provides support for configuring [federated authentication](https://www.mongodb.com/docs/atlas/security/federated-authentication.md#std-label-atlas-federated-authentication) in MongoDB Atlas using the [`AtlasFederatedAuth` Custom Resource.](https://www.mongodb.com/docs/atlas/operator/current/atlasfederatedauth-custom-resource.md#std-label-atlasfederatedauth-custom-resource)

[Federated authentication](https://www.mongodb.com/docs/atlas/security/federated-authentication.md#std-label-atlas-federated-authentication) enables you to link user credentials across systems using an Identity Provider (IdP (Identity Provider)). It serves two core purposes:

- Manage user access to the Atlas UI (restricting permissions for viewing, creating, and configuring resources).

- Authenticate and authorize access to Atlas clusters (for human users and applications).

Both functionalities can be configured simultaneously through the [`AtlasFederatedAuth` Custom Resource.](https://www.mongodb.com/docs/atlas/operator/current/atlasfederatedauth-custom-resource.md#std-label-atlasfederatedauth-custom-resource)

**Note:**

Atlas Kubernetes Operator supports the configuration of existing IdPs (Identity Providers) in an Atlas Organization, not the creation of them in Atlas. You must complete this procedure before using this resource with AKO.

- Learn how to create a SAML (Security Assertion Markup Language) IdP (Identity Provider) for UI Access in [Manage Identity Providers.](https://www.mongodb.com/docs/atlas/security/manage-federated-auth.md#std-label-atlas-manage-fed-auth)

- Learn how to create an IdP (Identity Provider) for cluster access for a workforce (OIDC) in [Configure an External Identity Provider Application.](https://www.mongodb.com/docs/atlas/workforce-oidc/#configure-an-external-identity-provider-application)

- Learn how to create an IdP (Identity Provider) for cluster access for an application/workload (OAuth 2.0) in [Prepare Your External Identity Provider.](https://www.mongodb.com/docs/atlas/workload-oidc/#prepare-your-external-identity-provider)

## Atlas UI Access (SAML)

Atlas access (or UI Access) allows Organization owners to automatically grant roles in Atlas to users in the organization once they authenticate, based on their roles in an IdP (Identity Provider) such as Microsoft Entra ID or Google Workspace.

**Note:**

When a federated IdP (Identity Provider) is enabled, Atlas disables all other authentication methods.

Once you have created a UI Access IdP (Identity Provider) and associated it with your organization, you can configure it using the Atlas Kubernetes Operator.

This example does the following:

- Enables [federated authentication](https://www.mongodb.com/docs/atlas/security/federated-authentication.md#std-label-atlas-federated-authentication) for the organization linked to the specified secret.

- Adds `my-org-domain.com` as an approved domain.

- Enables domain restriction for the organization.

- Disables debugging for SSO (Single Sign-On).

- Grants the [`Organization Member`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Organization-Member) role to users after authenticating.

- Maps the [`Organization Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Organization-Owner) role for the organization and applies the role mapping to an IdP (Identity Provider) group named `org-admin`.

- Maps the [`Organization Project Creator`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Organization-Project-Creator) and [`Project Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Project-Owner) roles for a project in the organization named `dev-project` and applies the role mapping to an IdP (Identity Provider) group named `dev-team`.

**Note:**

The [spec.roleMappings.roleAssignments](https://www.mongodb.com/docs/atlas/operator/current/atlasfederatedauth-custom-resource.md#std-label-atlasfederatedauth-spec-rolemappings-roleassignments) parameter must include at least one organization [role](https://www.mongodb.com/docs/atlas/reference/user-roles.md#std-label-user-roles) within the current organization or the projects in the organization.

**Example:**

```sh
cat <<EOF | kubectl apply -f -
apiVersion: atlas.mongodb.com/v1
kind: AtlasFederatedAuth
metadata:
  name: atlas-default-federated-auth
  namespace: mongodb-atlas-system
spec:
  enabled: true
  connectionSecretRef:
    name: my-org-secret
    namespace: mongodb-atlas-system
  domainAllowList:
    - my-org-domain.com
  domainRestrictionEnabled: true
  ssoDebugEnabled: false
  postAuthRoleGrants:
    - ORG_MEMBER
  roleMappings:
    - externalGroupName: org-admin
      roleAssignments:
        - role: ORG_OWNER
    - externalGroupName: dev-team
      roleAssignments:
        - role: ORG_GROUP_CREATOR
        - projectName: dev-project
          role: GROUP_OWNER
EOF
```

Additional information on configuring the `AtlasFederatedAuth` resource can be found in the [`AtlasFederatedAuth` Custom Resource.](https://www.mongodb.com/docs/atlas/operator/current/atlasfederatedauth-custom-resource.md#std-label-atlasfederatedauth-custom-resource)

## Atlas Cluster Access (OIDC/OAuth 2.0)

Cluster Access allows Organization owners to use identity providers (using OIDC or OAuth 2.0) to provide data access to a database cluster in Atlas based on [roles](https://www.mongodb.com/docs/atlas/reference/user-roles.md#std-label-user-roles) in the IdP (Identity Provider). This feature can be further distinguished by whether the access is being granted to a human user, or to an application:

- **Workload** is for Applications; allowing external applications to authenticate through programmatic identities, such as Service Principals in Azure (Microsoft Azure) or Service Accounts in Google Cloud, using OAuth 2.0.

- **Workforce** is for users; allowing authentication and authorization to the database through an external IdP (Identity Provider), such as Microsoft Entra ID or Okta, using OIDC.

To enable Atlas Cluster Access through AKO, add the IdP (Identity Provider) ID to the `dataAccessIdentityProviderIds` field in the `AtlasFederatedAuth` resource.

```yaml
apiVersion: atlas.mongodb.com/v1
kind: AtlasFederatedAuth
metadata:
  name: atlas-default-federated-auth
  namespace: mongodb-atlas-system
spec:
  enabled: true
  dataAccessIdentityProviders:
    - 32b6e34b3d91647abb20e7b8
    - 42d8v92k5a34184rnv93f0c1
  connectionSecretRef:
    name: my-org-secret
    namespace: mongodb-atlas-system
```

Additional information on configuring the `AtlasFederatedAuth` resource can be found in the [`AtlasFederatedAuth` Custom Resource.](https://www.mongodb.com/docs/atlas/operator/current/atlasfederatedauth-custom-resource.md#std-label-atlasfederatedauth-custom-resource)

The authentication enables the IdP (Identity Provider) for usage within the organization, and cluster access can now be granted using this IdP (Identity Provider) in the [AtlasDatabaseUser](https://www.mongodb.com/docs/atlas/operator/current/atlasdatabaseuser-custom-resource.md#std-label-atlasdatabaseuser-custom-resource), by configuring the `oidcAuthType` and setting the appropriate ID and name in the `username` field.

- For **Workforce** access, set the `oidcAuthType` field to `USER`, the `databaseName` field to `admin`, and the `username` field to `<Atlas IdP ID>/IdP Username`.

- For **Workload** access, set the `oidcAuthType` field to `IDP_GROUP`, the `databaseName` field to `$external`, and the `username` field to `<Atlas IdP ID>/IdP Group Name`.

```yaml
apiVersion: atlas.mongodb.com/v1
kind: AtlasDatabaseUser
metadata:
  name: my-workload-user
  namespace: mongodb-atlas-system
spec:
  databaseName: $external
  roles:
    - roleName: "readWrite"
      databaseName: "my-database"
  projectRef:
    name: my-project
  username: idp-id-in-atlas/my-idp-group-name
  oidcAuthType: IDP_GROUP
```

```yaml
apiVersion: atlas.mongodb.com/v1
kind: AtlasDatabaseUser
metadata:
  name: my-workforce-user
  namespace: mongodb-atlas-system
spec:
  databaseName: admin
  roles:
    - roleName: "readWrite"
      databaseName: "my-database"
  projectRef:
    name: my-project
  username: idp-id-in-atlas/my-idp-user-name
  oidcAuthType: USER
```

Additional information on configuring the `AtlasDatabaseUser` resource can be found in the [`AtlasDatabaseUser` Custom Resource.](https://www.mongodb.com/docs/atlas/operator/current/atlasdatabaseuser-custom-resource.md#std-label-atlasdatabaseuser-custom-resource)
