A company is developing a serverless web application where users authenticate via a third-party SAML Identity Provider (IdP) integrated with an Amazon Cognito User Pool. Upon successful login, the frontend application receives Cognito JSON Web Tokens (JWTs). The frontend needs to call a backend REST API hosted on Amazon API Gateway, which triggers an AWS Lambda function. The Lambda function must retrieve the user's custom database tenant ID (mapped from the SAML assertion to a Cognito custom attribute) to perform tenant-isolated database queries. The solution must minimize code complexity and avoid custom token verification logic in the Lambda function.
Which combination of steps should the developer perform to meet these requirements? (Select TWO.)
- Configure a built-in Cognito User Pool Authorizer on the API Gateway REST API methods and pass the Cognito ID token in the Authorization header of the request.Answer
- Access the user's custom attribute in the backend Lambda function using the event.requestContext.authorizer.claims['custom:tenant_id'] context path.Answer
- CConfigure a custom Lambda Authorizer in API Gateway that validates the token signature and calls the Cognito IDP AdminGetUser API to fetch user attributes.
- DEstablish an Amazon Cognito Identity Pool to map the SAML federated users to IAM roles, and configure API Gateway to use IAM Authorization.
- EConfigure an IAM role with a trust policy that allows Amazon Cognito User Pools to assume the role, then pass this role ARN in the API request header.