SPARK-1747: No SSO? Ignore GSSAPI mech

When Spark is not logging in with SSO, don't consider the GSSAPI
mechanism if offered by the server.
This commit is contained in:
Guus der Kinderen
2016-08-19 21:34:46 +02:00
parent 6cb57676ba
commit a15055d09e

View File

@ -31,6 +31,7 @@ import org.jivesoftware.smack.*;
import org.jivesoftware.smack.parsing.ExceptionLoggingCallback;
import org.jivesoftware.smack.proxy.ProxyInfo;
import org.jivesoftware.smack.sasl.javax.SASLExternalMechanism;
import org.jivesoftware.smack.sasl.javax.SASLGSSAPIMechanism;
import org.jivesoftware.smack.tcp.XMPPTCPConnection;
import org.jivesoftware.smack.tcp.XMPPTCPConnectionConfiguration;
import org.jivesoftware.smack.util.TLSUtils;
@ -292,6 +293,16 @@ public class LoginDialog {
}
}
// SPARK-1747: Don't use the GSSAPI mechanism when SSO is disabled.
if ( localPref.isSSOEnabled() && !SASLAuthentication.getRegisterdSASLMechanisms().containsKey( SASLGSSAPIMechanism.class.getName() ))
{
SASLAuthentication.registerSASLMechanism( new SASLGSSAPIMechanism() );
}
else if ( !localPref.isSSOEnabled() && SASLAuthentication.getRegisterdSASLMechanisms().containsValue( SASLGSSAPIMechanism.NAME ))
{
SASLAuthentication.unregisterSASLMechanism( SASLGSSAPIMechanism.class.getName() );
}
ReconnectionManager.setEnabledPerDefault( true );
// TODO These were used in Smack 3. Find Smack 4 alternative.