Wednesday, August 16, 2017

AWS Lambda - Custom Authorization

Lambda Code

Refer

public AuthPolicy Authorization(TokenAuthorizerContext request)
{
    var token = request.AuthorizationToken;

    switch (token.ToLower())
    {
        case "allow":
            return generatePolicy("user", "Allow", request.MethodArn);
        case "deny":
            return generatePolicy("user", "Deny", request.MethodArn);
    }

    return null;
}


At Lambda to Custom Authorization


Add Custom Authorization to API Gateway Method


POSTMAN Test



No comments:

Post a Comment