Jabber 使用随机名称自动登录

发布于 2024-07-25 03:53:50 字数 732 浏览 4 评论 0原文

我正在使用 JSJaCejabberd 。 除了所有网站访问者都被授予帐户“guest”之外,一切正常。 如果两个访问者尝试同时进行实时聊天,则响应会变得混乱,或者第一个用户会被注销。

我可以随机设置客人姓名,但随后我需要检查该姓名是否已注册或自动注册,并希望它以前没有被注册过。 我尝试将每个登录名分配给随机资源名称,但这仍然合并了对话。

简而言之,我正在寻找最简单的方法来允许多个匿名登录与实时聊天帐户开始单独的对话。 如果当主要实时聊天帐户处于聊天状态时,实时聊天可以循环到不同的用户,那就更好了(但可选)。

该解决方案可以是基于 Web 客户端或服务器的,我不在乎,因为我控制两者(并且 ejabberd 支持各种模块)。

顺便说一句,当我尝试自动注册注册帐户时,JSJaC simpleclient demo 返回:

An error occured:
Code: 409
Type: cancel
Condition: conflict

我还没有确定这是否是我可以通过自定义客户端或服务器设置忽略或覆盖的内容。 我想我可以检测到这个错误并在不自动注册的情况下重试,但我想听到更好/更简单的选择。

I'm building a live chat using JSJaC and ejabberd . It's all working except that all site visitors are given the account 'guest'. If two visitors try to livechat at the same time the responses get muddled or the first user is logged out.

I can randomly set the guest name but then I need to check whether that name is registered or auto-register and hope it hasn't been registered before. I tried assigning each login to a random resource name but this still merged the conversations.

In short i'm looking for the easiest way to allow multiple anonymous logins to start individual conversations with the livechat account. Even better (but optional) if the livechat could round-robin to a different user when the primary livechat account is in a chat.

The solution can be web-client or server based, I don't care since I control both (and ejabberd supports various modules).

BTW, when I try to auto-register a registered account the JSJaC simpleclient demo returns:

An error occured:
Code: 409
Type: cancel
Condition: conflict

I haven't established yet if this is something I can ignore or override with a custom client or server setup. I suppose I could just detect this error and try again without auto-register but I'd like to hear better/easier options.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

我一向站在原地 2024-08-01 03:53:50

尝试在您的 ejabberd 服务器上启用匿名登录模式? 然后你不必注册客户帐户,只需选择任何随机用户名和密码,ejabberd 就会接受它们......

Try enabling anonymous login mode on your ejabberd server? Then you don't have to register the client accounts, just pick any random username and password and ejabberd should accept them...

双手揣兜 2024-08-01 03:53:50

我想你可以在 ejabberd 中使用外部身份验证
我处于同样的情况:我希望匿名用户能够登录服务器,但一些特殊用户也能够登录执行管理任务......
所以我决定编写一个 php 脚本作为 ejabberd 的身份验证处理程序。
然后它将接受所有名称以 anon_* 开头的登录
并根据数据库对其他用户进行身份验证。

I guess you can use external authentication in ejabberd
I'm in the same situation: I want anonymous users to be able to login in the server, but some special users also be able to login for adiminstrative tasks...
So I decided to write a php script as an authentication handler for ejabberd.
Then it will accept all logins with the name starting with anon_*
and authenticate other users against a database.

魔法唧唧 2024-08-01 03:53:50

我们在项目中遇到了类似的问题 - 我们希望用户能够登录而无需创建任何帐户或发生冲突 - 自动注册对我们不起作用,因为名称可能会发生冲突。 最后,我们选择在 ejabberd 中使用 SASL 身份验证进行匿名登录 - 它允许匿名登录和动态帐户创建,我相信帐户不会保留在系统上(它们仅在连接打开时才处于活动状态),但是据我记得服务器将为用户生成一个随机ID。

GUID JID 问题也许可以通过使用 昵称

设置 SASL

Ejabberd 支持页面 - SASL

We had a similar issue in a project - we wanted users to be able to login without requiring any account creation or clashes - auto-registration would not work for us because names could clash. In the end we chose anonymous login with SASL authentication in ejabberd - it allows anonymous login and dynamic account creation and I believe the accounts do not stay on the system (they are alive only whilst the connection is open), however from what I remember the server will generate a random ID for the user.

The GUID JID problem might be able to be solved with the use of Nicknames

Set up SASL

Ejabberd Support Page - SASL

情释 2024-08-01 03:53:50

如果您无法使 ejabberd 的匿名模式正常工作,您可以尝试为每个用户创建一个 GUID基本名称,并且只是动态注册用户。 您需要一个定期脚本来从数据库中删除旧的未使用的帐户。

If you can't get ejabberd's anonymous mode working, you might try creating a GUID for each user's base name, and just registering the user on the fly. You'll want to have a periodic script that deletes old unused accounts from the database.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文