A developer is deploying a web application where the frontend authenticates users via a third-party Identity Provider (IdP) using OpenID Connect (OIDC). The frontend needs to make requests to a backend service exposed through an Amazon API Gateway HTTP API. The API must validate the incoming JSON Web Token (JWT) at the gateway layer before routing the request to backend AWS Lambda functions. The developer wants to implement this validation with the least amount of custom code and lowest latency. Which of the following configuration steps should the developer perform?
- Configure a built-in JWT authorizer on the HTTP API, providing the Issuer URL from the third-party IdP and the target Audience, and associate it with the API routes.Cevap
- BCreate an Amazon Cognito Identity Pool to exchange the third-party JWT for temporary AWS IAM credentials, and configure IAM authorization on the HTTP API routes.
- CCreate an Amazon API Gateway Lambda authorizer that parses the JWT, calls the third-party IdP's validation endpoint, and generates an IAM policy to allow the request.
- DConfigure a Lambda proxy integration that passes the raw authorization header to the backend Lambda function, and validate the JWT within the application code of each backend function.
Cevap
Configure a built-in JWT authorizer on the HTTP API, providing the Issuer URL from the third-party IdP and the target Audience, and associate it with the API routes.
The correct answer is to configure a built-in JWT authorizer on the HTTP API. Amazon API Gateway HTTP APIs provide native support for JWT validation against OIDC-compliant Identity Providers. This built-in mechanism validates token signatures, expiration dates, and scopes without executing custom Lambda code, offering the lowest latency and overhead.
Adım Adım Çözüm
Anahtar Kavram
API Gateway HTTP APIs support built-in JWT authorizers that natively validate tokens from OpenID Connect (OIDC) compatible identity providers, eliminating the need for custom authorizer Lambda functions or IAM credential exchange.