@@ -44,6 +44,7 @@ public class NewConnectionDialog extends DialogWrapper {
44
44
private JBTextField connectionNameTextField ;
45
45
private JBTextField hostTextField ;
46
46
private JCheckBox enableSSLCheckBox ;
47
+ private JCheckBox ldapAuthCheckbox ;
47
48
private JBTextField usernameTextField ;
48
49
private JPasswordField passwordField ;
49
50
private JButton testConnectionButton ;
@@ -55,7 +56,7 @@ public class NewConnectionDialog extends DialogWrapper {
55
56
private JPasswordField apiSecretField ;
56
57
private JPanel wrapperPanel ;
57
58
58
- private DefaultMutableTreeNode clickedNode ;
59
+ private DefaultMutableTreeNode clickedNode ;
59
60
60
61
public NewConnectionDialog (Project project , Tree tree , SavedCluster savedCluster , DefaultMutableTreeNode clickedNode ) {
61
62
super (false );
@@ -159,7 +160,6 @@ private void handleSaveConnection() {
159
160
}
160
161
} catch (Exception ex ) {
161
162
Log .error (ex );
162
- ex .printStackTrace ();
163
163
showErrorLabel ("<html>Connection failed.<br>Please double-check your credentials" + (defaultBucketTextField .getText ().trim ().isEmpty () ? " or inform a Bucket on <strong>Advanced Settings</strong> -> <strong>Troubleshooting</strong> to inspect your connection" : "" ) + "</html>" );
164
164
saveButton .setEnabled (true );
165
165
messageLabel .setText ("" );
@@ -168,11 +168,15 @@ private void handleSaveConnection() {
168
168
169
169
try {
170
170
171
- if (this .savedCluster != null ) {
171
+ if (this .savedCluster != null ) {
172
172
ConnectionNodeDescriptor userObject = (ConnectionNodeDescriptor ) clickedNode .getUserObject ();
173
173
TreeActionHandler .deleteConnection (clickedNode , userObject , tree );
174
174
}
175
- SavedCluster sc = DataLoader .saveDatabaseCredentials (connectionNameTextField .getText (), getBaseUrl (hostTextField .getText ()), getQueryParams (hostTextField .getText ()), enableSSLCheckBox .isSelected (), usernameTextField .getText (), String .valueOf (passwordField .getPassword ()), defaultBucketTextField .getText ().trim ().isEmpty () ? null : defaultBucketTextField .getText ());
175
+ SavedCluster sc = DataLoader .saveDatabaseCredentials (connectionNameTextField .getText (),
176
+ getBaseUrl (hostTextField .getText ()), getQueryParams (hostTextField .getText ()),
177
+ enableSSLCheckBox .isSelected (), usernameTextField .getText (), String .valueOf (passwordField .getPassword ()),
178
+ defaultBucketTextField .getText ().trim ().isEmpty () ? null : defaultBucketTextField .getText (),
179
+ ldapAuthCheckbox .isSelected ());
176
180
messageLabel .setText ("Connection was successful" );
177
181
TreeActionHandler .connectToCluster (project , sc , tree , null );
178
182
close (DialogWrapper .CANCEL_EXIT_CODE );
@@ -184,7 +188,6 @@ private void handleSaveConnection() {
184
188
showErrorLabel ("The Couchbase cluster URL and username already exists." );
185
189
} catch (Exception ex ) {
186
190
Log .error (ex );
187
- ex .printStackTrace ();
188
191
messageLabel .setText ("" );
189
192
showErrorLabel ("Could not save the database credentials" );
190
193
}
@@ -239,7 +242,9 @@ private void handleTestConnection() {
239
242
}
240
243
241
244
private boolean hasCorrectBucketConnection () {
242
- Set <String > buckets = DataLoader .listBucketNames (hostTextField .getText (), enableSSLCheckBox .isSelected (), usernameTextField .getText (), String .valueOf (passwordField .getPassword ()));
245
+ Set <String > buckets = DataLoader .listBucketNames (hostTextField .getText (),
246
+ enableSSLCheckBox .isSelected (), usernameTextField .getText (),
247
+ String .valueOf (passwordField .getPassword ()), ldapAuthCheckbox .isSelected ());
243
248
244
249
if (!defaultBucketTextField .getText ().trim ().isEmpty ()) {
245
250
if (!buckets .contains (defaultBucketTextField .getText ())) {
@@ -394,6 +399,7 @@ private JPanel createDatabasePanel() {
394
399
hostTextField = new JBTextField (30 );
395
400
hostTextField .getEmptyText ().setText ("Your cluster URL" );
396
401
enableSSLCheckBox = new JCheckBox ("Enable SSL" );
402
+ ldapAuthCheckbox = new JCheckBox ("LDAP Auth" );
397
403
398
404
gbc .fill = GridBagConstraints .HORIZONTAL ;
399
405
gbc .gridwidth = GridBagConstraints .REMAINDER ;
@@ -427,14 +433,21 @@ private JPanel createDatabasePanel() {
427
433
gbc .gridy = 3 ;
428
434
gbc .gridx = 1 ;
429
435
gbc .weightx = 0.7 ;
430
- firstPanel .add (TemplateUtil .createComponentWithBalloon (enableSSLCheckBox , "Check this if TLS is enabled in your cluster. If you specify 'couchbases://' protocol in your Connection String, this option will be checked automatically" ), gbc );
431
436
437
+ JPanel checkboxPanel = new JPanel ();
438
+ checkboxPanel .setLayout (new FlowLayout (FlowLayout .LEFT , 0 , 0 ));
439
+ checkboxPanel .add (TemplateUtil .createComponentWithBalloon (enableSSLCheckBox , "Check this if TLS is enabled in your cluster. If you specify 'couchbases://' protocol in your Connection String, this option will be checked automatically" ));
440
+ JBPanel ldapPanel = TemplateUtil .createComponentWithBalloon (ldapAuthCheckbox , "Check this if your authentication uses LDAP" );
441
+ ldapPanel .setBorder (JBUI .Borders .emptyLeft (10 ));
442
+ checkboxPanel .add (ldapPanel );
443
+ firstPanel .add (checkboxPanel , gbc );
432
444
if (this .savedCluster != null ) {
433
445
connectionNameTextField .setText (this .savedCluster .getName ());
434
446
hostTextField .setText (this .savedCluster .getUrl ());
435
447
enableSSLCheckBox .setSelected (this .savedCluster .isSslEnable ());
448
+ ldapAuthCheckbox .setSelected (this .savedCluster .getLDAP ());
436
449
cleanURL ();
437
- hostTextField .setText (hostTextField .getText ()+ (savedCluster .getQueryParams ()!= null ? savedCluster .getQueryParams (): "" ));
450
+ hostTextField .setText (hostTextField .getText () + (savedCluster .getQueryParams () != null ? savedCluster .getQueryParams () : "" ));
438
451
}
439
452
440
453
return firstPanel ;
0 commit comments