2016-06-23 31 views
0

我有一組用戶通過亞馬遜認證進行身份驗證。通過amozon cognito在無服務器安裝中找到粒度訪問控制

現在,使用dynamodb,API網關和λ,我想創建一個數據庫,其中每個條目:

  • 擁有創建(或擁有)用戶
  • 有被允許的用戶列表編輯

我想造成一種設置:

  • 只有所有者可以刪除該條目並改變用戶的列表allowe編輯
  • 只有在編輯列表中的用戶被允許更改的條目

那麼,如何做到這一點的數據? 據我所見,我無法獲得aws lambda中的cognito用戶名。

這可能使用沒有任何lambda函數的api網關代理?

回答

1

您可以通過API網關將Cognito用戶池用戶名傳遞給Lambda函數。一般來說,你需要遵循的步驟是。

1. SignUp and SignIn with Cognito user pools. 
2. Use the access token to invoke a API gateway endpoint using [custom authorizes](https://mobile.awsblog.com/post/Tx3JK25U7Z9EUIU/Integrating-Amazon-Cognito-User-Pools-with-API-Gateway). 
3. Trigger the lambda function from API gateway and pass the user name in context. 

檢查此forum post瞭解更多詳情。

相關問題