带 openfire 的 XMPPframewok

发布于 2024-12-15 13:56:11 字数 2796 浏览 0 评论 0原文

我已经设置了自己的 Openfire 服务器并使用 Spark 和 Adium 对其进行了测试。尽管在从 XMPPFramework for iOS 运行示例项目时出现以下身份验证错误:

2011-11-16 01:34:26:850 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStream:socketDidConnect:
2011-11-16 01:34:26:850 iPhoneXMPP[1245:8d0f] SEND: <stream:stream xmlns='jabber:client'  xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='flashmatch.net'>
2011-11-16 01:34:27:464 iPhoneXMPP[1245:7b13] RECV: <stream:stream  xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="ip-10-112-57-167"   id="ff9c2cf2" xml:lang="en" version="1.0"/>
2011-11-16 01:34:27:772 iPhoneXMPP[1245:8d0f] RECV: <stream:features><starttls   xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> <mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>
2011-11-16 01:34:27:772 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStreamDidConnect:
2011-11-16 01:34:27:772 iPhoneXMPP[1245:207] SEND: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/>
2011-11-16 01:34:28:079 iPhoneXMPP[1245:7b13] RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImlwLTEwLTExMi01Ny0xNjciLG5vbmNlPSIycWZoY01JL0R2a0Z0ME41TmNSdGpUaGk0dmVOamk4YUxHMU9LMmZwIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
2011-11-16 01:34:28:079 iPhoneXMPP[1245:7b13] decoded response: username="alan",realm="ip- 10-112-57-167",nonce="2qfhcMI/DvkFt0N5NcRtjThi4veNji8aLG1OK2fp",cnonce="8C2C32EC-532A-4A75-8166-F75387CE2F84",nc=00000001,qop=auth,digest-uri="xmpp/flashmatch.net",response=8b1ad8c7c968a92d36ff6ed895b0ed80,charset=utf-8
2011-11-16 01:34:28:080 iPhoneXMPP[1245:7b13] SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImFsYW4iLHJlYWxtPSJpcC0xMC0xMTItNTctMTY3Iixub25jZT0iMnFmaGNNSS9EdmtGdDBONU5jUnRqVGhpNHZlTmppOGFMRzFPSzJmcCIsY25vbmNlPSI4QzJDMzJFQy01MzJBLTRBNzUtODE2Ni1GNzUzODdDRTJGODQiLG5jPTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZmxhc2htYXRjaC5uZXQiLHJlc3BvbnNlPThiMWFkOGM3Yzk2OGE5MmQzNmZmNmVkODk1YjBlZDgwLGNoYXJzZXQ9dXRmLTg=</response>
2011-11-16 01:34:28:386 iPhoneXMPP[1245:8d0f] RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
2011-11-16 01:34:28:386 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStream:didNotAuthenticate:

但是,在连接到 talk.google.com 时,相同的示例项目运行良好。有人知道这里出了什么问题吗?

I've setup my own Openfire server and have it tested with Spark and Adium. Though I got the following authentication error when running the sample project from XMPPFramework for iOS:

2011-11-16 01:34:26:850 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStream:socketDidConnect:
2011-11-16 01:34:26:850 iPhoneXMPP[1245:8d0f] SEND: <stream:stream xmlns='jabber:client'  xmlns:stream='http://etherx.jabber.org/streams' version='1.0' to='flashmatch.net'>
2011-11-16 01:34:27:464 iPhoneXMPP[1245:7b13] RECV: <stream:stream  xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="ip-10-112-57-167"   id="ff9c2cf2" xml:lang="en" version="1.0"/>
2011-11-16 01:34:27:772 iPhoneXMPP[1245:8d0f] RECV: <stream:features><starttls   xmlns="urn:ietf:params:xml:ns:xmpp-tls"/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"> <mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanism>CRAM-MD5</mechanism></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth"/><register xmlns="http://jabber.org/features/iq-register"/></stream:features>
2011-11-16 01:34:27:772 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStreamDidConnect:
2011-11-16 01:34:27:772 iPhoneXMPP[1245:207] SEND: <auth xmlns='urn:ietf:params:xml:ns:xmpp-sasl' mechanism='DIGEST-MD5'/>
2011-11-16 01:34:28:079 iPhoneXMPP[1245:7b13] RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImlwLTEwLTExMi01Ny0xNjciLG5vbmNlPSIycWZoY01JL0R2a0Z0ME41TmNSdGpUaGk0dmVOamk4YUxHMU9LMmZwIixxb3A9ImF1dGgiLGNoYXJzZXQ9dXRmLTgsYWxnb3JpdGhtPW1kNS1zZXNz</challenge>
2011-11-16 01:34:28:079 iPhoneXMPP[1245:7b13] decoded response: username="alan",realm="ip- 10-112-57-167",nonce="2qfhcMI/DvkFt0N5NcRtjThi4veNji8aLG1OK2fp",cnonce="8C2C32EC-532A-4A75-8166-F75387CE2F84",nc=00000001,qop=auth,digest-uri="xmpp/flashmatch.net",response=8b1ad8c7c968a92d36ff6ed895b0ed80,charset=utf-8
2011-11-16 01:34:28:080 iPhoneXMPP[1245:7b13] SEND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImFsYW4iLHJlYWxtPSJpcC0xMC0xMTItNTctMTY3Iixub25jZT0iMnFmaGNNSS9EdmtGdDBONU5jUnRqVGhpNHZlTmppOGFMRzFPSzJmcCIsY25vbmNlPSI4QzJDMzJFQy01MzJBLTRBNzUtODE2Ni1GNzUzODdDRTJGODQiLG5jPTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvZmxhc2htYXRjaC5uZXQiLHJlc3BvbnNlPThiMWFkOGM3Yzk2OGE5MmQzNmZmNmVkODk1YjBlZDgwLGNoYXJzZXQ9dXRmLTg=</response>
2011-11-16 01:34:28:386 iPhoneXMPP[1245:8d0f] RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
2011-11-16 01:34:28:386 iPhoneXMPP[1245:207] iPhoneXMPPAppDelegate: xmppStream:didNotAuthenticate:

The same sample project works well when connecting to talk.google.com however. Any one knows what went wrong here?

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

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

发布评论

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

评论(3

谁对谁错谁最难过 2024-12-22 13:56:11

如果不查看代码,很难猜出问题所在,但身份验证问题表明您的用户 JID 或密码存在问题。所以我可以想到两个可能的问题:

  1. 你应该确保你在 Openfire 中正确设置了用户和密码。
  2. 其次检查“服务器名称”属性是否设置正确。转到您的管理面板 ->服务器信息->服务器名称。这应该与您的 iOS 项目中用户的域名相匹配。让我们看一下这个示例:如果您的服务器名称设置为“127.0.0.1”,那么您应该使用 [电子邮件受保护],使用YOURUSER@localhost 将不起作用,将在身份验证过程中失败。

It is hard to guess the problem without looking that the code but the authontication problem indicates a problem in your users JIDs or passwords. So i can think of two possible problems:

  1. You should make sure that you have set your users and passwords correctly in your Openfire.
  2. Second check the "Server Name" property if it was set correctly. Go to you admin panel -> Server Information -> Server Name. This should match the domain name of your users in your iOS project. Lets look at this example: if you have your server name set to "127.0.0.1" then you should use [email protected], using YOURUSER@localhost will not work will fail in the authentication process.
失而复得 2024-12-22 13:56:11

当您尝试登录时,请提供用户名和服务器的 IP 地址,例如“[email protected] ]

如果你是尝试登录指定的域,然后在 setupStream 方法中添加这些代码行

[xmppStream setHostName:@"google.com"];//domain name
[xmppStream setHostPort:5222];//port number

When you try to login, provide user name with the ip address of server like "[email protected]"

If you are trying to login at a specified domain then add these line of code in setupStream Method

[xmppStream setHostName:@"google.com"];//domain name
[xmppStream setHostPort:5222];//port number
酒几许 2024-12-22 13:56:11

您可以在管理面板中查看 openfire ServerName。

服务器管理器>服务器信息>服务器名称:[服务器名称]

主机地址/IP 可能与服务器名称中的不同:

[host_address]:9090/ - 管理面板[server_name]

如果服务器名称与主机地址设置不同,则如下所示。在大多数情况下,服务器名称和名称主机地址相同。所以 iOS xmppframework 的身份验证没有问题。

xmppStream.hostName = @"hostaddress";
xmppStream.hostPort = 5222;

jabberID = @"username@servername";

You could check the openfire ServerName in admin panel.

Server Manager > Server Information > Server Name: [server_name]

Host Address / IP might be different from the one in Server Name:

[host_address]:9090/ - admin panel [server_name]

if server name is different than host address settings would be like below. In most situations server name & host address are same. so no issues in authentication with iOS xmppframework.

xmppStream.hostName = @"hostaddress";
xmppStream.hostPort = 5222;

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