mirror of
https://github.com/igniterealtime/Spark.git
synced 2025-12-01 12:27:58 +00:00
Spark-1787 Add option to disable TLS hostname verification (#207)
* Added option to disable tls hostname verification * Spark-1787 Small change to text
This commit is contained in:
@ -254,7 +254,10 @@ public class LoginDialog {
|
||||
} catch (NoSuchAlgorithmException | KeyManagementException e) {
|
||||
Log.warning( "Unable to create configuration.", e );
|
||||
}
|
||||
}
|
||||
}
|
||||
if (localPref.isDisableHostnameVerification()) {
|
||||
TLSUtils.disableHostnameVerificationForTlsCertificicates(builder);
|
||||
}
|
||||
if ( localPref.isDebuggerEnabled()) {
|
||||
builder.setDebuggerEnabled( true );
|
||||
}
|
||||
|
||||
@ -36,6 +36,7 @@ class GeneralLoginSettingsPanel extends JPanel implements ActionListener
|
||||
private JCheckBox compressionBox = new JCheckBox();
|
||||
private JCheckBox debuggerBox = new JCheckBox();
|
||||
private JCheckBox acceptAllCertificatesBox = new JCheckBox();
|
||||
private JCheckBox disableHostnameVerificationBox = new JCheckBox();
|
||||
|
||||
public GeneralLoginSettingsPanel( LocalPreferences localPreferences, JDialog optionsDialog )
|
||||
{
|
||||
@ -58,7 +59,7 @@ class GeneralLoginSettingsPanel extends JPanel implements ActionListener
|
||||
ResourceUtils.resButton( compressionBox, Res.getString( "checkbox.use.compression" ) );
|
||||
ResourceUtils.resButton( debuggerBox, Res.getString( "checkbox.use.debugger.on.startup" ) );
|
||||
ResourceUtils.resButton( acceptAllCertificatesBox, Res.getString( "checkbox.accept.all.certificates" ) );
|
||||
|
||||
ResourceUtils.resButton( disableHostnameVerificationBox, Res.getString( "checkbox.disable.hostname.verification" ) );
|
||||
portField.setText( Integer.toString( localPreferences.getXmppPort() ) );
|
||||
timeOutField.setText( Integer.toString( localPreferences.getTimeOut() ) );
|
||||
autoLoginBox.setSelected( localPreferences.isAutoLogin() );
|
||||
@ -85,6 +86,8 @@ class GeneralLoginSettingsPanel extends JPanel implements ActionListener
|
||||
|
||||
acceptAllCertificatesBox.setSelected( localPreferences.isAcceptAllCertificates() );
|
||||
|
||||
disableHostnameVerificationBox.setSelected( localPreferences.isDisableHostnameVerification() );
|
||||
|
||||
final JPanel connectionPanel = new JPanel();
|
||||
connectionPanel.setLayout( new GridBagLayout() );
|
||||
connectionPanel.setBorder( BorderFactory.createTitledBorder( Res.getString( "group.connection" ) ) );
|
||||
@ -112,7 +115,8 @@ class GeneralLoginSettingsPanel extends JPanel implements ActionListener
|
||||
add( useSSLBox, new GridBagConstraints( 0, 6, 2, 1, 0.0, 1.0, WEST, HORIZONTAL, DEFAULT_INSETS, 0, 0 ) );
|
||||
add( compressionBox, new GridBagConstraints( 0, 7, 2, 1, 0.0, 1.0, WEST, HORIZONTAL, DEFAULT_INSETS, 0, 0 ) );
|
||||
add( acceptAllCertificatesBox, new GridBagConstraints( 0, 8, 2, 1, 0.0, 1.0, WEST, HORIZONTAL, DEFAULT_INSETS, 0, 0 ) );
|
||||
add( debuggerBox, new GridBagConstraints( 0, 9, 2, 1, 0.0, 1.0, WEST, HORIZONTAL, DEFAULT_INSETS, 0, 0 ) );
|
||||
add( disableHostnameVerificationBox, new GridBagConstraints( 0, 9, 2, 1, 0.0, 1.0, WEST, HORIZONTAL, DEFAULT_INSETS, 0, 0 ) );
|
||||
add( debuggerBox, new GridBagConstraints( 0, 10, 2, 1, 0.0, 1.0, WEST, HORIZONTAL, DEFAULT_INSETS, 0, 0 ) );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -247,6 +251,7 @@ class GeneralLoginSettingsPanel extends JPanel implements ActionListener
|
||||
localPreferences.setUseHostnameAsResource( useHostnameAsResourceBox.isSelected() );
|
||||
localPreferences.setUseVersionAsResource( useVersionAsResourceBox.isSelected() );
|
||||
localPreferences.setAcceptAllCertificates( acceptAllCertificatesBox.isSelected() );
|
||||
localPreferences.setDisableHostnameVerification( disableHostnameVerificationBox.isSelected() );
|
||||
SettingsManager.saveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
@ -1162,6 +1162,14 @@ public class LocalPreferences {
|
||||
return getBoolean("AcceptAllCertificates", true);
|
||||
}
|
||||
|
||||
public void setDisableHostnameVerification(boolean accept) {
|
||||
setBoolean("DisableHostnameVerification", accept);
|
||||
}
|
||||
|
||||
public boolean isDisableHostnameVerification() {
|
||||
return getBoolean("DisableHostnameVerification", false);
|
||||
}
|
||||
|
||||
private boolean getBoolean(String property, boolean defaultValue) {
|
||||
return Boolean.parseBoolean(props.getProperty(property, Boolean
|
||||
.toString(defaultValue)));
|
||||
|
||||
@ -379,7 +379,8 @@ checkbox.transport.tab.setting = Show available transports in tab (requires rest
|
||||
checkbox.conference.tab.setting = Show conference service in tab (requires restart)
|
||||
checkbox.use.hostname.as.resource = Use hostname as resource
|
||||
checkbox.use.version.as.resource = Use Spark version as resource
|
||||
checkbox.accept.all.certificates = Accept all certificates
|
||||
checkbox.accept.all.certificates = Accept all certificates (e.g. Self-Signed/Expired/etc)
|
||||
checkbox.disable.hostname.verification = Disable certificate hostname verification (Not Recommended)
|
||||
|
||||
delete.log.permanently = Permanently delete log
|
||||
delete.permanently = Permanently delete?
|
||||
|
||||
Reference in New Issue
Block a user