bump sasl2 namespace

This commit is contained in:
Daniel Gultsch 2022-09-15 13:10:15 +02:00
parent 495f79921d
commit bf15070fef
2 changed files with 8 additions and 4 deletions

View file

@ -16,7 +16,7 @@ public final class Namespace {
public static final String DATA = "jabber:x:data";
public static final String OOB = "jabber:x:oob";
public static final String SASL = "urn:ietf:params:xml:ns:xmpp-sasl";
public static final String SASL_2 = "urn:xmpp:sasl:1";
public static final String SASL_2 = "urn:xmpp:sasl:2";
public static final String CHANNEL_BINDING = "urn:xmpp:sasl-cb:0";
public static final String TLS = "urn:ietf:params:xml:ns:xmpp-tls";
public static final String PUBSUB = "http://jabber.org/protocol/pubsub";

View file

@ -1187,7 +1187,7 @@ public class XmppConnection implements Runnable {
&& account.isOptionSet(Account.OPTION_REGISTER)) {
throw new StateChangingException(Account.State.REGISTRATION_NOT_SUPPORTED);
} else if (Config.SASL_2_ENABLED
&& this.streamFeatures.hasChild("mechanisms", Namespace.SASL_2)
&& this.streamFeatures.hasChild("authentication", Namespace.SASL_2)
&& shouldAuthenticate
&& isSecure) {
authenticate(SaslMechanism.Version.SASL_2);
@ -1230,8 +1230,12 @@ public class XmppConnection implements Runnable {
}
private void authenticate(final SaslMechanism.Version version) throws IOException {
final Element element =
this.streamFeatures.findChild("mechanisms", SaslMechanism.namespace(version));
final Element element;
if (version == SaslMechanism.Version.SASL) {
element = this.streamFeatures.findChild("mechanisms", Namespace.SASL);
} else {
element = this.streamFeatures.findChild("authentication", Namespace.SASL_2);
}
final Collection<String> mechanisms =
Collections2.transform(
Collections2.filter(