如何仅允许AWS IoT订阅Cognito用户ID(sub)下的主题?

编程入门 行业动态 更新时间:2024-10-28 14:36:56
本文介绍了如何仅允许AWS IoT订阅Cognito用户ID(sub)下的主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我希望后端能够直接将消息发送给经过身份验证的用户。这意味着我需要限制用户只订阅他们自己的标识符下的主题。理想情况下,以我目前有限的理解,我将有一个将用户 sub 作为变量的策略:

I want my backend to be able to directly send messages to authenticated users. Which means I need to limit the users to only subscribe on topics under their own identifiers. Ideally, to my currently limited understanding, I would have a policy that has the user sub as a variable:

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Connect", "iot:Publish", "iot:Receive", "iot:GetThingShadow", "iot:UpdateThingShadow", "iot:DeleteThingShadow" ], "Resource": "*" }, { "Effect": "Allow", "Action": [ "iot:Subscribe" ], "Resource": "arn:aws:iot:us-east-1:949960872797:topicfilter/user/${cognitoUserSub}/someTopic" } ] }

如果最终认知识别码不是该政策的选择,请告知我我还将提供什么其他识别码。无论是哪种方式,我都需要能够基于用户的认知标识符( sub )以某种方式获取它。

If ultimately the cognito identifier is not an option for this policy, please advise me of what other identifier i would provide. Whichever it is, i need to be able to somehow obtain it based on the user's cognito identifier (the sub).

请注意,我在这方面的知识非常有限,因此我了解到我可能会有所偏离。

Note that my knowledge in this regard is very limited, so I understand that I might be off by quite a bit.

推荐答案

已在AWS论坛上回答 forums.aws.amazon/thread .jspa?threadID = 268115

Answered on AWS forum forums.aws.amazon/thread.jspa?threadID=268115

有关如何在AWS IoT中使用认知模式的详细信息,请同时查看 forums.aws.amazon/thread.jspa?threadID=224268

For details on how to use cognito with AWS IoT also check forums.aws.amazon/thread.jspa?threadID=224268

更多推荐

如何仅允许AWS IoT订阅Cognito用户ID(sub)下的主题?

本文发布于:2023-08-01 16:32:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1269881.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:主题   用户   IoT   AWS   ID

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!