Skip to content

Instantly share code, notes, and snippets.

@yuyasugano
Created February 15, 2022 07:31
Show Gist options
  • Save yuyasugano/85cb7aa9ee2c61f7176895246a16b630 to your computer and use it in GitHub Desktop.
Save yuyasugano/85cb7aa9ee2c61f7176895246a16b630 to your computer and use it in GitHub Desktop.
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