Soru

Zorluk: OrtaAPI Gateway Security and Authorization

A logistics company is developing a cargo tracking application. The mobile client authenticates users via an Amazon Cognito User Pool. The client application needs to invoke a REST API hosted on Amazon API Gateway to fetch real-time tracking data. The developer wants to restrict access to this API endpoint to ensure that only users authenticated by the user pool can access it. Which approach should the developer use to meet these requirements with the lowest latency and minimal operational overhead?

  1. Configure an Amazon Cognito User Pool authorizer on the API Gateway method, and specify the client's identity or access token in the authorization header.Cevap
  2. B
    Configure an Amazon Cognito Identity Pool authorizer on the API Gateway method, and specify the identity pool ID in the HTTP headers of the request.
  3. C
    Create a custom AWS Lambda authorizer that validates the token signature using the Cognito User Pool public keys and generates an IAM policy for the request.
  4. D
    Configure a Lambda proxy integration on the API Gateway method to pass the raw request to the backend function, then validate the token within the function's application code.

Cevap

Configure an Amazon Cognito User Pool authorizer on the API Gateway method, and specify the client's identity or access token in the authorization header.
Integrating Amazon API Gateway with an Amazon Cognito User Pool using a built-in Cognito User Pool authorizer allows API Gateway to natively validate the JSON Web Tokens (JWTs) sent by the client. This approach does not require writing or maintaining custom code, runs with minimal latency, and incurs no additional cost or execution time associated with Lambda custom authorizers.

Adım Adım Çözüm

1
Identify the authentication provider and the required integration.
The authentication provider is an Amazon Cognito User Pool which issues JSON Web Tokens (JWTs).
Understanding the source of the user identity is key to selecting the correct authorizer type.
2
Evaluate the native API Gateway features for JWT validation.
API Gateway offers a built-in Cognito User Pool authorizer that validates JWTs automatically.
Using native features minimizes operational overhead (no code to write) and provides lower latency than custom code execution.
3
Compare alternatives against the latency and overhead constraints.
Custom Lambda authorizers add latency/cost, Cognito Identity Pools are for resource authorization rather than API authentication, and backend validation runs billing charges for rejected requests.
Verifying constraints ensures the selected native authorizer is the optimal path.

Anahtar Kavram

Amazon API Gateway Cognito User Pool Authorizer
Tahmini Süre:1m 30s
Bu soruyu puanla