How do I set up AD FS as a SAML identity provider with an Amazon Cognito user pool?

4 minute read

I want to use Active Directory Federation Services (AD FS) as Security Assertion Markup Language 2.0 (SAML 2.0) identity provider (IdP) with an Amazon Cognito user pool. How do I set all that up?

Short description

Amazon Cognito user pools allow sign-in through a third party (federation), including through a SAML IdP such as AD FS. For more information, see Adding user pool sign-in through a third party and Adding SAML identity providers to a user pool.

You can set up an AD FS server and domain controller on an Amazon Elastic Compute Cloud (Amazon EC2) Windows instance, and then integrate your setup with your user pool using Amazon Cognito's hosted web UI.

Important: For this resolution, you need a domain name that you own. If you don't own a domain, you can register a new domain with Amazon Route 53 or another Domain Name System (DNS) service.


Create an Amazon Cognito user pool with an app client

For more information, see Tutorial: creating a user pool and setting up the hosted UI with the Amazon Cognito console.

Note: When creating a user pool, the standard attribute email is selected by default. For more information about user pool attributes, see Configuring user pool attributes.

Set up an EC2 Windows instance

Configure and launch an EC2 Windows instance, and then set up an AD FS server and domain controller on it. For more information, see How do I set up AD FS on an Amazon EC2 Windows instance to work with federation for an Amazon Cognito user pool?

Configure your AD FS server as SAML IdP in Amazon Cognito

For more information, see Creating and managing a SAML identity provider for a user pool (AWS Management Console) and follow the instructions under To configure a SAML 2.0 identity provider in your user pool.

When creating the SAML IdP, for Metadata document, either paste the metadata document endpoint URL or upload the .xml metadata file.

Map email address from IdP attribute to user pool attribute

For more information, see Specifying identity provider attribute mappings for your user pool and follow the instructions under To specify a SAML provider attribute mapping.

When adding a SAML attribute, for SAML Attribute, enter For User pool attribute, choose Email from the list.

Change app client settings in Amazon Cognito

  1. In the Amazon Cognito console management page for your user pool, under App integration, choose App client settings. Then, do the following:
    Under Enabled identity providers, select the check box for the SAML IdP you configured. For example, ADFS.
    For Callback URL(s), enter a URL where you want your users to be redirected after logging in.
    For Sign out URL(s), enter a URL where you want your users to be redirected after logging out.
    Under Allowed OAuth Flows, select the Authorization code grant and Implicit Grant check boxes.
    Under Allowed OAuth Scopes, select all check boxes.
  2. Choose Save changes. For more information, see App client settings terminology.

Test your setup using the Amazon Cognito hosted web UI

  1. Enter this URL in your web browser: Note: For the URL, use values from your user pool and app client. Find the domain (including domain name prefix and AWS Region) for your user pool in the Amazon Cognito console on the App integration page. Find the app client ID in App client settings. Replace with the callback URL for your SAML IdP.
  2. Choose the name of the SAML IdP that you configured. You're redirected to the AD FS authentication page.
  3. Under Sign in with your organizational account, enter the user name and password for your Active Directory user.
  4. Choose Sign in. If sign-in is successful, then Amazon Cognito returns user pool tokens and a successful SAML response. For more information on viewing the SAML response, see How to view a SAML response in your browser for troubleshooting. Note: When decoded, the SAML response should include the required attribute NameID.

Related information

Building ADFS federation for your web app using Amazon Cognito user pools

Integrating third-party SAML identity providers with Amazon Cognito user pools

SAML user pool IdP authentication flow

How do I set up a third-party SAML identity provider with an Amazon Cognito user pool?

AWS OFFICIALUpdated 3 years ago