Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
authorizer.py
def lambda_handler(event, context):
token = event['authorizationToken']
effect = 'Deny'
if token == 'cs':
effect = 'Allow'
return {
'principalId': '*',
'policyDocument': {
'Version': '2012-10-17',
'Statement': [
{
'Action': 'execute-api:Invoke',
'Effect': effect,
'Resource': event['methodArn']
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment