我正试图为我将要开发的基于XMPP的应用程序创建一个XMPP服务器库。我被困在试图用普通的SASL认证客户端上。我已经在https://www.rfc-editor.org/rfc/rfc6120#section-6.4.6读过RFC了。
我的问题是,在发送、接收和发送一个新的打开标记和一个空的特性列表之后,客户机(Pidgin)继续使用非SASL身份验证。这是通信的日志(<<表示传入,>>传出):
<< <?xml version='1.0' ?><stream:stream to='127.0.0.1' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
>> <?xml version="1.0" ?>
>> <stream:stream version="1.0" xmlns="jabber:server" xmlns:stream="http://etherx.jabber.org/streams" id="kanapka" from="127.0.0.1">
>> <stream:features>
>> <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
>> <mechanism>
>> PLAIN
>> </mechanism>
>> </mechanisms>
>> </stream:features>
<< <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='PLAIN' xmlns:ga='http://www.google.com/talk/protocol/auth' ga:client-uses-full-bind-result='true'>AHRlc3R1c2VyAHRlc3RwYXNz</auth>
>> <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
<< <stream:stream to='127.0.0.1' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0'>
>> <?xml version="1.0" ?>
>> <stream:stream version="1.0" xmlns="jabber:server" xmlns:stream="http://etherx.jabber.org/streams" id="hotdog" from="127.0.0.1">
>> <stream:features />
<< <iq type='get' id='purple46cbc043'><query xmlns='jabber:iq:auth'><username>testuser</username></query></iq>我还没有使用TLS,也没有尝试过任何其他SASL机制。这都是纯文本。
这是相同的TCP连接,流的is是不同的。这里有什么问题?
发布于 2014-09-07 16:18:29
您没有宣传对资源绑定的支持,因此客户端无法完成会话设置。如果服务器不支持XMPP风格的流设置,那么Pidgin似乎决定回到jabber:iq:auth (前XMPP风格)。
您需要了解https://www.rfc-editor.org/rfc/rfc6120#section-7,因为“在XMPP客户端和服务器实现中需要对资源绑定的支持”。“流的各方必须将资源约束视为必须协商的义务”。
虽然通过查看其他实现来实现XMPP,而不是遵循规范,这并不是一个好主意,有时浏览另一个实现的流会给出这样的提示。
https://stackoverflow.com/questions/25712026
复制相似问题