Question

Difficulty: EasyApplication Authentication and Authorization with Amazon Cognito

A shipping company is developing a web application that allows customers to track their cargo packages. The application must prompt users to register and log in to view their tracking history. After logging in, the client application must make authorized requests to a backend API hosted on Amazon API Gateway. The developer wants to use a standard, built-in solution to authenticate users and validate their login tokens without writing custom authentication code. Which of the following configurations should the developer implement to meet these requirements? (Select TWO.)

  1. Configure an Amazon Cognito User Pool to handle user registration, authentication, and token generation.Answer
  2. Create a built-in Cognito User Pool Authorizer in Amazon API Gateway to validate the incoming tokens.Answer
  3. C
    Configure an Amazon Cognito Identity Pool to authenticate the users and issue JSON Web Tokens (JWTs) to the client application.
  4. D
    Deploy a custom Amazon API Gateway Lambda Authorizer to decode and validate the tokens generated by Cognito.
  5. E
    Modify the IAM trust policy of the backend API Gateway to trust the Cognito User Pool identity provider client.

Answer

The developer should configure an Amazon Cognito User Pool to handle user registration and authentication, and create a built-in Cognito User Pool Authorizer in Amazon API Gateway to validate the incoming tokens.
To fulfill the requirements, an Amazon Cognito User Pool must be used because it provides the user directory, sign-up, sign-in, and issues the JSON Web Tokens (JWTs) needed for authentication. Then, the API Gateway Cognito User Pool Authorizer should be used because it is the built-in, no-code mechanism to validate these tokens at the API gateway layer.

Step-by-Step Solution

1
Set up a user directory.
Create an Amazon Cognito User Pool to manage user registration, authentication flows, and token issuance.
User Pools act as the identity provider that authenticates users and generates JSON Web Tokens (JWTs).
2
Secure the API Gateway endpoint.
Configure a built-in Cognito User Pool Authorizer on the API Gateway resource/method.
This native authorizer validates the JWTs generated by the User Pool directly within the API Gateway layer without requiring custom Lambda functions.

Key Concept

Amazon Cognito User Pools vs. Identity Pools, and native API Gateway integration
Estimated Time:1m 0s
Rate this question