Authorization Lambda caching based on api-key and path

0

I have an Authorization Lambda for my API Gateway.

This Lambda will take an api-key in the header, and the event.path, that is, the requested path, and based on this combination will either allow the request to proceed or return a 403 Forbidden.

I want to enable Authorization Caching, however, it's not clear to me how the keys in the cache are formed. I want the cache key to consider both the api-key and the requested path, how can I do this?

Sergio
gefragt vor 2 Jahren1575 Aufrufe
1 Antwort
2

Assuming that this is a REST API and a REQUEST type Lambda, the default cache key used for Lambda authorizers is the resource path.

On REQUEST type Lambda authorizers, you have the ability to define “identity sources” which are used to create the cache key.

When multiple identity sources are defined they are used in combination to create the cache key.

You can define the identity sources in the Lambda Event Payload (you can find this in the Edit Authorizer settings) in order to create a cache key based on the resource path as well as the value of the x-api-key header.

AWS
SUPPORT-TECHNIKER
Tim_P
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen