我正在尝试使用getMembers()获取成员列表但我得到'错误代码:403,forbidden-auth'试图获取成员列表的用户是一个组的成员但是如果我做的话所有者的相同操作,他可以成功获得一个列表.
这是我获取成员列表的配置 'muc#roomconfig_getmemberlist' : [moderator, participants, visitor]
并且在xep-045中也非常清楚地提到"服务应该也应该将成员列表返回给仅限成员的房间中的任何占用者;即,当房间中的成员请求成员列表时,它不应该产生错误."
那我在这里缺少什么?
这些是捕获数据包
SENT(0):
<iq to='membersonlygroup@muc.domain' from='92123456@domain/Resource' id='1BO5n-74' type='get'><query xmlns='http://jabber.org/protocol/muc#admin'><item affiliation='member'></item></query></iq>
Run Code Online (Sandbox Code Playgroud)
SMACK:RECV(0):
`<iq from='membersonlygroup@muc.domain' to='92123456@domain/Resource' id='1BO5n-74' type='error'><query xmlns='http://jabber.org/protocol/muc#admin'><item affiliation='member'/></query><error code='403' type='auth'><forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/><text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'>Administrator privileges required</text></error></iq><r xmlns='urn:xmpp:sm:3'/>`
Run Code Online (Sandbox Code Playgroud)
编辑:还有 一件事是成员有参与者的角色,但我注意到在这种情况下角色值为空.
我正在尝试通过管理员帐户创建新用户.但是我收到了auth错误.我试着像回答这个,但它并不能帮助.
我创建新用户的代码:
AccountManager accountManager = AccountManager.getInstance(mConnection);
if (accountManager.supportsAccountCreation()) {
try {
accountManager.createAccount(username, password);
}
catch (XMPPException ex) {
LOG.info(ex.getMessage(), ex);
}
}
else{
LOG.error("Server doesn't support creating new accounts");
}
Run Code Online (Sandbox Code Playgroud)
我允许在配置中注册ALL:
{access, register, [{allow, all}]}.
{access, register_from, [{allow, all}]}.
{mod_register, [
...
{ip_access, [{allow, "127.0.0.0/8"},
{deny, "0.0.0.0/0"}]},
{access_from, register_from},
{access, register}
]},
Run Code Online (Sandbox Code Playgroud)
即使有这个配置我有错误:
org.jivesoftware.smack.XMPPException$XMPPErrorException: XMPPError: forbidden - auth
at org.jivesoftware.smack.XMPPException$XMPPErrorException.ifHasErrorThenThrow(XMPPException.java:135)
at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:232)
at org.jivesoftware.smack.PacketCollector.nextResultOrThrow(PacketCollector.java:213)
at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager.java:272)
at org.jivesoftware.smackx.iqregister.AccountManager.createAccount(AccountManager.java:244)
Run Code Online (Sandbox Code Playgroud)
PS Smack 4.1.0
我在AWS的EC2实例中配置了docker-compose的MongooseIM服务器。
我打算通过以下方式通过端口5222(mongooseim的ejabberd_c2s模块)上的ELB(AWS)通过SSL访问某些移动客户端:
SSL (Secure TCP) -> 5222 -> TCP -> 5222 (EC2 Instance Port)
Run Code Online (Sandbox Code Playgroud)
在ejabberd_c2s模块配置中,我具有以下内容:
{ 5222, ejabberd_c2s, [
%%
%% If TLS is compiled in and you installed a SSL
%% certificate, specify the full path to the
%% file and uncomment this line:
%%
{certfile, "priv/ssl/fake_server.pem"}, starttls,
%%{zlib, 10000},
%% https://www.openssl.org/docs/apps/ciphers.html#CIPHER_STRINGS
%% {ciphers, "DEFAULT:!EXPORT:!LOW:!SSLv2"},
{access, c2s},
{shaper, c2s_shaper},
{max_stanza_size, 65536},
{protocol_options, ["no_sslv3"]}
]},
Run Code Online (Sandbox Code Playgroud)
但是客户无法连接,我在服务器上收到的唯一消息是:
mongooseim_server_dev | 10:58:25.885 [info] (#Port<0.27608>) Accepted connection {{10,0,17,246},42571} -> {{172,18,0,2},5222}
mongooseim_server_dev | 10:58:25.885 [debug] …Run Code Online (Sandbox Code Playgroud)