mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-30 02:02:06 +01:00
Forgot to replace refactored code in non-anonymous sasl....arggg... SMACK-85
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@2827 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
fb76968401
commit
5ab6d22c9d
1 changed files with 2 additions and 51 deletions
|
@ -206,57 +206,8 @@ public class SASLAuthentication implements UserAuthentication {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (saslNegotiated) {
|
if (saslNegotiated) {
|
||||||
// We now need to bind a resource for the connection
|
// Bind a resource for this connection and
|
||||||
// Open a new stream and wait for the response
|
return bindResourceAndEstablishSession(resource);
|
||||||
connection.packetWriter.openStream();
|
|
||||||
|
|
||||||
// Wait until server sends response containing the <bind> element
|
|
||||||
synchronized (this) {
|
|
||||||
try {
|
|
||||||
wait(30000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bind bindResource = new Bind();
|
|
||||||
bindResource.setResource(resource);
|
|
||||||
|
|
||||||
PacketCollector collector = connection
|
|
||||||
.createPacketCollector(new PacketIDFilter(bindResource.getPacketID()));
|
|
||||||
// Send the packet
|
|
||||||
connection.sendPacket(bindResource);
|
|
||||||
// Wait up to a certain number of seconds for a response from the server.
|
|
||||||
Bind response = (Bind)collector.nextResult(
|
|
||||||
SmackConfiguration.getPacketReplyTimeout());
|
|
||||||
collector.cancel();
|
|
||||||
if (response == null) {
|
|
||||||
throw new XMPPException("No response from the server.");
|
|
||||||
}
|
|
||||||
// If the server replied with an error, throw an exception.
|
|
||||||
else if (response.getType() == IQ.Type.ERROR) {
|
|
||||||
throw new XMPPException(response.getError());
|
|
||||||
}
|
|
||||||
String userJID = response.getJid();
|
|
||||||
|
|
||||||
if (sessionSupported) {
|
|
||||||
Session session = new Session();
|
|
||||||
collector = connection
|
|
||||||
.createPacketCollector(new PacketIDFilter(session.getPacketID()));
|
|
||||||
// Send the packet
|
|
||||||
connection.sendPacket(session);
|
|
||||||
// Wait up to a certain number of seconds for a response from the server.
|
|
||||||
IQ ack = (IQ) collector
|
|
||||||
.nextResult(SmackConfiguration.getPacketReplyTimeout());
|
|
||||||
collector.cancel();
|
|
||||||
if (ack == null) {
|
|
||||||
throw new XMPPException("No response from the server.");
|
|
||||||
}
|
|
||||||
// If the server replied with an error, throw an exception.
|
|
||||||
else if (ack.getType() == IQ.Type.ERROR) {
|
|
||||||
throw new XMPPException(ack.getError());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return userJID;
|
|
||||||
} else {
|
} else {
|
||||||
// SASL authentication failed so try a Non-SASL authentication
|
// SASL authentication failed so try a Non-SASL authentication
|
||||||
return new NonSASLAuthentication(connection)
|
return new NonSASLAuthentication(connection)
|
||||||
|
|
Loading…
Reference in a new issue