Closed GoogleCodeExporter closed 9 years ago
Apparently, this never worked with SASL. What sort of action are you going to
take
in OnLoginRequired? I'm trying to picture the use case so I can figure out how
the
API should change. I guess I could add a new state, and make the Login() method
start the SASL process when you're in that state.
Original comment by hil...@gmail.com
on 31 Mar 2008 at 8:18
What I am looking to do is simply register a user. This is within a welcome
screen that prompts the user to create an account. Looking into the issue
further:
If username and password are null, then this happens:
SND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams"
id="cd16dc41" xmlns="jabber:client" to="robbiehanson.com" version="1.0">
Warning: overriding existing packet factory
RCV: <?xml version='1.0'?><stream:stream xmlns='jabber:client'
xmlns:stream='http://etherx.jabber.org/streams' id='1490986094'
from='robbiehanson.com' version='1.0' xml:lang='en'>
RCV: <stream:features><mechanisms
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>DIGEST-MD5</mechanism><mecha
nism>PLAIN</mechanism></mechanisms><register
xmlns='http://jabber.org/features/iq-
register'/></stream:features>
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>...</challenge>
jabberClient_OnError: jabber.connection.sasl.SASLException: Missing SASL
username directive
Now if we check for a SASLException in the OnError method, and call Register at
this point, we get an infinite loop:
[...the same stream opening sequence and features as above...]
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>...</challenge>
jabberClient_OnError: jabber.connection.sasl.SASLException: Missing SASL
username directive
SND: <iq id="JN_1" type="get" to="robbiehanson.com"><query
xmlns="jabber:iq:register"><username>johndoe</username></query></iq>
RCV: <iq from='robbiehanson.com' id='JN_1' type='result'><query
xmlns='jabber:iq:register'><instructions>...</instructions><username/><password/
></query></iq>
jabberClient_OnError: jabber.connection.sasl.SASLException: Invalid SASL
protocol
SND: <iq id="JN_2" type="get" to="robbiehanson.com"><query
xmlns="jabber:iq:register"><username>johndoe</username></query></iq>
RCV: <iq from='robbiehanson.com' id='JN_2' type='result'><query
xmlns='jabber:iq:register'><instructions>...</instructions><username/><password/
></query></iq>
jabberClient_OnError: jabber.connection.sasl.SASLException: Invalid SASL
protocol
...etc
Now if we instead use an empty string for both username and password, then we
get this:
[...the same stream opening sequence and features as above...]
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>...</challenge>
SND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">...</response>
RCV: <failure
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>
jabberClient_OnError: jabber.connection.sasl.AuthenticationFailedException:
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure>
And registering at this point will work correctly:
[...the same stream opening sequence and features as above...]
SND: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />
RCV: <challenge xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>...</challenge>
SND: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">...</response>
RCV: <failure
xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><not-authorized/></failure>
jabberClient_OnError: jabber.connection.sasl.AuthenticationFailedException:
<failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized /></failure>
SND: <iq id="JN_1" type="get" to="robbiehanson.com"><query
xmlns="jabber:iq:register"><username>johndoe</username></query></iq>
RCV: <iq from='robbiehanson.com' id='JN_1' type='result'><query
xmlns='jabber:iq:register'><instructions>...</instructions><username/><password/
></query></iq>
jabberClient_OnRegisterInfo
SND: <iq type="set" id="JN_2" to="robbiehanson.com"><query
xmlns="jabber:iq:register"><instructions>...</instructions><username>johndoe</us
ername><password>...</password></query></iq>
RCV: <iq from='robbiehanson.com' id='JN_2' type='result'><query
xmlns='jabber:iq:register'><instructions>..</instructions><username>johndoe</use
rname><password>...</password></query></iq>
jabberClient_OnRegistered
I should note, that all of these examples had AutoLogin set to false.
Also, I had an event setup for OnLoginRequired, which was never called. I
tested it multiple times to be sure.
Let me know if there's anything else I can answer for you.
Original comment by robbieha...@gmail.com
on 1 Apr 2008 at 1:21
Fixed. Just call Login() when you're done with registration.
Original comment by hil...@gmail.com
on 17 Apr 2008 at 7:54
Original issue reported on code.google.com by
robbieha...@gmail.com
on 30 Mar 2008 at 3:35