File tree Expand file tree Collapse file tree 8 files changed +18
-18
lines changed Expand file tree Collapse file tree 8 files changed +18
-18
lines changed Original file line number Diff line number Diff line change 66from aws_lambda_typing .responses import APIGatewayProxyResponseV2
77from EventCoord .launchdarkly .flags import Flags
88from EventCoord .models .activitylogs import ActivityLog
9- from EventCoord .utils .response import build_response
9+ from EventCoord .utils .response import build_response , decode_claims
1010from aws_xray_sdk .core import patch_all , xray_recorder
1111
1212patch_all () # Automatically patches boto3, requests, etc.
@@ -38,7 +38,7 @@ def lambda_handler(
3838) -> APIGatewayProxyResponseV2 :
3939 logger .debug (f"Authorizer event: { event } " )
4040 logger .debug (f"Authorizer context: { context } " )
41- claims = event . get ( 'requestContext' , {}). get ( 'authorizer' , {} )
41+ claims = decode_claims ( event )
4242 if claims is None :
4343 claims = {}
4444 elif not isinstance (claims , dict ):
Original file line number Diff line number Diff line change 66from aws_lambda_typing .responses import APIGatewayProxyResponseV2
77from EventCoord .launchdarkly .flags import Flags
88from EventCoord .models .incidents import Incident
9- from EventCoord .utils .response import build_response
9+ from EventCoord .utils .response import build_response , decode_claims
1010from aws_xray_sdk .core import patch_all , xray_recorder
1111
1212patch_all () # Automatically patches boto3, requests, etc.
@@ -38,7 +38,7 @@ def lambda_handler(
3838) -> APIGatewayProxyResponseV2 :
3939 logger .debug (f"Incidents event: { event } " )
4040 logger .debug (f"Incidents context: { context } " )
41- claims = event . get ( 'requestContext' , {}). get ( 'authorizer' , {} )
41+ claims = decode_claims ( event )
4242 if claims is None :
4343 claims = {}
4444 elif not isinstance (claims , dict ):
Original file line number Diff line number Diff line change 66from aws_lambda_typing .responses import APIGatewayProxyResponseV2
77from EventCoord .launchdarkly .flags import Flags
88from EventCoord .models .locations import Location
9- from EventCoord .utils .response import build_response
9+ from EventCoord .utils .response import build_response , decode_claims
1010from aws_xray_sdk .core import patch_all , xray_recorder
1111
1212patch_all () # Automatically patches boto3, requests, etc.
@@ -38,7 +38,7 @@ def lambda_handler(
3838) -> APIGatewayProxyResponseV2 :
3939 logger .debug (f"Locations event: { event } " )
4040 logger .debug (f"Locations context: { context } " )
41- claims = event . get ( 'requestContext' , {}). get ( 'authorizer' , {} )
41+ claims = decode_claims ( event )
4242 if claims is None :
4343 claims = {}
4444 elif not isinstance (claims , dict ):
Original file line number Diff line number Diff line change 88from aws_lambda_typing .responses import APIGatewayProxyResponseV2
99from EventCoord .launchdarkly .flags import Flags
1010from EventCoord .models .organizations import Organization
11- from EventCoord .utils .response import build_response
11+ from EventCoord .utils .response import build_response , decode_claims
1212from aws_xray_sdk .core import patch_all , xray_recorder
1313
1414patch_all () # Automatically patches boto3, requests, etc.
@@ -40,7 +40,7 @@ def lambda_handler(
4040) -> APIGatewayProxyResponseV2 :
4141 logger .debug (f"Organizations event: { event } " )
4242 logger .debug (f"Organizations context: { context } " )
43- claims = event . get ( 'requestContext' , {}). get ( 'authorizer' , {} )
43+ claims = decode_claims ( event )
4444 if claims is None :
4545 claims = {}
4646 elif not isinstance (claims , dict ):
Original file line number Diff line number Diff line change 66from aws_lambda_typing .responses import APIGatewayProxyResponseV2
77from EventCoord .launchdarkly .flags import Flags
88from EventCoord .models .periods import Period
9- from EventCoord .utils .response import build_response
9+ from EventCoord .utils .response import build_response , decode_claims
1010from aws_xray_sdk .core import patch_all , xray_recorder
1111
1212patch_all () # Automatically patches boto3, requests, etc.
@@ -38,7 +38,7 @@ def lambda_handler(
3838) -> APIGatewayProxyResponseV2 :
3939 logger .debug (f"Periods event: { event } " )
4040 logger .debug (f"Periods context: { context } " )
41- claims = event . get ( 'requestContext' , {}). get ( 'authorizer' , {} )
41+ claims = decode_claims ( event )
4242 if claims is None :
4343 claims = {}
4444 elif not isinstance (claims , dict ):
Original file line number Diff line number Diff line change 66from aws_lambda_typing .responses import APIGatewayProxyResponseV2
77from EventCoord .launchdarkly .flags import Flags
88from EventCoord .models .radios import Radio
9- from EventCoord .utils .response import build_response
9+ from EventCoord .utils .response import build_response , decode_claims
1010from aws_xray_sdk .core import patch_all , xray_recorder
1111
1212patch_all () # Automatically patches boto3, requests, etc.
@@ -38,7 +38,7 @@ def lambda_handler(
3838) -> APIGatewayProxyResponseV2 :
3939 logger .debug (f"Radios event: { event } " )
4040 logger .debug (f"Radios context: { context } " )
41- claims = event . get ( 'requestContext' , {}). get ( 'authorizer' , {} )
41+ claims = decode_claims ( event )
4242 if claims is None :
4343 claims = {}
4444 elif not isinstance (claims , dict ):
Original file line number Diff line number Diff line change 1010from aws_lambda_typing .events import APIGatewayProxyEventV2
1111from aws_lambda_typing .context import Context as LambdaContext
1212from aws_lambda_typing .responses import APIGatewayProxyResponseV2
13- from EventCoord .utils .response import build_response
13+ from EventCoord .utils .response import build_response , decode_claims
1414from aws_xray_sdk .core import patch_all , xray_recorder
1515
1616patch_all () # Automatically patches boto3, requests, etc.
@@ -92,19 +92,19 @@ def lambda_handler(
9292) -> APIGatewayProxyResponseV2 :
9393 logger .debug (f"Reports event: { event } " )
9494 logger .debug (f"Reports context: { context } " )
95- claims = event . get ( 'requestContext' , {}). get ( 'authorizer' , {} )
95+ claims = decode_claims ( event )
9696 if claims is None :
9797 claims = {}
9898 elif not isinstance (claims , dict ):
9999 try :
100100 claims = dict (claims )
101101 except Exception :
102102 claims = {}
103- org_id = claims .get ('hd ' )
103+ org_id = claims .get ('org_id ' )
104104 if not org_id :
105105 return build_response (
106106 403 ,
107- {'error' : 'Missing organization (hd claim) in token' },
107+ {'error' : 'Missing organization (org_id claim) in token' },
108108 headers = cors_headers
109109 )
110110
Original file line number Diff line number Diff line change 66from aws_lambda_typing .responses import APIGatewayProxyResponseV2
77from EventCoord .launchdarkly .flags import Flags
88from EventCoord .models .units import Unit
9- from EventCoord .utils .response import build_response
9+ from EventCoord .utils .response import build_response , decode_claims
1010from aws_xray_sdk .core import patch_all , xray_recorder
1111
1212patch_all () # Automatically patches boto3, requests, etc.
@@ -38,7 +38,7 @@ def lambda_handler(
3838) -> APIGatewayProxyResponseV2 :
3939 logger .debug (f"Units event: { event } " )
4040 logger .debug (f"Units context: { context } " )
41- claims = event . get ( 'requestContext' , {}). get ( 'authorizer' , {} )
41+ claims = decode_claims ( event )
4242 if claims is None :
4343 claims = {}
4444 elif not isinstance (claims , dict ):
You can’t perform that action at this time.
0 commit comments