-
-
Save bugcy013/8db0d77a240d916d82481429ac275a35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DemoHandler | |
--- | |
def lambda_handler(event, context): | |
print(event) | |
return "hello, world!!" | |
DemoAuthorizer | |
--- | |
def lambda_handler(event, context): | |
#1 - Log the event | |
print('*********** The event is: ***************') | |
print(event) | |
#2 - See if the person's token is valid | |
if event['authorizationToken'] == 'abc123': | |
auth = 'Allow' | |
else: | |
auth = 'Deny' | |
#3 - Construct and return the response | |
authResponse = { "principalId": "abc123", "policyDocument": { "Version": "2012-10-17", "Statement": [{"Action": "execute-api:Invoke", "Resource": ["arn:aws:execute-api:us-east-1:YOURACCOUNTNUMBER:2ogoj2ul12/test/GET/customers"], "Effect": auth}] }} | |
return authResponse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment