DVA-C02 - Security - Section 2.4

Secure applications and APIs using bearer tokens such as JSON Web Tokens and OAuth, validated through API Gateway authorisers.

Secure APIs by validating JSON Web Tokens and OAuth 2.0 bearer tokens using Amazon API Gateway authorisers - either a Cognito user pool authoriser or a Lambda authoriser for custom token logic. Recognise the structure of Amazon Cognito tokens and how the authoriser caches policy decisions to reduce latency.

JSON Web TokenOAuth 2.0Amazon Cognito tokensAPI Gateway authorisers

Practice question for this objective

Free sampleSecuritymedium

A REST API on Amazon API Gateway must accept requests bearing JSON Web Tokens issued by an Amazon Cognito user pool. The team wants API Gateway to verify each token's signature and expiry and to authorise access by checking OAuth scopes in the token, with no custom code to write or maintain. Which authoriser should the team configure on the API methods?

  • AAn AWS Identity and Access Management authorisation type that signs each request with SigV4 so the caller proves its identity using IAM credentials.
  • BA Cognito user pool authoriser that validates the token against the configured user pool and authorises the method using the token's OAuth scopes. Correct
  • CA request-based Lambda authoriser that reads custom headers and returns an IAM policy, with the function calling the Cognito API to introspect the token on each request.
  • DA token-based Lambda authoriser whose function decodes the JSON Web Token and verifies the signature using a downloaded public key before returning a policy.
Use a Cognito user pool authoriser to validate user pool JSON Web Tokens and authorise by OAuth scope without writing custom code. An API Gateway Cognito user pool authoriser is purpose-built to verify the signature and expiry of identity or access tokens issued by a linked user pool and to authorise methods by comparing the token's OAuth scopes against the scopes configured on each method, so no Lambda code is needed.

Why A is wrong: IAM authorisation validates SigV4 signatures from IAM principals, not bearer JSON Web Tokens from a user pool, so it cannot check token signature, expiry, or OAuth scopes.

Why B is correct: A Cognito user pool authoriser natively verifies the JSON Web Token signature and expiry against the user pool and authorises by matching method scopes, requiring no custom code.

Why C is wrong: A Lambda authoriser could be coded to do this, but it forces the team to write and maintain validation code, which the requirement explicitly rules out.

Why D is wrong: A token Lambda authoriser can validate JSON Web Tokens but still requires the team to author and maintain the verification logic, which conflicts with the no-code requirement.

See more DVA-C02 practice questions, answers explained.

More in this domain

Back to all Security objectives, or the DVA-C02 cert hub.

Examworthy is not affiliated with or endorsed by Amazon Web Services. Original, blueprint-aligned practice material only.