@@ -267,6 +267,56 @@ def user_agent(self) -> str:
267267 return self ["requestContext" ]["http" ]["userAgent" ]
268268
269269
270+ class RequestContextV2AuthorizerIam (DictWrapper ):
271+ @property
272+ def access_key (self ) -> Optional [str ]:
273+ """The IAM user access key associated with the request."""
274+ return self .get ("accessKey" )
275+
276+ @property
277+ def account_id (self ) -> Optional [str ]:
278+ """The AWS account ID associated with the request."""
279+ return self .get ("accountId" )
280+
281+ @property
282+ def caller_id (self ) -> Optional [str ]:
283+ """The principal identifier of the caller making the request."""
284+ return self .get ("callerId" )
285+
286+ @property
287+ def cognito_amr (self ) -> Optional [List [str ]]:
288+ """This represents how the user was authenticated.
289+ AMR stands for Authentication Methods References as per the openid spec"""
290+ return self ["cognitoIdentity" ].get ("amr" )
291+
292+ @property
293+ def cognito_identity_id (self ) -> Optional [str ]:
294+ """The Amazon Cognito identity ID of the caller making the request.
295+ Available only if the request was signed with Amazon Cognito credentials."""
296+ return self ["cognitoIdentity" ].get ("identityId" )
297+
298+ @property
299+ def cognito_identity_pool_id (self ) -> Optional [str ]:
300+ """The Amazon Cognito identity pool ID of the caller making the request.
301+ Available only if the request was signed with Amazon Cognito credentials."""
302+ return self ["cognitoIdentity" ].get ("identityPoolId" )
303+
304+ @property
305+ def principal_org_id (self ) -> Optional [str ]:
306+ """The AWS organization ID."""
307+ return self .get ("principalOrgId" )
308+
309+ @property
310+ def user_arn (self ) -> Optional [str ]:
311+ """The Amazon Resource Name (ARN) of the effective user identified after authentication."""
312+ return self .get ("userArn" )
313+
314+ @property
315+ def user_id (self ) -> Optional [str ]:
316+ """The IAM user ID of the effective user identified after authentication."""
317+ return self .get ("userId" )
318+
319+
270320class RequestContextV2Authorizer (DictWrapper ):
271321 @property
272322 def jwt_claim (self ) -> Dict [str , Any ]:
@@ -276,6 +326,17 @@ def jwt_claim(self) -> Dict[str, Any]:
276326 def jwt_scopes (self ) -> List [str ]:
277327 return self ["jwt" ]["scopes" ]
278328
329+ @property
330+ def get_lambda (self ) -> Optional [Dict [str , Any ]]:
331+ """Lambda authorization context details"""
332+ return self .get ("lambda" )
333+
334+ @property
335+ def iam (self ) -> Optional [RequestContextV2AuthorizerIam ]:
336+ """IAM authorization details used for making the request."""
337+ iam = self .get ("iam" )
338+ return None if iam is None else RequestContextV2AuthorizerIam (iam )
339+
279340
280341class RequestContextV2 (DictWrapper ):
281342 @property
0 commit comments