Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
toduro #1
Member since Dec 2009 · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: agsXMPP: how to connecto to openfire server
I have been trying for a couple of days to connect to an openfire server but so far the farthest I can get ends up with:

authentication error for agnt@jabber.myserver.com/agsXMPP : <failure xmlns="u
rn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure>

Note that "jabber.myserver.com" is a sanitized server name.

Very simple code and the whole XML dump is below.

I have tried many cominations of settings for xmpp.UseSSL, xmpp.UseStartTLS,  xmpp.UseCompression, xmpp.SocketConnectionType, xmpp.AutoAgents, xmpp.AutoRoster, xmpp.AutoResolveConnectServer, all to no avail.  Browsing through the forum here leads me to believe that others here have successfully connected to an openfire server, but for the life of me I cannot figure out how they did it.

Clients like Exodus connect to the server with no problem.  I noticed from its debug facililty that it seems to use what I take to be the equivalent of agsXMPP UseStartTLS = true.

How does one connect to an openfire server using agsXMPP? 

Elsewhere I have seen comments like "fix your server configuration" but I have no idea what that means in terms of what settings are "correct" of how to find documentation which provides that information.

Any help would be greatly appreciated.

Here is the relevant code snippet:

////////////////////////////////////////////////////////////////
            string messageText = "test message using agsXMPP library";
            string jabberServer = "jabber.myserver.com";
            string jabberID = "agnt@jabber.myserver.com";
            string jabberUser = "agnt";
            string jabberPassword = "t";
 
            XmppClientConnection xmpp = new XmppClientConnection(jabberServer);

            xmpp.UseSSL = true;  // tried both
            xmpp.UseStartTLS = true;  // tried both
            xmpp.UseCompression = false;  // tried both
            xmpp.SocketConnectionType = agsXMPP.net.SocketConnectionType.Direct;
            xmpp.AutoAgents = true;  // tried both
            xmpp.AutoRoster = true;  // tried both
            xmpp.AutoResolveConnectServer = false;

            xmpp.OnAuthError += delegate(object o, Element e) { System.Console.WriteLine(string.Format("authentication error for {0} : {1}", xmpp.MyJID, e.ToString())); };
            xmpp.OnLogin += delegate(object o) { xmpp.Send(new Message("wroom@customer.jabber", MessageType.chat, messageText)); };
            xmpp.ClientSocket.OnValidateCertificate += CertificateValidationCallBack;
            xmpp.ClientSocket.OnConnect += delegate(object o) { System.Console.WriteLine("clientSocket.OnConnect hit"); };
            xmpp.ClientSocket.OnError += delegate(object o, Exception ex) { Console.WriteLine("ClientSocket.OnError hit, exception: " + ex.ToString()); };
            xmpp.OnWriteXml += (_, xml) => System.Console.WriteLine(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " + System.Environment.NewLine + xml + System.Environment.NewLine + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " + System.Environment.NewLine);
            xmpp.OnReadXml += (_, xml) => System.Console.WriteLine("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " + System.Environment.NewLine + xml + System.Environment.NewLine + "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< " + System.Environment.NewLine);
           
            xmpp.Open(jabberUser, jabberPassword);
////////////////////////////////////////////////////////////////


Here is the XML I dumped:

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<stream:stream to='jabber.myserver.com' xmlns='jabber:client' xmlns:stream='h
ttp://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

clientSocket.OnConnect hit
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="jabber" ver
sion="1.0" xml:lang="en" id="801a97e4" >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<stream:features xmlns:stream="http://etherx.jabber.org/streams"><starttls xmlns
="urn:ietf:params:xml:ns:xmpp-tls" /><mechanisms xmlns="urn:ietf:params:xml:ns:x
mpp-sasl"><mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism><mechanis
m>ANONYMOUS</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" /></stream:features>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls" />
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<stream:stream to='jabber.myserver.com' xmlns='jabber:client' xmlns:stream='h
ttp://etherx.jabber.org/streams' version='1.0' xml:lang='en'>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="jabber" ver
sion="1.0" xml:lang="en" id="801a97e4" >
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<stream:features xmlns:stream="http://etherx.jabber.org/streams"><mechanisms xml
ns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>DIGEST-MD5</mechanism><mechanis
m>PLAIN</mechanism><mechanism>ANONYMOUS</mechanism><mechanism>CRAM-MD5</mechanis
m></mechanisms><compression xmlns="http://jabber.org/features/compress"><method>
zlib</method></compression><auth xmlns="http://jabber.org/features/iq-auth" /></
stream:features>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<auth xmlns="urn:ietf:params:xml:ns:xmpp-sasl" mechanism="DIGEST-MD5" />
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">cmVhbG09ImphYmJlciIsbm9uY2U9
IlpOanhoUEV1UWpRQ1pyYlhid1hIUW1oWFdDcC84ODIrcVkvMDA5NVMiLHFvcD0iYXV0aCIsY2hhcnNl
dD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9ImFnbnQiLHJlYWxtP
SJqYWJiZXIiLG5vbmNlPSJaTmp4aFBFdVFqUUNacmJYYndYSFFtaFhXQ3AvODgyK3FZLzAwOTVTIixjb
m9uY2U9ImU1MWQyNTVlZTY1NmIyOWUwYjU3NzNhZDk5ZTA5OWJmODk1OTI3NWFiNWVmNmRhNjYyYjNhZ
mM4ZDlkOTgyOGMiLG5jPTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvamFiYmVyLnNtY
XJ0YWN0aW9uLmNvbSIsY2hhcnNldD11dGYtOCxyZXNwb25zZT01NjgyYzgzMmZmNjM1MTZmMTc1MjBjZ
GQ0MzczYTYwNg==</response>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

authentication error for agnt@jabber.myserver.com/agsXMPP : <failure xmlns="u
rn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure>
press the enter key to exit
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
</stream:stream>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
Avatar
Alex #2
Member since Feb 2003 · 4297 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
your server configuration is wrong. Look at the stream headerof your xml debug.


<stream:stream to='jabber.myserver.com' xmlns='jabber:client' xmlns:stream='h
ttp://etherx.jabber.org/streams' version='1.0' xml:lang='en'>

<stream:stream xmlns:stream="http://etherx.jabber.org/streams" from="jabber" ver
sion="1.0" xml:lang="en" id="801a97e4" >

the server is configured to the domain jabber, not jabber.myserver.com. This is why secure SASL auth fails. Other clients that succeed don't use secure SASL DIGEST MD5 authentication where also the domain is included in the authentication.

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS