Amazon Cognito can be used as an IdP (Identity Provider) to secure the Amazon CloudFront Distribution created by this repository.
In order to get started, login to the AWS Console with an identity that has the ability to manage Amazon Cognito User Pools and App integrations.
- Search for
Cognito
in the search bar and click on theCognito
service. - Click on
Manage User Pools
next: - Select an existing User Pool or Create a user pool by clicking on the
Create a user pool
button in the top-left corner of the page. - After selecting an existing Cognito User Pool or creating a new User Pool, navigate to
App integration > App client settings
on the left of the page: - On the
App client settings
page select the following: 5a.Enabled Identity Providers
= check theCognito User Pool
5b.Sign in and sign out URLs
= forCallback URL(s)
provide the Amazon CloudFront distribution HTTPS endpoint with_callback
appended to the end. Provide the appropriateSign out URL(s)
value that is suitable.
5c.OAuth 2.0
= At the minimum forAllowed OAuth Flows
checkAuthorization code grant
. ForAllowed OAuth Scopes
checkemail
andopenid
at the minimum. - After providing the necessary arguments click on
Save changes
. - On the next page, provide an appropriate
Amaon Cognito domain
endpoint: - Navigate back to the
General settings
and click onApp Clients
. - Create a new App client and provide it a name that is suitable for your Amazon CloudFront use-case. Select the appropriate
Auth Flows Configuration
and then click save. - Expand the newly-create App Client and copy the
App client id
and theApp client secret
into a secure location that can be later referenced. - Update the AWS Secrets Manager JSON configuration with these values and Base64 Encode the document.
- Congratulations! You are ready to go!