A logistics company is designing a REST API in Amazon API Gateway to allow partner clients to retrieve shipment data. Partners authenticate against an external OAuth 2.0 Identity Provider (IdP) and receive a JWT access token containing custom scopes like `shipments:read`. The developer wants to authenticate the tokens and enforce access control using these custom scopes at the API Gateway level with minimal custom code. Which two configuration steps should the developer perform to meet these requirements? (Select TWO.)
- Create and configure an Amazon Cognito User Pool with the external IdP as a federated provider, then create a Cognito User Pool authorizer in API Gateway.Cevap
- Associate the Cognito authorizer with the API method, and specify the required custom scopes in the OAuth Scopes field of the Method Request configuration.Cevap
- CCreate an Amazon Cognito Identity Pool to authenticate the partners, exchange the JWT for temporary AWS credentials, and configure an IAM authorizer on the API methods.
- DCreate a custom Lambda authorizer that calls the Cognito Identity Pool API to validate the custom scopes and return an IAM policy.
- EConfigure the API Gateway integration type as a Lambda proxy integration to automatically forward the JWT payload, allowing the backend Lambda function to perform signature verification.
Cevap
To secure the REST API with minimal custom code, the developer should create and configure an Amazon Cognito User Pool federated with the external IdP, set up a Cognito User Pool authorizer, and then specify the required custom scopes in the Method Request configuration.
The correct options involve configuring an Amazon Cognito User Pool federated with the external Identity Provider and creating a Cognito User Pool authorizer. This allows API Gateway to handle JWT signature validation natively. By configuring the method request with the required OAuth scopes, API Gateway natively verifies that the token contains the matching scope claims, preventing unauthorized traffic from reaching the backend with zero custom code.
Adım Adım Çözüm
Anahtar Kavram
API Gateway integration with Amazon Cognito User Pools for federated authentication and native OAuth scope validation.
Tahmini Süre:1m 30s