A developer is building a serverless e-learning application where students log in using an Amazon Cognito User Pool. The application's frontend client needs to access course content through an Amazon API Gateway REST API. The developer needs to secure the API so that only authenticated students can access the resource, verifying their identity directly via their login session tokens. Which solution should the developer implement to meet these requirements with the least operational overhead?
- ACreate a Lambda authorizer in API Gateway that decodes the incoming token, makes an API call to Cognito User Pools to validate it, and returns an IAM policy.
- Create an Amazon Cognito User Pool authorizer in API Gateway, configure it with the student User Pool, and set the API method authorization to use this authorizer.Cevap
- CCreate an Amazon Cognito Identity Pool authorizer in API Gateway, configure it with the student identity provider, and set the API method authorization to use this authorizer.
- DCreate a Lambda Proxy integration in API Gateway, configure a method execution mapping to validate Cognito tokens, and pass the claims in the request template.
Cevap
Create an Amazon Cognito User Pool authorizer in API Gateway, configure it with the student User Pool, and set the API method authorization to use this authorizer.
API Gateway natively supports Amazon Cognito User Pools authorizers, allowing developers to secure REST APIs by validating user identity tokens directly against the configured User Pool. This requires zero custom code, minimizing development and operational overhead.
Adım Adım Çözüm
Anahtar Kavram
API Gateway native Cognito User Pool authorizer integration