An internal employee portal has a frontend application that retrieves account data by calling a REST API hosted on Amazon API Gateway. The employees are authenticated using an Amazon Cognito User Pool. The developer wants to secure the API Gateway endpoints so that only authenticated users can access the resources. The developer needs to validate the JSON Web Tokens (JWT) at the API Gateway level with the least operational overhead.
Which configuration should the developer implement to meet these requirements?
- AConfigure a Lambda Proxy integration in API Gateway and validate the JWT token using custom integration mapping templates.
- BImplement a custom AWS Lambda authorizer that retrieves the public JSON Web Key Set from Cognito to validate the JWT signature.
- Create a Cognito User Pools authorizer in API Gateway and configure the API method to use this authorizer.Cevap
- DConfigure an API Gateway authorizer that integrates with an Amazon Cognito Identity Pool to validate the employee JWT tokens.
Cevap
Create a Cognito User Pools authorizer in API Gateway and configure the API method to use this authorizer.
The correct option is to create a Cognito User Pools authorizer in API Gateway and configure the API method to use it. This utilizes API Gateway's native capability to validate JWT tokens generated by Amazon Cognito User Pools without writing any custom code, satisfying the requirement for the least operational overhead.
Adım Adım Çözüm
Anahtar Kavram
API Gateway Cognito User Pools Authorizer