Follow the step-by-step instructions below to build an authenication workflow. Click on each step number to expand the section.
Step 1. Create an Amazon Cognito user pool
Amazon Cognito provides authentication, authorization, and user management for your apps. A user pool is a user directory in Amazon Cognito. With a user pool, your users can sign in to your apps through Amazon Cognito.
On the Amazon Cognito welcome page, choose Manage User Pools.
In the upper-right corner of the Your User Pools page, choose Create a user pool.
For Pool name, type examplecorp_dashboard.
Choose Review defaults.
On the review page, choose Create pool.
Make a note of the Pool Id value at the top of the details page. You will need this value in the following modules:
In this module (Module 2), Step 4. Add a user and application in AWS SSO, when you specify a value for Application SAML audience.
In Module 5, Step 2. Update the config.js file, when you specify a value for userPoolId.
Step 2. Create an app client to use the Example Corp. EUC dashboard website for signing in your users
After you create a user pool, create an app client.
In the navigation pane, under General settings, choose App clients.
Choose Add an app client.
For App client name, type examplecorp_dashboard_app.
Keep the default value for Refresh token expiration (days).
Clear the Generate client secret check box. Client secrets aren't currently supported for use with browser-based applications.
Keep the rest of the default settings, and then choose Create app client.
Make a note of the App client id value. You will need this value in Module 5, Step 2. Update the config.js file, when you specify a value for userPoolClientId.
In the navigation pane, under General settings, choose Policies.
Under What password strength do you want to require?, keep the default settings or make changes as required for your environment.
Under Do you want to allow users to sign themselves up?, choose Only allow administrators to create users.
Choose Save Changes.
In the navigation pane, under App integration, choose Domain name.
Enter a unique domain prefix for your user pool (such as examplecorp), and then choose Check availability.
At the top of the page, a message notifies you whether the domain is available. After the domain is verified as available, choose Save changes.
At the top of the page, make a note of the complete domain name. You will need this value in the following modules:
This module (module 2), Step 4. Add a user and application in AWS SSO, when you specify a value for Application ACS URL.
In Module 5, Step 2. Update the config.js file, when you specify a value for authURL.
Step 3. Enable AWS SSO and create an AWS organization
AWS SSO lets you centrally manage SSO access to all of your AWS accounts and cloud applications. AWS SSO also helps you manage access and permissions to commonly used third-party software as a service (SaaS) applications, AWS SSO-integrated applications, and custom applications that support Security Assertion Markup Language (SAML) 2.0.
When you open the AWS SSO console for the first time, you’re prompted to enable AWS SSO before you can start managing it.
On the AWS Single Sign-on (SSO) page, do one of the following: • If this is the first time you’re using AWS SSO, choose Enable AWS SSO. • If you’ve used AWS SSO before, you can skip this step.
If this is the first time you’re using AWS SSO and you’re not using AWS Organizations, you’re prompted to choose whether to have an AWS organization created for you.
Choose Create AWS organization. With AWS SSO, you manage SSO access and user permissions across all your AWS accounts in AWS Organizations.
After SSO is enabled and an AWS organization is created, the Welcome to AWS Single-Sign-On page opens.
Step 4. Add a user and application in AWS SSO
To enable users to sign in through a SAML identity provider (IdP), you must first update your SAML identity provider and configure your Amazon Cognito user pool. This requires adding Amazon Cognito as a service provider (SP) to your SAML IdP. In the navigation pane of the AWS SSO console, choose Users, and then choose Add user.
Under User details, do the following: • For Username, enter the name that you want to use for sign-in to the user portal. This value can’t be changed later. • For Password, specify whether to send an email to the user with password setup instructions (the default option), or to generate a one-time password that you can share with the user. • For Email address, enter and then confirm the email address that you want to use. • For First name and Last name, enter the names that you want to use. These values are required for automatic provisioning to work. • For Display name, keep the default name, which is based on the values that you specified for First name and Last name, or enter a different name.
Leave the remaining optional fields empty, and then choose Next: Groups.
Creating a group is optional. Create a group if you want one for your environment, or skip this step.
Choose Add user.
At the top of the page, a message notifies you that the user was added successfully. The user receives an email with the subject Invitation to join AWS Single Sign-On. For this tutorial, if you specified yourself as the user, do the following to activate your account: • In the email, choose the Accept invitation link. • The AWS SSO user portal page opens with your user name already populated. • Enter a password and confirm it. Make a note of this password. You will need it later in the workshop. • Choose Update user. • The Single Sign-On page opens, and a message notifies you that your account is successfully activated.
Return to the AWS SSO console. In the navigation pane, choose Applications, and then choose Add a new application.
Under AWS SSO Application Catalog, choose Add a custom SAML 2.0 application.
On the Configure Custom SAML application page, for Display name, enter the following: examplecorp_dashboard
Under AWS SSO metadata, for AWS SSO SAML metadata file, make a note of the URL. You will need the URL in Step 5. Create a Provider in Amazon Cognito, when you specify the metadata document endpoint URL.
Skip the Application properties section.
Under Application metadata, select the link If you don’t have a metadata file, you can manually type your metadata values.
For Application ACS URL, enter the Amazon Cognito domain name from Step 2. Create an app client to use the Example Corp. website for signing in your users. Append the domain name with the following path:
For Application SAML audience, enter the Amazon Cognito user pool service provider URN. To do so, enter the Amazon Cognito user pool ID that was generated in Step 1. Create an Amazon Cognito user pool. Prepend the user pool ID with the following:
The format is as follows:
Choose Save changes.
The examplecorp_dashboard app details page opens.
Choose the Attribute mappings tab.
For Maps to this string value or user attribute in AWS SSO, enter the following value:
For Format, choose unspecified.
Select Add new attribute mapping and do the following:
• For User attribute in the application, enter the following value:
On the Your User Pools page, choose examplecorp_dashboard.
In the navigation pane, under Federation, choose Identity providers.
Choose SAML and do the following: • Under Metadata document, in the box for Provide metadata document endpoint URL, enter the AWS SSO SAML metadata file URL from Step 4. Add a user and application in AWS SSO. This URL points to the metadata document. • For Provider name, enter dashboard. Make a note of this name. You will need this name in Module 5, Step 2. Update the config.js file. • For Identifiers, enter the fully qualified domain name (FQDN) of the SAML users. This is the part of the user account after the @, but not including the @ symbol. • Choose Create provider.
After you create the IdP, under Active SAML Providers, dashboard appears as a provider.
In the navigation pane, under Federation, choose Attribute mapping.
On the SAML tab, choose Add SAML attribute.
For SAML attribute, enter the following value: http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress
For User pool attribute, choose Email.
Choose Save changes.
In the navigation pane, under App Integration, choose App client settings.
Under Enabled Identity Providers, select the dashboard check box.
For Callback URL(s), enter the CloudFront web distribution domain name URL from Module 1, Step 3. Create an Amazon CloudFront web distribution. Enter the URL with and without index.html following the domain name in a comma separated list. The format is as follows: