mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Merge pull request #194 from guusdk/SPARK-1747_GSSAPI-ignore
Spark-1747 and UI tweaks
This commit is contained in:
@ -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.
|
||||
|
||||
@ -341,6 +341,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
||||
if (isSelected) {
|
||||
String resource = InetAddress.getLocalHost().getHostName();
|
||||
resourceField.setText(resource);
|
||||
useVersionAsResourceBox.setSelected( false );
|
||||
}
|
||||
resourceField.setEnabled(!isSelected);
|
||||
} catch (UnknownHostException e) {
|
||||
@ -360,6 +361,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
||||
if (isSelected) {
|
||||
String resource = Default.getString(Default.APPLICATION_NAME) + " " + JiveInfo.getVersion() + "." + Default.getString(Default.BUILD_NUMBER);
|
||||
resourceField.setText(resource);
|
||||
useHostnameAsResourceBox.setSelected( false );
|
||||
}
|
||||
resourceField.setEnabled(!isSelected);
|
||||
//localPreferences.setHostAndPortConfigured(!isSelected);
|
||||
@ -744,7 +746,6 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
||||
private static final long serialVersionUID = 3661245275095536202L;
|
||||
private JCheckBox useSSOBox = new JCheckBox();
|
||||
private JPanel settingsPanel = new JPanel();
|
||||
private JCheckBox showAdvBox = new JCheckBox();
|
||||
private JLabel ssoRealmLabel = new JLabel();
|
||||
private JTextField ssoRealmField = new JTextField();
|
||||
private JLabel ssoKDCLabel = new JLabel();
|
||||
@ -760,11 +761,8 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
||||
public SsoPanel() {
|
||||
ResourceUtils.resButton(useSSOBox,
|
||||
Res.getString("title.advanced.connection.usesso"));
|
||||
ResourceUtils.resButton(showAdvBox,
|
||||
Res.getString("title.advanced.connection.preferences"));
|
||||
|
||||
useSSOBox.addActionListener(this);
|
||||
showAdvBox.addActionListener(this);
|
||||
|
||||
final WrappedLabel wrappedLabel = new WrappedLabel();
|
||||
String principalName = null;
|
||||
@ -822,16 +820,10 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
||||
ssoRealmField.setEnabled(localPreferences.isSSOEnabled());
|
||||
ssoKDCField.setEnabled(localPreferences.isSSOEnabled());
|
||||
|
||||
showAdvBox.setSelected(localPreferences.getSSOAdv());
|
||||
settingsPanel.setVisible(localPreferences.getSSOAdv());
|
||||
|
||||
setLayout(new GridBagLayout());
|
||||
add(useSSOBox, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
|
||||
new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(showAdvBox, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
|
||||
GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
|
||||
new Insets(5, 5, 5, 5), 0, 0));
|
||||
add(wrappedLabel,
|
||||
new GridBagConstraints(0, 2, 1, 1, 1.0, 0.0,
|
||||
GridBagConstraints.NORTHWEST,
|
||||
@ -929,8 +921,6 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
||||
ssoMethodManualRadio.setEnabled(useSSOBox.isSelected());
|
||||
ssoRealmField.setEnabled(useSSOBox.isSelected());
|
||||
ssoKDCField.setEnabled(useSSOBox.isSelected());
|
||||
} else if (e.getSource() == showAdvBox) {
|
||||
settingsPanel.setVisible(showAdvBox.isSelected());
|
||||
}
|
||||
}
|
||||
|
||||
@ -939,7 +929,7 @@ public class LoginSettingDialog implements PropertyChangeListener {
|
||||
boolean valid = true;
|
||||
UIManager.put("OptionPane.okButtonText", Res.getString("ok"));
|
||||
|
||||
if (useSSOBox.isSelected() && showAdvBox.isSelected()) {
|
||||
if (useSSOBox.isSelected()) {
|
||||
if (ssoMethodManualRadio.isSelected()) {
|
||||
if (!ModelUtil.hasLength(ssoRealmField.getText())) {
|
||||
JOptionPane.showMessageDialog(optionsDialog,
|
||||
|
||||
@ -908,14 +908,6 @@ public class LocalPreferences {
|
||||
return getBoolean("ssoEnabled", false);
|
||||
}
|
||||
|
||||
public void setSSOAdv(boolean enabled) {
|
||||
setBoolean("ssoAdv", enabled);
|
||||
}
|
||||
|
||||
public boolean getSSOAdv() {
|
||||
return getBoolean("ssoAdv", false);
|
||||
}
|
||||
|
||||
public void setSSOMethod(String method) {
|
||||
props.setProperty("ssoMethod", method);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user