您如何处理 Orbited 的身份验证?
我正在尝试创建一个网站,用户可以在其中创建帐户,然后使用 Django、Orbited 和 Twisted 相互实时聊天。我希望两个用户的个人聊天是私密的,只有他们才能看到。
根据我对 Orbited 的了解(这很有限,因为该网站似乎已关闭,所以我刚刚停止了博客文章之类的事情),有一些频道基本上任何人都可以订阅并接收发送到它的消息。由于订阅是通过 JavaScript 完成的,因此某人可以轻松更改他们订阅的频道并订阅其他人的私人聊天并查看他们在说什么。
那么如何解决这个问题并在 Orbited 的频道中进行某种身份验证呢?我环顾四周,大多数人都引用 Hotdot 作为例子,但它没有详细的记录,所以很难理解。它似乎只是在允许您订阅任何内容之前检查身份验证,但是一旦您登录,您仍然可以订阅您想要的任何频道。
I'm trying to make a site where users can create accounts then chat with each other in real time using Django, Orbited, and Twisted. I want it so that two users individual chats are private and only they can see it.
Based on my knowledge of Orbited(which is limited since it seems like the site is down, so I've just been going off of blog posts and whatnot), there are channels that basically anyone can subscribe to and get the messages sent to it. Since the subscribing is done through Javascript, it would be easy for someone to just change what channel they're subscribed to and subscribe to someone else's private chat and see what they're saying.
So how would you get around this and have some kind of authentication in Orbited's channels? I've been looking around and most people cite Hotdot as an example, but it's not extremely documented so it's hard to understand. It also seems like it just checks for authentication before allowing you to subscribe to anything, but once you're logged in you'd still be able to subscribe to any channel you want.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种肮脏的方法是这样做:
由于 sessionid 对于每个登录用户来说都是唯一的,因此您可以为每个聊天会话创建一个唯一的 ID,并将用户的 sessionid 附加到该 ID。
然后让您的频道名称为 /messages/{sessionid} 或类似的名称,并且
每当您想要推送消息时,您的用户都会订阅该频道,只需推送到附加到该聊天会话的所有 /messages/{sessionids}
即可获得更好的解决方案,您应该尝试轨道讨论组:http://groups.google.com/group/orbited-users
它仍然存在;-)
a dirty way is to do this:
since sessionids are unique to each logged in user, you can create a unique id for each chatsession and attach the sessionids of the users to that.
then let your channel-name be /messages/{sessionid} or something similar and your users subscribe to that channel
whenever you want to push messages, just push to all /messages/{sessionids} attached to that chatsession
for a better solution, you should try the orbited discussion group: http://groups.google.com/group/orbited-users
it is still alive ;-)