[{"data":1,"prerenderedAt":33},["ShallowReactive",2],{"snippet-apigateway-dynamodb-secure":3},{"id":4,"title":5,"contributors":6,"description":8,"extension":9,"gitHub":10,"introBox":13,"languages":17,"meta":19,"resources":20,"services":21,"snippets":24,"stem":29,"tags":30,"type":31,"__hash__":32},"snippets\u002Fsnippets\u002Fapigateway-dynamodb-secure.json","VTL - Authorized user",[7],"content\u002Fcontributors\u002Feric-johnson.json","Limits the returned data to the authorized user","json",{"template":11},{"repoURL":12},"https:\u002F\u002Fgithub.com\u002Faws-samples\u002Fserverless-snippets\u002Ftree\u002Fmain\u002Fapigateway-dynamodb-secure",{"headline":14,"text":15},"How it works",[16],"The snippet looks up the authorized user in the context.claims data from API Gateway. The returned user must match the owner which is the Global Secondary Index (GSI)",[18],"VTL",{},null,[22,23],"apigw","dynamodb",[25],{"title":26,"language":27,"code":28},"Limit returned data to authorized user","vtl","#set( $pageKey = $input.params('pageKey'))\n{\n  \"TableName\": \"myTable\",\n  \"IndexName\":\"OwnerIndex\",\n  \"KeyConditionExpression\": \"#n_owner = :v_owner\",\n  \"ExpressionAttributeValues\": {\n    \":v_owner\": {\"S\": \"$context.authorizer.claims.email\"}\n  },\n  \"ExpressionAttributeNames\": {\"#n_owner\": \"owner\"}\n}","snippets\u002Fapigateway-dynamodb-secure",[],"Integration","SzQKMeQxBXxmMOcicFdikLnjhDLgwV0VYIsBMzZxiBY",1792578863862]