A developer is designing a secure integration between an external third-party server-to-server daemon application and a private API hosted on Amazon API Gateway. The external application must programmatically access API endpoints to retrieve financial reports without user intervention. The solution must support custom OAuth 2.0 scopes, such as `reports:read`, to authorize access. Which architecture should the developer implement to meet these requirements with the least operational complexity?
- AConfigure an Amazon Cognito Identity Pool with a resource server defining the `reports:read` scope. Create an app client, enable the Client Credentials grant, and assign the custom scope. On API Gateway, configure an IAM Authorizer and assign an IAM role to the identity pool that allows API access.
- Configure an Amazon Cognito User Pool with a resource server defining the `reports:read` scope. Create an app client, enable the Client Credentials grant, and assign the custom scope. On API Gateway, configure a Cognito Authorizer and specify the `reports:read` scope in the API method's authorization settings.Cevap
- CConfigure an Amazon Cognito User Pool with a resource server defining the `reports:read` scope. Create an app client, enable the Authorization Code flow with PKCE, and assign the scope. On API Gateway, deploy a custom Lambda Authorizer to validate the JWT signature, extract the scope, and permit or deny access.
- DConfigure an Amazon Cognito User Pool. Create an IAM role for the third-party application, and configure its IAM trust policy to trust the `cognito-idp.amazonaws.com` service principal. On API Gateway, use AWS_IAM authorization, and configure the Cognito User Pool to directly assume the IAM role and sign requests using AWS Signature Version 4.
Cevap
Configure an Amazon Cognito User Pool with a resource server defining the reports:read scope, enable the Client Credentials grant on the app client, and use API Gateway's built-in Cognito Authorizer.
The correct solution uses Amazon Cognito User Pools, which natively support the OAuth 2.0 Client Credentials grant flow for server-to-server (daemon) authentication. By configuring a Resource Server in the User Pool, the developer can define custom scopes like `reports:read`. The built-in API Gateway Cognito Authorizer can validate the incoming Access Token (JWT) and enforce authorization based on the configured custom scopes directly on the API method, requiring no custom Lambda authorizer code or IAM role assumption.
Adım Adım Çözüm
Anahtar Kavram
Machine-to-machine authentication using Amazon Cognito User Pools and Client Credentials flow with API Gateway Integration
Tahmini Süre:2m 0s