我已使用python在AWS API Gateway
中实现了自定义授权模块。基本上它可能会返回这样的东西:
access = {
"principalId": "yyyyyyyy",
"policyDocument" : {
"Version": "2012-10-17",
"Statement": [
{
"Action": "execute-api:Invoke",
"Resource": [
"some-arn/*/GET/organisation"
],
"Effect": "Allow"
}
]
},
"context" : {
"organization_id": "123"
}
}
在后端站点,我想在DynamoDb上执行GetItem。映射模板如下所示:
{
"TableName":"Organisation",
"Key":{
"id":{
"S":"$context.authorizer.organization_id"
}
}
}
但是,我收到错误,因为context
变量似乎是空的:
Mon Jul 10 19:47:16 UTC 2017 : Endpoint request body after transformations: { ""
"TableName":"Organisation",
"Key":{
"id":{
"S":""
}
}
}
Mon Jul 10 19:47:16 UTC 2017 : Endpoint response body before transformations: {"__type":"com.amazon.coral.service#SerializationException"}
任何建议,我在这里做错了什么?