如何将XMPP与注册用户完全集成在网站上 [英] How to fully integrate XMPP on a web site with registered users

查看:194
本文介绍了如何将XMPP与注册用户完全集成在网站上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个社交网站,人们可以在其中建立联系,我们希望将其与XMPP集成.我们目前使用ejabberd XMPP服务器.

We have a social networking site where people have contacts and we want it to be integrated with XMPP. We currently use ejabberd XMPP server.

这是我的问题:

  1. 如何正确创建帐户?现在,我的想法是在Web应用程序上进行用户注册,我们将调用一个脚本,该脚本将执行ejabberd命令来创建用户.

  1. How to properly create account? Right now, what I'm thinking is on user registration on our web app, we'd call a script that would execute an ejabberd command to create a user.

用户身份验证.用户在我们的网站上登录后,该用户将自动在聊天系统上登录.您如何使用strophe.js在客户端执行此操作?据我了解,您需要提供JID和密码进行身份验证,因此我认为在登录时,将进行ajax调用以获取用户的密码,然后在strophe.js的登录调用中使用响应文本.这样安全吗?还有其他方法吗?

User authentication. Upon user login on our website, the user would be automatically logged in on the chat system. How do you do this on the client side with strophe.js? As I understand, you need to provide JID and password for authentication, so I'm thinking that on login, there would be an ajax call to get user's password, then use the response text on strophe.js' login call. Is this secure? Are there other ways to do this?

在场注册.我们的Web应用程序具有联系人系统,但是XMPP拥有自己的通过状态订阅添加联系人的方式,对吗?示例:当用户1尝试添加用户2时,在用户1可以成为用户2的联系人之前,将向用户2请求授权.但是,由于我们的Web应用程序上已经有一个联系人系统,因此我们想绕过XMPP的授权或取消它,而当user2在我们的网站上确认用户1为联系人时,仅使用脚本/命令进行授权. .我还不清楚,但是一位同事说这可以在ejabberd的模块mod_admin_extra(该命令无需客户端授权即可创建订阅)上实现.是否有可能还是我必须使用脚本手动操作ejabberd数据库(前提是我已从默认的Mnesia数据库转移到另一个数据库,例如MySQL).

Presence registration. Our web app has a contacts system, but XMPP has its own way of adding contacts through presence subscription, right? Example: When user1 tries to add user2, an authorization would be asked to user2 before user1 can be a contact of user2. But since we already have a contacts system on our web app, we want to bypass this authorization of XMPP or suppress it and just authorize with a script/command when user2 confirms user1 as a contact on our web site. It's not clear to me yet but a colleague said this is possible on ejabberd's module mod_admin_extra (a command that will create a subscription without having to client-side authorization). Is it possible or do I have to manipulate the ejabberd database manually with a script (provided I transferred from the default Mnesia db to another db, say MySQL).

谢谢.

推荐答案

好的,这就是我们所做的:

Alright, here's what we did:

1)我们在用户注册后在XMPP上创建用户帐户,而不是自定义身份验证/外部身份验证.

1) Instead of custom authentication/external authentication, we create user accounts on XMPP after a user registers.

2)正如朱利安(Julien)指出的那样,对此的答案是会话附件.我们创建了一个PHP脚本,该脚本将创建会话并返回会话ID和RID.在用户登录时通过AJAX调用(在文档准备好之后).

2) The answer to this one is session attachment as Julien pointed out. We created a PHP script that would create the session and return the session ID and RID. Called through AJAX on login of user (after the document is ready).

3)正如我在评论Julien帖子时所说,我们使用了mod_admin_extra.我们加上mod_rest(w/c允许您发送节/运行命令REST风格)来创建花名册.每次用户在我们的网站上创建联系人时,都会在mod_admin_extra上有一个* add_rosteritem *命令.

3) As I said on a comment on Julien's post, we used mod_admin_extra. We coupled with mod_rest (w/c allows you to send stanzas/run commands REST style) to create the rosters. There is an *add_rosteritem* command on mod_admin_extra that gets called every time users create contacts on our web site.

这篇关于如何将XMPP与注册用户完全集成在网站上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆