I have an AWS API Gateway (v2/HTTP) set-up with a custom authoriser lambda.
The route key for the gateway looks something like:
ANY /{project_id}/{uri+}
My authorizer lambda checks if the given user is entitled for permission for the provided project_id. Unfortunately this means I can't cache the result, as a user authorized for one project ID would then have that grant cached for other project IDs.
I saw that AWS provides an 'Identity Source' parameter for the gateway which it will use as a caching key:
You can enable caching for a Lambda authorizer by specifying an authorizerResultTtlInSeconds. When caching is enabled for an authorizer, API Gateway uses the authorizer's identity sources as the cache key. If a client specifies the same parameters in identity sources within the configured TTL, API Gateway uses the cached authorizer result, rather than invoking your Lambda function.
I would therefore like to use my 'project_id' path parameter, but it's not obvious to me if this is possible with the supported identity sources:
Is it possible to refer to the project_id path parameter using these expressions?
