@@ -129,7 +129,9 @@ def __init__( # type: ignore[no-untyped-def] # noqa: PLR0913
129
129
self .api_logical_id = api_logical_id
130
130
self .name = name
131
131
self .authorization_scopes = authorization_scopes
132
- self .jwt_configuration : Optional [JwtConfiguration ] = self ._get_jwt_configuration (jwt_configuration )
132
+ self .jwt_configuration : Optional [JwtConfiguration ] = self ._get_jwt_configuration (
133
+ jwt_configuration , api_logical_id
134
+ )
133
135
self .id_source = id_source
134
136
self .function_arn = function_arn
135
137
self .function_invoke_role = function_invoke_role
@@ -344,7 +346,9 @@ def _get_identity_source(self, auth_identity: Dict[str, Any]) -> List[str]:
344
346
return identity_source
345
347
346
348
@staticmethod
347
- def _get_jwt_configuration (props : Optional [Dict [str , Union [str , List [str ]]]]) -> Optional [JwtConfiguration ]:
349
+ def _get_jwt_configuration (
350
+ props : Optional [Dict [str , Union [str , List [str ]]]], api_logical_id : str
351
+ ) -> Optional [JwtConfiguration ]:
348
352
"""Make sure that JWT configuration dict keys are lower case.
349
353
350
354
ApiGatewayV2Authorizer doesn't create `AWS::ApiGatewayV2::Authorizer` but generates
@@ -359,13 +363,14 @@ def _get_jwt_configuration(props: Optional[Dict[str, Union[str, List[str]]]]) ->
359
363
360
364
Parameters
361
365
----------
362
- props
363
- jwt configuration dict with the keys either lower case or capitalized
366
+ props: jwt configuration dict with the keys either lower case or capitalized
367
+ api_logical_id: logical id of the Serverless Api resource with the jwt configuration
364
368
365
369
Returns
366
370
-------
367
371
jwt configuration dict with low case keys
368
372
"""
369
373
if not props :
370
374
return None
375
+ sam_expect (props , api_logical_id , "JwtConfiguration" ).to_be_a_map ()
371
376
return {k .lower (): v for k , v in props .items ()}
0 commit comments