|
5 | 5 | from localstack.http import Response
|
6 | 6 |
|
7 | 7 | from ..api import RestApiGatewayHandler, RestApiGatewayHandlerChain
|
8 |
| -from ..context import IdentityContext, InvocationRequest, RestApiInvocationContext |
| 8 | +from ..context import InvocationRequest, RestApiInvocationContext |
9 | 9 | from ..gateway_response import InvalidAPIKeyError
|
10 | 10 | from ..moto_helpers import get_api_key, get_usage_plan_keys, get_usage_plans
|
| 11 | +from ..variables import ContextVarsIdentity |
11 | 12 |
|
12 | 13 | LOG = logging.getLogger(__name__)
|
13 | 14 |
|
@@ -36,7 +37,7 @@ def __call__(
|
36 | 37 | return
|
37 | 38 |
|
38 | 39 | # If the Identity context was not created yet, instantiate it and attach it to the context variables
|
39 |
| - if not (identity := context.context_variables.get("identity", IdentityContext())): |
| 40 | + if not (identity := context.context_variables.get("identity", ContextVarsIdentity())): |
40 | 41 | context.context_variables["identity"] = identity
|
41 | 42 |
|
42 | 43 | # Look for the api key value in the request. If it is not found, raise an exception
|
@@ -95,7 +96,7 @@ def validate_api_key(
|
95 | 96 | return api_key if api_key["enabled"] else None
|
96 | 97 |
|
97 | 98 | def get_request_api_key(
|
98 |
| - self, rest_api: RestApi, request: InvocationRequest, identity: IdentityContext |
| 99 | + self, rest_api: RestApi, request: InvocationRequest, identity: ContextVarsIdentity |
99 | 100 | ) -> Optional[str]:
|
100 | 101 | """https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-api-key-source.html
|
101 | 102 | The source of the API key for metering requests according to a usage plan.
|
|
0 commit comments