We are in the same situation, and by no means do I propose a good and clean solution, but I have a workaround.
If you look at the request payload, json will be formatted as follows:
{ [...] "requestContext": { [...] "authorizer": { "claims": { "claim1": "value1", "claim2": "value2", "claim3": "value3", } }, [...]
In APIGatewayProxyFunction.FunctionHandlerAsync they deserialize the requestStream into APIGatewayProxyRequest . If you go into this class, you will find that the json authorizer part is deserialized to:
public class APIGatewayCustomAuthorizerContext { public string PrincipalId { get; set; } public string StringKey { get; set; } public int? NumKey { get; set; } public bool? BoolKey { get; set; } }
I. All claims are lost upon deserialization. I posted this problem here: https://github.com/aws/aws-lambda-dotnet/issues/98
Now for the workaround, I just added something that โworksโ together here (Code here ):
Please note that it is very unverified. :-)
Using:
public class LambdaEntryPoint : APIGatewayAuthorizerProxyFunction { protected override void Init(IWebHostBuilder builder) { builder .UseContentRoot(Directory.GetCurrentDirectory()) .UseStartup<Startup>() .UseApiGateway(); } }
source share