> This page location: /docs.md > /docs/management.md > /docs/atlas/management/organizations/organization-security.md > /docs/atlas/security/federated-authentication.md

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

<!--
Tab options on this page. Append to the .md URL to filter:
  ?tabs=<id,...>   select specific tabs (e.g. ?tabs=nodejs,shell)
  ?allTabs=true    include every tab
  (no param)       default: one tab per tabset

Available tabs:
  other tabs: upload-html, create-dns
-->

# Manage Domain Mapping for Federated Authentication

You can map domains to your IdP (Identity Provider) to streamline the login experience for users from specified domains by authenticating them through an IdP (Identity Provider). Domain mapping ensures that all users with a particular domain in their email address have the same login experience.

Domain mapping also limits the users that can authenticate through your IdP (Identity Provider). Atlas denies access to users whose email addresses use unmapped domains, even if the IdP (Identity Provider) authenticates them. This behavior applies regardless of the [Restrict Access by Domain](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-restrict-org-access-by-domain) setting.

To grant access to a user on an unmapped domain, map that domain to your IdP (Identity Provider) with the procedure on this page. If your organization doesn't own the domain, [invite the user through the standard flow](https://www.mongodb.com/docs/atlas/invitations.md#std-label-inviting-federated-users) instead.

**Important:**

When you map a single domain to multiple identity providers, users who log in using the MongoDB Cloud console are automatically redirected to the IdP (Identity Provider) associated with the first SAML (Security Assertion Markup Language) IdP (Identity Provider) application that was configured for Atlas.

To use an alternative identity provider, users must log in through either an SP-initiated or IdP-initiated login URL.

To map a domain to your IdP (Identity Provider), you must verify that you own the domain. You can either:

- Upload an HTML (Hypertext Markup Language) file containing a verification key to a host in your domain or

- Create a DNS (Domain Name System) [TXT record](https://en.wikipedia.org/wiki/TXT_record?oldid=930320014) that contains a verification key.

## Required Access

To manage federated authentication, you must have [`Organization Owner`](https://www.mongodb.com/docs/atlas/reference/user-roles.md#mongodb-authrole-Organization-Owner) access to one or more organizations that are delegating federation settings to the instance.

## Prerequisites

To complete this tutorial, you must have already linked an IdP (Identity Provider) to Atlas. To learn how to link an IdP (Identity Provider) to Atlas, see [Manage Identity Providers.](https://www.mongodb.com/docs/atlas/security/manage-federated-auth.md#std-label-atlas-manage-fed-auth)

## Map a Domain to Your Identity Provider

1. In Atlas, go to the Federation Management console for your organization.

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

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

   Click Open Federation Management App.

   The [Federation](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%23%2Forg%2F%3Corganization%3E%2Ffederation) page displays.

2. Enter domain mapping information.

   Click Add a Domain.

   On the Domains screen, click Add Domain.

   Enter the following information for your domain mapping:

   | Field | Description |
   | --- | --- |
   | Display Name | Name to easily identify the domain. |
   | Domain Name | [Domain name](https://en.wikipedia.org/wiki/Domain_name) to map. |

   Click Next.

3. Choose how to verify your domain.

   **Note:**

   You can choose the verification method once. It cannot be modified. To select a different verification method, delete and recreate the domain mapping.

   Select the appropriate tab based on whether you are verifying your domain by uploading an HTML (Hypertext Markup Language) file or creating a DNS (Domain Name System) TXT record:

   ### Upload HTML File

   Upload an HTML (Hypertext Markup Language) file containing a verification key to verify that you own your domain.

   Click HTML File Upload.

   Click Next.

   Download the `mongodb-site-verification.html` file that Atlas provides.

   Upload the HTML (Hypertext Markup Language) file to a web site on your domain. You must be able to access the file at `<https://host.domain>/mongodb-site-verification.html`.

   Click Finish.

4. Verify your domain.

   The Domains screen displays both unverified and verified domains you've mapped to your IdP (Identity Provider). To verify your domain, click the target domain's Verify button. Atlas shows whether the verification succeeded in a banner at the top of the screen.

5. Delete the provided record file.

   **Important:**

   To avoid a potential security vulnerability, delete the provided record file after verification completes.

## Associate Your Domain with Your Identity Provider

After successfully verifying your domain, associate the domain with your IdP (Identity Provider):

1. Go to the Identity Providers page.

   In Atlas, go to the Federation Management console for your organization.

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

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

   Click Open Federation Management App.

   The [Federation](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%23%2Forg%2F%3Corganization%3E%2Ffederation) page displays.

   In the sidebar, click Identity Providers.

2. For the IdP (Identity Provider) you want to associate with your domain, click  Edit next to Associated Domains.

3. Select the domain you want to associate with the IdP (Identity Provider).

4. Click Confirm.

### Test Your Domain Mapping

**Important:**

Before you begin testing, copy and save the [Bypass SAML Mode](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-bypass-saml) URL (Uniform Resource Locator) for your IdP (Identity Provider). Use this URL to bypass federated authentication in the event that you are locked out of your Atlas organization.

While testing, keep your session logged in to the Federation Management Console to further ensure against lockouts.

To learn more about Bypass SAML Mode, see [Bypass SAML Mode.](https://www.mongodb.com/docs/atlas/security/federation-advanced-options.md#std-label-bypass-saml)

To test the integration between your domain and your IdP (Identity Provider):

1. In a private browser window, navigate to the Atlas log in page.

2. Enter a username (usually an email address) with your verified domain.

   **Example:**

   If your verified domain is `mongodb.com`, enter `alice@mongodb.com`.

3. Click Next.

   If you mapped your domain correctly, you're redirected to your IdP (Identity Provider) to authenticate. If authenticating with your IdP (Identity Provider) succeeds, you're redirected back to Atlas.

   **Note:**

   You can bypass the Atlas log in page by navigating directly to your IdP (Identity Provider)'s Login URL. The Login URL takes you directly to your IdP (Identity Provider) to authenticate.

## Delete a Domain Mapping

### Open the Federation Management Console

1. In Atlas, go to the Federation Management console for your organization.

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

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

   Click Open Federation Management App.

   The [Federation](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%23%2Forg%2F%3Corganization%3E%2Ffederation) page displays.

### Delete the Domain

1. In Atlas, go to the Federation Management console for your organization.

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

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

   Click Open Federation Management App.

   The [Federation](https://cloud.mongodb.com/go?l=https%3A%2F%2Fcloud.mongodb.com%2Fv2%23%2Forg%2F%3Corganization%3E%2Ffederation) page displays.

2. Delete the domain.

   **Important:**

   You cannot delete a domain mapping if it is [associated with an IdP](https://www.mongodb.com/docs/atlas/security/manage-domain-mapping.md#std-label-associate-domain-with-idp). To disassociate a domain from an IdP:

   From the management console, click Identity Providers

   in the left navigation.

   For the IdP (Identity Provider) you want to disassociate from your domain, click

   &#x20;Edit next to Associated Domains.

   Deselect the domain desired domain.

   Click Confirm.

   To delete a domain from the Federation Management instance:

   Click Add a Domain.

   Open the Actions menu for the domain you want to delete.

   Click Delete.

   Click Confirm.
