summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKalina Jasinska <kalina.jasinska@gmail.com>2013-08-29 14:09:34 (GMT)
committer Kalina Jasinska <kalina.jasinska@gmail.com>2013-08-29 14:09:34 (GMT)
commit596a9624a496d9f5f908e54cdbd456a3472e9087 (patch)
tree42e2d9e0e0857b9cd6ff870475b0fac199d39692
parente094ad971f6c88133f6717e1c2702cbbc666df14 (diff)
downloadQCG-Data-596a9624a496d9f5f908e54cdbd456a3472e9087.zip
QCG-Data-596a9624a496d9f5f908e54cdbd456a3472e9087.tar.gz
QCG-Data-596a9624a496d9f5f908e54cdbd456a3472e9087.tar.bz2
gsisupport merged
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.form5
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java1208
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java6
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java2
4 files changed, 626 insertions, 595 deletions
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.form b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.form
index 425ee1f..12a7651 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.form
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.form
@@ -302,7 +302,7 @@
</Constraint>
</Constraints>
</Component>
- <Component class="javax.swing.JLabel" name="lblCertMpde">
+ <Component class="javax.swing.JLabel" name="lblCertMode">
<Properties>
<Property name="text" type="java.lang.String" value="Certificate mode:"/>
</Properties>
@@ -484,9 +484,6 @@
<Properties>
<Property name="text" type="java.lang.String" value="Selected browser:"/>
</Properties>
- <AccessibilityProperties>
- <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="Selected browser:"/>
- </AccessibilityProperties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="13" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="22" weightX="0.0" weightY="0.0"/>
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java
index 0c52aa6..b6e5091 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/LoginDialog.java
@@ -44,407 +44,408 @@ import org.slf4j.LoggerFactory;
import uk.ac.rl.esc.browser.Browser;
/**
- *
+ *
* @author mikeconway
*/
public class LoginDialog extends JDialog {
- private static final long serialVersionUID = 1L;
- private IDROPCore idropCore = null;
- public static org.slf4j.Logger log = LoggerFactory.getLogger(LoginDialog.class);
-
- private boolean loginTrialSuccesful = false;
-
- public boolean isLoginTrialSuccesful() {
- return loginTrialSuccesful;
- }
-
- // Indexes of gsi modes used in properties to store users choice
- static final int PEM_MODE = 1;
- static final int P12_MODE = 2;
- static final int BROWSER_MODE = 3;
- static final int PROXY_MODE = 4;
-
- public LoginDialog(final JDialog parentDialog, final IDROPCore idropCore) {
- super(parentDialog, true);
- if (idropCore == null) {
- throw new IllegalArgumentException("null idropCore");
- }
- this.idropCore = idropCore;
- initComponents();
-
- if (idropCore.getIdropConfig().isLoginPreset()) {
- loginUsingPreset();
- } else {
- loginNormally();
- }
-
- registerKeystrokeListener();
- setLocationRelativeTo(parentDialog);
-
- }
-
- private void loginNormally() {
- // predispose based on preferences
- String host = idropCore.getIdropConfig().getPropertyForKey(
- IdropConfigurationService.ACCOUNT_CACHE_HOST);
- if (host != null) {
- txtHost.setText(host);
- }
- String port = idropCore.getIdropConfig().getPropertyForKey(
- IdropConfigurationService.ACCOUNT_CACHE_PORT);
- if (port == null || port.isEmpty()) {
- port = "1247";
- }
-
- String mode = idropCore.getIdropConfig().getPropertyForKey(
- IdropConfigurationService.ACCOUNT_CACHE_LOGIN_MODE);
- if (mode == null || mode.isEmpty()) {
- mode = IRODSAccount.AuthScheme.STANDARD.name();
- } else {
- comboLoginMode.setSelectedItem(mode);
- }
-
- String proxy = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_PROXY_LOCATION);
-
- if(proxy!=null){
- txtProxy.setText(proxy);
- }
-
- String certificates = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_CERTIFICATES_LOCATION);
-
- if(certificates!=null){
- txtCerts.setText(certificates);
- }
-
- // Read paths from propeties: PEM certificate, PEM key, p12 certificate
- String pemcert = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_CERT_PEM_LOCATION);
- if(pemcert!=null){
- txtPEMCertificateLocation.setText(pemcert);
-
- }
- String p12cert = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_CERT_P12_LOCATION);
- if(p12cert!=null){
- txtP12CertificateLocation.setText(p12cert);
- }
-
- String keyLoc = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_KEY_PEM_LOCATION);
- if(keyLoc!=null){
- txtKeyLocation.setText(keyLoc);
- }
- // Read gsi mode from properties (p12, PEM, browser, proxy file)
- String certMode = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_CERT_LOGIN_MODE);
- try{
- int certModeNum = Integer.parseInt(certMode);
- setSelectedModeFields(certModeNum);
- }catch(Exception ex){
- Logger.getLogger(LoginDialog.class.getName()).log(Level.WARNING,null, ex);
- }
- //
- txtPort.setText(port);
- String zone = idropCore.getIdropConfig().getPropertyForKey(
- IdropConfigurationService.ACCOUNT_CACHE_ZONE);
- txtZone.setText(zone);
- String resource = idropCore.getIdropConfig().getPropertyForKey(
- IdropConfigurationService.ACCOUNT_CACHE_RESOURCE);
- txtResource.setText(resource);
- String username = idropCore.getIdropConfig().getPropertyForKey(
- IdropConfigurationService.ACCOUNT_CACHE_USER_NAME);
- txtUserName.setText(username);
-
-
- String save = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_USER_SAVE_PASS);
- boolean saveP = "true".equals(save);
- if(saveP){
- String savedPassword = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_USER_PASSWORD);
- password.setText(savedPassword);
- chkRememberPass.setSelected(true);
-
- String gsi = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_USER_AUTO_GSI);
- boolean autoGsi = "true".equals(gsi);
- chkProxyLogin.setSelected(autoGsi);
-
- loginTrialSuccesful = !processLogin();
- }
-
- hideAdvancedViewFields();
- hideProxyLoginFields();
- }
-
- private void loginUsingPreset() {
- log.debug("login will use presets");
- lblHost.setVisible(false);
- txtHost.setVisible(false);
- lblPort.setVisible(false);
- txtPort.setVisible(false);
- lblZone.setVisible(false);
- txtZone.setVisible(false);
- lblResource.setVisible(false);
- txtResource.setVisible(false);
- chkAdvancedLogin.setVisible(false);
- lblLoginMode.setVisible(false);
- comboLoginMode.setVisible(false);
- }
-
- /**
- * Action to take when login is initiated
- *
- * @return
- * @throws NumberFormatException
- */
- private boolean processLogin() throws NumberFormatException {
- // validate various inputs based on whether a full login, or a uid only
- // login is indicated
- if (!idropCore.getIdropConfig().isLoginPreset()) {
- txtHost.setBackground(Color.white);
- txtPort.setBackground(Color.white);
- txtZone.setBackground(Color.white);
- txtResource.setBackground(Color.white);
- if (txtHost.getText().length() == 0) {
- txtHost.setBackground(Color.red);
- }
- if (txtPort.getText().length() == 0) {
- txtPort.setBackground(Color.red);
- } else {
- try {
- Integer.parseInt(txtPort.getText());
- } catch (Exception e) {
- txtPort.setBackground(Color.red);
- }
- }
- if (txtZone.getText().length() == 0) {
- txtZone.setBackground(Color.red);
- }
- if (txtResource.getText().length() == 0) {
- txtResource.setBackground(Color.red);
- }
- }
-
- txtUserName.setBackground(Color.white);
- password.setBackground(Color.white);
- if (txtUserName.getText().length() == 0) {
- txtUserName.setBackground(Color.red);
- }
- if (password.getPassword().length == 0) {
- password.setBackground(Color.red);
- }
- StringBuilder sb = new StringBuilder();
- final IRODSAccount irodsAccount;
-
- try {
-
- // validated, now try to log in
- if (idropCore.getIdropConfig().isLoginPreset()) {
- log.debug("creating account with presets");
- String presetHost = idropCore.getIdropConfig()
- .getPropertyForKey(
- IdropPropertiesHelper.LOGIN_PRESET_HOST);
- log.info("presetHost:{}", presetHost);
- int presetPort = Integer.parseInt(idropCore.getIdropConfig()
- .getPropertyForKey(
- IdropPropertiesHelper.LOGIN_PRESET_PORT));
- log.info("presetPort:{}", presetPort);
- String presetZone = idropCore.getIdropConfig()
- .getPropertyForKey(
- IdropPropertiesHelper.LOGIN_PRESET_ZONE);
- log.info("presetZone:{}", presetZone);
- String presetResource = idropCore.getIdropConfig()
- .getPropertyForKey(
- IdropPropertiesHelper.LOGIN_PRESET_RESOURCE);
- log.info("presetResource:{}", presetResource);
- sb.append('/');
- sb.append(presetZone);
- sb.append("/home/");
- sb.append(txtUserName.getText());
-
- if (chkGuestLogin.isSelected()) {
- irodsAccount = IRODSAccount.instanceForAnonymous(
- presetHost, presetPort, "", presetZone,
- presetResource);
- } else if(chkProxyLogin.isSelected()){
-
- GSSCredential gssCred =getGssCredential();
-
- GSIIRODSAccount acc = GSIIRODSAccount.instance(presetHost, presetPort, gssCred, presetResource);
- acc.setCertificateAuthority(txtCerts.getText());
- irodsAccount = acc;
- } else {
- irodsAccount = IRODSAccount.instance(presetHost,
- presetPort, txtUserName.getText(), new String(
- password.getPassword()), sb.toString(),
- presetZone, presetResource);
- }
- } else {
- sb.append('/');
- sb.append(txtZone.getText());
- sb.append("/home/");
- sb.append(txtUserName.getText());
-
- if (chkGuestLogin.isSelected()) {
- irodsAccount = IRODSAccount.instanceForAnonymous(txtHost
- .getText().trim(), Integer.parseInt(txtPort
- .getText().trim()), "", txtZone.getText().trim(),
- txtResource.getText().trim());
- } else if(chkProxyLogin.isSelected()){
- // TODO
- GSSCredential gssCred = getGssCredential();
-
-
- GSIIRODSAccount acc = GSIIRODSAccount.instance(
- txtHost.getText().trim(),
- Integer.parseInt(txtPort.getText().trim()), gssCred, txtResource.getText().trim());
- acc.setCertificateAuthority(txtCerts.getText().trim());
- irodsAccount = acc;
-
- } else{
- irodsAccount = IRODSAccount.instance(txtHost.getText()
- .trim(),
- Integer.parseInt(txtPort.getText().trim()),
- txtUserName.getText().trim(),
- new String(password.getPassword()).trim(), sb
- .toString().trim(), txtZone.getText()
- .trim(), txtResource.getText().trim());
- }
- }
- } catch (JargonException ex) {
- Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
- null, ex);
- MessageManager.showError(this, ex.getMessage(),
- MessageManager.TITLE_MESSAGE);
- return true;
- } catch (GlobusCredentialException ex) {
- Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,null,ex);
- MessageManager.showError(this, ex.getMessage(), MessageManager.TITLE_MESSAGE);
- return true;
- } catch (GSSException ex) {
- Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,null,ex);
- MessageManager.showError(this, ex.getMessage(), MessageManager.TITLE_MESSAGE);
- return true;
- }catch(GssSecurityException ex){//?
- Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,null,ex);
- MessageManager.showError(this,
- "Wrong certifcate, key, password or proxy.",
- "Login Error");
- return true;
+ private static final long serialVersionUID = 1L;
+ private IDROPCore idropCore = null;
+ public static org.slf4j.Logger log = LoggerFactory.getLogger(LoginDialog.class);
+ private boolean loginTrialSuccesful = false;
+
+ public boolean isLoginTrialSuccesful() {
+ return loginTrialSuccesful;
+ }
+ // Indexes of gsi modes used in properties to store users choice
+ static final int PEM_MODE = 1;
+ static final int P12_MODE = 2;
+ static final int BROWSER_MODE = 3;
+ static final int PROXY_MODE = 4;
+
+ public LoginDialog(final JDialog parentDialog, final IDROPCore idropCore) {
+ super(parentDialog, true);
+ if (idropCore == null) {
+ throw new IllegalArgumentException("null idropCore");
+ }
+ this.idropCore = idropCore;
+ initComponents();
+
+ if (idropCore.getIdropConfig().isLoginPreset()) {
+ loginUsingPreset();
+ } else {
+ loginNormally();
+ }
+
+ registerKeystrokeListener();
+ setLocationRelativeTo(parentDialog);
+
+ }
+
+ private void loginNormally() {
+ // predispose based on preferences
+ String host = idropCore.getIdropConfig().getPropertyForKey(
+ IdropConfigurationService.ACCOUNT_CACHE_HOST);
+ if (host != null) {
+ txtHost.setText(host);
+ }
+ String port = idropCore.getIdropConfig().getPropertyForKey(
+ IdropConfigurationService.ACCOUNT_CACHE_PORT);
+ if (port == null || port.isEmpty()) {
+ port = "1247";
+ }
+
+ String mode = idropCore.getIdropConfig().getPropertyForKey(
+ IdropConfigurationService.ACCOUNT_CACHE_LOGIN_MODE);
+ if (mode == null || mode.isEmpty()) {
+ mode = IRODSAccount.AuthScheme.STANDARD.name();
+ } else {
+ comboLoginMode.setSelectedItem(mode);
+ }
+
+ String proxy = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_PROXY_LOCATION);
+
+ if (proxy != null) {
+ txtProxy.setText(proxy);
+ }
+
+ String certificates = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_CERTIFICATES_LOCATION);
+
+ if (certificates != null) {
+ txtCerts.setText(certificates);
+ }
+
+ // Read paths from propeties: PEM certificate, PEM key, p12 certificate
+ String pemcert = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_CERT_PEM_LOCATION);
+ if (pemcert != null) {
+ txtPEMCertificateLocation.setText(pemcert);
+
+ }
+ String p12cert = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_CERT_P12_LOCATION);
+ if (p12cert != null) {
+ txtP12CertificateLocation.setText(p12cert);
+ }
+
+ String keyLoc = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_KEY_PEM_LOCATION);
+ if (keyLoc != null) {
+ txtKeyLocation.setText(keyLoc);
+ }
+ // Read gsi mode from properties (p12, PEM, browser, proxy file)
+ String certMode = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_CERT_LOGIN_MODE);
+ try {
+ int certModeNum = Integer.parseInt(certMode);
+ setSelectedModeFields(certModeNum);
+ } catch (Exception ex) {
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.WARNING, null, ex);
+ }
+ //
+ txtPort.setText(port);
+ String zone = idropCore.getIdropConfig().getPropertyForKey(
+ IdropConfigurationService.ACCOUNT_CACHE_ZONE);
+ txtZone.setText(zone);
+ String resource = idropCore.getIdropConfig().getPropertyForKey(
+ IdropConfigurationService.ACCOUNT_CACHE_RESOURCE);
+ txtResource.setText(resource);
+ String username = idropCore.getIdropConfig().getPropertyForKey(
+ IdropConfigurationService.ACCOUNT_CACHE_USER_NAME);
+ txtUserName.setText(username);
+
+
+ String save = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_USER_SAVE_PASS);
+ boolean saveP = "true".equals(save);
+ if (saveP) {
+ String savedPassword = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_USER_PASSWORD);
+ password.setText(savedPassword);
+ chkRememberPass.setSelected(true);
+
+ String gsi = idropCore.getIdropConfig().getPropertyForKey(IdropConfigurationService.ACCOUNT_CACHE_USER_AUTO_GSI);
+ boolean autoGsi = "true".equals(gsi);
+ chkProxyLogin.setSelected(autoGsi);
+
+ loginTrialSuccesful = !processLogin();
+ }
+
+ hideAdvancedViewFields();
+ hideProxyLoginFields();
+ showProxyChoosenModeFields();
+ if(getSelectedModeFieldNum() != -1){
+ hideNormalLoginFields();
+ showProxyLoginFields();
+ }
+ }
+
+ private void loginUsingPreset() {
+ log.debug("login will use presets");
+ lblHost.setVisible(false);
+ txtHost.setVisible(false);
+ lblPort.setVisible(false);
+ txtPort.setVisible(false);
+ lblZone.setVisible(false);
+ txtZone.setVisible(false);
+ lblResource.setVisible(false);
+ txtResource.setVisible(false);
+ chkAdvancedLogin.setVisible(false);
+ lblLoginMode.setVisible(false);
+ comboLoginMode.setVisible(false);
+ }
+
+ /**
+ * Action to take when login is initiated
+ *
+ * @return
+ * @throws NumberFormatException
+ */
+ private boolean processLogin() throws NumberFormatException {
+ // validate various inputs based on whether a full login, or a uid only
+ // login is indicated
+ if (!idropCore.getIdropConfig().isLoginPreset()) {
+ txtHost.setBackground(Color.white);
+ txtPort.setBackground(Color.white);
+ txtZone.setBackground(Color.white);
+ txtResource.setBackground(Color.white);
+ if (txtHost.getText().length() == 0) {
+ txtHost.setBackground(Color.red);
+ }
+ if (txtPort.getText().length() == 0) {
+ txtPort.setBackground(Color.red);
+ } else {
+ try {
+ Integer.parseInt(txtPort.getText());
+ } catch (Exception e) {
+ txtPort.setBackground(Color.red);
}
+ }
+ if (txtZone.getText().length() == 0) {
+ txtZone.setBackground(Color.red);
+ }
+ if (txtResource.getText().length() == 0) {
+ txtResource.setBackground(Color.red);
+ }
+ }
+
+ txtUserName.setBackground(Color.white);
+ password.setBackground(Color.white);
+ if (txtUserName.getText().length() == 0) {
+ txtUserName.setBackground(Color.red);
+ }
+ if (password.getPassword().length == 0) {
+ password.setBackground(Color.red);
+ }
+ StringBuilder sb = new StringBuilder();
+ final IRODSAccount irodsAccount;
+
+ try {
+
+ // validated, now try to log in
+ if (idropCore.getIdropConfig().isLoginPreset()) {
+ log.debug("creating account with presets");
+ String presetHost = idropCore.getIdropConfig()
+ .getPropertyForKey(
+ IdropPropertiesHelper.LOGIN_PRESET_HOST);
+ log.info("presetHost:{}", presetHost);
+ int presetPort = Integer.parseInt(idropCore.getIdropConfig()
+ .getPropertyForKey(
+ IdropPropertiesHelper.LOGIN_PRESET_PORT));
+ log.info("presetPort:{}", presetPort);
+ String presetZone = idropCore.getIdropConfig()
+ .getPropertyForKey(
+ IdropPropertiesHelper.LOGIN_PRESET_ZONE);
+ log.info("presetZone:{}", presetZone);
+ String presetResource = idropCore.getIdropConfig()
+ .getPropertyForKey(
+ IdropPropertiesHelper.LOGIN_PRESET_RESOURCE);
+ log.info("presetResource:{}", presetResource);
+ sb.append('/');
+ sb.append(presetZone);
+ sb.append("/home/");
+ sb.append(txtUserName.getText());
+
+ if (chkGuestLogin.isSelected()) {
+ irodsAccount = IRODSAccount.instanceForAnonymous(
+ presetHost, presetPort, "", presetZone,
+ presetResource);
+ } else if (chkProxyLogin.isSelected()) {
+
+ GSSCredential gssCred = getGssCredential();
+
+ GSIIRODSAccount acc = GSIIRODSAccount.instance(presetHost, presetPort, gssCred, presetResource);
+ acc.setCertificateAuthority(txtCerts.getText());
+ irodsAccount = acc;
+ } else {
+ irodsAccount = IRODSAccount.instance(presetHost,
+ presetPort, txtUserName.getText(), new String(
+ password.getPassword()), sb.toString(),
+ presetZone, presetResource);
+ }
+ } else {
+ sb.append('/');
+ sb.append(txtZone.getText());
+ sb.append("/home/");
+ sb.append(txtUserName.getText());
+
+ if (chkGuestLogin.isSelected()) {
+ irodsAccount = IRODSAccount.instanceForAnonymous(txtHost
+ .getText().trim(), Integer.parseInt(txtPort
+ .getText().trim()), "", txtZone.getText().trim(),
+ txtResource.getText().trim());
+ } else if (chkProxyLogin.isSelected()) {
+ // TODO
+ GSSCredential gssCred = getGssCredential();
+
+
+ GSIIRODSAccount acc = GSIIRODSAccount.instance(
+ txtHost.getText().trim(),
+ Integer.parseInt(txtPort.getText().trim()), gssCred, txtResource.getText().trim());
+ acc.setCertificateAuthority(txtCerts.getText().trim());
+ irodsAccount = acc;
+
+ } else {
+ irodsAccount = IRODSAccount.instance(txtHost.getText()
+ .trim(),
+ Integer.parseInt(txtPort.getText().trim()),
+ txtUserName.getText().trim(),
+ new String(password.getPassword()).trim(), sb
+ .toString().trim(), txtZone.getText()
+ .trim(), txtResource.getText().trim());
+ }
+ }
+ } catch (JargonException ex) {
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
+ null, ex);
+ MessageManager.showError(this, ex.getMessage(),
+ MessageManager.TITLE_MESSAGE);
+ return true;
+ } catch (GlobusCredentialException ex) {
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, null, ex);
+ MessageManager.showError(this, ex.getMessage(), MessageManager.TITLE_MESSAGE);
+ return true;
+ } catch (GSSException ex) {
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, null, ex);
+ MessageManager.showError(this, ex.getMessage(), MessageManager.TITLE_MESSAGE);
+ return true;
+ } catch (GssSecurityException ex) {//?
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE, null, ex);
+ MessageManager.showError(this,
+ "Wrong certifcate, key, password or proxy.",
+ "Login Error");
+ return true;
+ }
+
+ if (comboLoginMode.getSelectedItem().toString()
+ .equals(IRODSAccount.AuthScheme.PAM.name())) {
+ irodsAccount.setAuthenticationScheme(IRODSAccount.AuthScheme.PAM);
+ }
+
+ IRODSFileSystem irodsFileSystem = null;
+
+ /*
+ * getting userAO will attempt the login
+ */
- if (comboLoginMode.getSelectedItem().toString()
- .equals(IRODSAccount.AuthScheme.PAM.name())) {
- irodsAccount.setAuthenticationScheme(IRODSAccount.AuthScheme.PAM);
- }
-
- IRODSFileSystem irodsFileSystem = null;
-
- /*
- * getting userAO will attempt the login
- */
-
- try {
- irodsFileSystem = idropCore.getIrodsFileSystem();
- AuthResponse authResponse = irodsFileSystem
- .getIRODSAccessObjectFactory().authenticateIRODSAccount(
- irodsAccount);
- idropCore.setIrodsAccount(authResponse
- .getAuthenticatedIRODSAccount());
- try {
- idropCore.getIdropConfigurationService()
-
- .saveLogin(irodsAccount, chkRememberPass.isSelected());
-
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_PROXY_LOCATION, txtProxy.getText());
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_CERTIFICATES_LOCATION, txtCerts.getText());
-
- if(chkProxyLogin.isSelected()){
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_USER_AUTO_GSI,"true");
- }else{
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_USER_AUTO_GSI,"false");
- }
-
- // Save in properties: paths to certificates, key and gsi mode
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_CERT_PEM_LOCATION, txtPEMCertificateLocation.getText());
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_KEY_PEM_LOCATION, txtKeyLocation.getText());
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_CERT_P12_LOCATION, txtP12CertificateLocation.getText());
- idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_CERT_LOGIN_MODE, ""+getSelectedModeFieldNum());
-
- //todo save proxy path and certificates location
-
- } catch (IdropException ex) {
- throw new IdropRuntimeException("error saving irodsAccount", ex);
- }
- dispose();
- } catch (JargonException ex) {
- if (ex.getMessage().indexOf("Connection refused") > -1) {
- Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
- null, ex);
- MessageManager.showError(this,
- "Cannot connect to the server, is it down?",
- "Login Error");
-
- return true;
- } else if (ex.getMessage().indexOf("Connection reset") > -1) {
- Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
- null, ex);
- MessageManager.showError(this,
- "Cannot connect to the server, is it down?",
- "Login Error");
-
- return true;
- } else if (ex.getMessage().indexOf("io exception opening socket") > -1) {
- Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
- null, ex);
- MessageManager.showError(this,
- "Cannot connect to the server, is it down?",
- "Login Error");
-
- return true;
- } else {
- Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
- null, ex);
- MessageManager.showError(this,
- "login error - unable to log in, or invalid user id",
- "Login Error");
-
- return true;
- }
- } finally {
- if (irodsFileSystem != null) {
- irodsFileSystem.closeAndEatExceptions();
- }
- }
- return false;
- }
-
- /**
- * Register a listener for the enter event, so login can occur.
- */
- private void registerKeystrokeListener() {
-
- KeyStroke enter = KeyStroke.getKeyStroke(
- java.awt.event.KeyEvent.VK_ENTER, 0);
- Action enterAction = new AbstractAction() {
- /**
- *
- */
- private static final long serialVersionUID = 3468144821565093455L;
-
- @Override
- public void actionPerformed(final ActionEvent e) {
- processLogin();
- }
- };
- btnOK.registerKeyboardAction(enterAction, enter,
- JComponent.WHEN_IN_FOCUSED_WINDOW);
-
- }
-
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
-
- // <editor-fold defaultstate="collapsed"
- // <editor-fold defaultstate="collapsed"
+ try {
+ irodsFileSystem = idropCore.getIrodsFileSystem();
+ AuthResponse authResponse = irodsFileSystem
+ .getIRODSAccessObjectFactory().authenticateIRODSAccount(
+ irodsAccount);
+ idropCore.setIrodsAccount(authResponse
+ .getAuthenticatedIRODSAccount());
+ try {
+ idropCore.getIdropConfigurationService()
+ .saveLogin(irodsAccount, chkRememberPass.isSelected());
+
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_PROXY_LOCATION, txtProxy.getText());
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_CERTIFICATES_LOCATION, txtCerts.getText());
+
+ if (chkProxyLogin.isSelected()) {
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_USER_AUTO_GSI, "true");
+ } else {
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_USER_AUTO_GSI, "false");
+ }
+
+ // Save in properties: paths to certificates, key and gsi mode
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_CERT_PEM_LOCATION, txtPEMCertificateLocation.getText());
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_KEY_PEM_LOCATION, txtKeyLocation.getText());
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_CERT_P12_LOCATION, txtP12CertificateLocation.getText());
+ idropCore.getIdropConfigurationService().updateConfig(IdropConfigurationService.ACCOUNT_CACHE_CERT_LOGIN_MODE, "" + getSelectedModeFieldNum());
+
+ //todo save proxy path and certificates location
+
+ } catch (IdropException ex) {
+ throw new IdropRuntimeException("error saving irodsAccount", ex);
+ }
+ dispose();
+ } catch (JargonException ex) {
+ if (ex.getMessage().indexOf("Connection refused") > -1) {
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
+ null, ex);
+ MessageManager.showError(this,
+ "Cannot connect to the server, is it down?",
+ "Login Error");
+
+ return true;
+ } else if (ex.getMessage().indexOf("Connection reset") > -1) {
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
+ null, ex);
+ MessageManager.showError(this,
+ "Cannot connect to the server, is it down?",
+ "Login Error");
+
+ return true;
+ } else if (ex.getMessage().indexOf("io exception opening socket") > -1) {
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
+ null, ex);
+ MessageManager.showError(this,
+ "Cannot connect to the server, is it down?",
+ "Login Error");
+
+ return true;
+ } else {
+ Logger.getLogger(LoginDialog.class.getName()).log(Level.SEVERE,
+ null, ex);
+ MessageManager.showError(this,
+ "login error - unable to log in, or invalid user id",
+ "Login Error");
+
+ return true;
+ }
+ } finally {
+ if (irodsFileSystem != null) {
+ irodsFileSystem.closeAndEatExceptions();
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Register a listener for the enter event, so login can occur.
+ */
+ private void registerKeystrokeListener() {
+
+ KeyStroke enter = KeyStroke.getKeyStroke(
+ java.awt.event.KeyEvent.VK_ENTER, 0);
+ Action enterAction = new AbstractAction() {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 3468144821565093455L;
+
+ @Override
+ public void actionPerformed(final ActionEvent e) {
+ processLogin();
+ }
+ };
+ btnOK.registerKeyboardAction(enterAction, enter,
+ JComponent.WHEN_IN_FOCUSED_WINDOW);
+
+ }
+
+ /**
+ * This method is called from within the constructor to initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is always
+ * regenerated by the Form Editor.
+ */
+ // <editor-fold defaultstate="collapsed"
+ // <editor-fold defaultstate="collapsed"
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
java.awt.GridBagConstraints gridBagConstraints;
@@ -475,7 +476,7 @@ public class LoginDialog extends JDialog {
txtCerts = new javax.swing.JTextField();
btnProxy = new javax.swing.JButton();
btnCerts = new javax.swing.JButton();
- lblCertMpde = new javax.swing.JLabel();
+ lblCertMode = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
btnProxyCertKeyPair = new javax.swing.JRadioButton();
btnProxyP12 = new javax.swing.JRadioButton();
@@ -701,10 +702,10 @@ public class LoginDialog extends JDialog {
gridBagConstraints.gridy = 11;
pnlLoginInfo.add(btnCerts, gridBagConstraints);
- lblCertMpde.setText("Certificate mode:");
+ lblCertMode.setText("Certificate mode:");
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
- pnlLoginInfo.add(lblCertMpde, gridBagConstraints);
+ pnlLoginInfo.add(lblCertMode, gridBagConstraints);
btngrpProxySource.add(btnProxyCertKeyPair);
btnProxyCertKeyPair.setText("cert/key pair");
@@ -836,7 +837,6 @@ public class LoginDialog extends JDialog {
gridBagConstraints.gridy = 13;
gridBagConstraints.anchor = java.awt.GridBagConstraints.LINE_END;
pnlLoginInfo.add(lbllBrowserCombo, gridBagConstraints);
- lbllBrowserCombo.getAccessibleContext().setAccessibleName("Selected browser:");
browserpass.setColumns(30);
browserpass.setPreferredSize(null);
@@ -942,17 +942,17 @@ public class LoginDialog extends JDialog {
}//GEN-LAST:event_chkRememberPassActionPerformed
private void chkProxyLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_chkProxyLoginActionPerformed
- if(chkProxyLogin.isSelected()){
+ if (chkProxyLogin.isSelected()) {
chkGuestLogin.setSelected(false);
//hide username/pass
hideForGuestLogin();
- showProxyLoginFields();
+ showProxyLoginFields();
//Shows proper fields for choosen gsi mode (p12/pem/browser/proxy file)
showProxyChoosenModeFields();
- }else{
+ } else {
//show username/password
showWhenGuestLogin();
- hideProxyLoginFields();
+ hideProxyLoginFields();
}
}//GEN-LAST:event_chkProxyLoginActionPerformed
@@ -960,11 +960,11 @@ public class LoginDialog extends JDialog {
final JFileChooser chooser = new JFileChooser();
chooser.setFileHidingEnabled(false);
int res = chooser.showOpenDialog(this);
- if(res == JFileChooser.APPROVE_OPTION){
- if(chooser.getSelectedFile().canRead()){
+ if (res == JFileChooser.APPROVE_OPTION) {
+ if (chooser.getSelectedFile().canRead()) {
txtProxy.setText(chooser.getSelectedFile().getAbsolutePath());
}
- }
+ }
}//GEN-LAST:event_btnProxyActionPerformed
private void btnCertsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCertsActionPerformed
@@ -972,27 +972,27 @@ public class LoginDialog extends JDialog {
chooser.setFileHidingEnabled(false);
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int res = chooser.showOpenDialog(this);
- if(res == JFileChooser.APPROVE_OPTION){
+ if (res == JFileChooser.APPROVE_OPTION) {
txtCerts.setText(chooser.getSelectedFile().getAbsolutePath());
- }
+ }
}//GEN-LAST:event_btnCertsActionPerformed
private void btnKeyLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnKeyLocationActionPerformed
- //get path of key file when using PEM pair to authenticate user
+ //get path of key file when using PEM pair to authenticate user
final JFileChooser chooser = new JFileChooser();
int res = chooser.showOpenDialog(this);
- if(res == JFileChooser.APPROVE_OPTION){
+ if (res == JFileChooser.APPROVE_OPTION) {
txtKeyLocation.setText(chooser.getSelectedFile().getAbsolutePath());
- }
+ }
}//GEN-LAST:event_btnKeyLocationActionPerformed
private void btnP12CertificateLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnP12CertificateLocationActionPerformed
- //get path of certificate file when using p12 certificate to authenticate user
+ //get path of certificate file when using p12 certificate to authenticate user
final JFileChooser chooser = new JFileChooser();
int res = chooser.showOpenDialog(this);
- if(res == JFileChooser.APPROVE_OPTION){
+ if (res == JFileChooser.APPROVE_OPTION) {
txtP12CertificateLocation.setText(chooser.getSelectedFile().getAbsolutePath());
- }
+ }
}//GEN-LAST:event_btnP12CertificateLocationActionPerformed
private void btnProxyCertKeyPairActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnProxyCertKeyPairActionPerformed
@@ -1029,60 +1029,58 @@ public class LoginDialog extends JDialog {
}//GEN-LAST:event_btnProxyFileActionPerformed
private void btnPEMCertificateLocationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnPEMCertificateLocationActionPerformed
- //get path of certificate file when using PEM pair to authenticate user
+ //get path of certificate file when using PEM pair to authenticate user
final JFileChooser chooser = new JFileChooser();
int res = chooser.showOpenDialog(this);
- if(res == JFileChooser.APPROVE_OPTION){
+ if (res == JFileChooser.APPROVE_OPTION) {
txtPEMCertificateLocation.setText(chooser.getSelectedFile().getAbsolutePath());
- }
+ }
}//GEN-LAST:event_btnPEMCertificateLocationActionPerformed
private void cmbBrowsersActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbBrowsersActionPerformed
-
}//GEN-LAST:event_cmbBrowsersActionPerformed
private void cmbCertificatesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbCertificatesActionPerformed
-
}//GEN-LAST:event_cmbCertificatesActionPerformed
private void btnCheckCertsInBrowserActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCheckCertsInBrowserActionPerformed
- //fill proper combobox with certificates' list derived from selected browser
- String choosenBrowser = (String)cmbBrowsers.getSelectedItem();
- if(choosenBrowser != null){
+ //fill proper combobox with certificates' list derived from selected browser
+ String choosenBrowser = (String) cmbBrowsers.getSelectedItem();
+ if (choosenBrowser != null) {
setSelectedBrowser(choosenBrowser);
fillCertificateComboBox();
}
}//GEN-LAST:event_btnCheckCertsInBrowserActionPerformed
- private void chkAdvancedLoginActionPerformed(
- final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_chkAdvancedLoginActionPerformed
- // TODO add your handling code here:
- if (chkAdvancedLogin.isSelected()) {
- showAdvancedViewFields();
- } else {
- hideAdvancedViewFields();
- }
- }// GEN-LAST:event_chkAdvancedLoginActionPerformed
-
- private void chkGuestLoginActionPerformed(
- final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_chkGuestLoginActionPerformed
- if (chkGuestLogin.isSelected()) {
- chkProxyLogin.setSelected(false);
- hideProxyLoginFields();
- hideForGuestLogin();
-
- } else {
- showWhenGuestLogin();
- }
- }// GEN-LAST:event_chkGuestLoginActionPerformed
-
- private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed
- processLogin();
- }// GEN-LAST:event_btnOKActionPerformed
-
- private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed
- dispose();
- }// GEN-LAST:event_btnCancelActionPerformed
+ private void chkAdvancedLoginActionPerformed(
+ final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_chkAdvancedLoginActionPerformed
+ // TODO add your handling code here:
+ if (chkAdvancedLogin.isSelected()) {
+ showAdvancedViewFields();
+ } else {
+ hideAdvancedViewFields();
+ }
+ }// GEN-LAST:event_chkAdvancedLoginActionPerformed
+
+ private void chkGuestLoginActionPerformed(
+ final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_chkGuestLoginActionPerformed
+ if (chkGuestLogin.isSelected()) {
+ chkProxyLogin.setSelected(false);
+ hideProxyLoginFields();
+ hideForGuestLogin();
+
+ } else {
+ showWhenGuestLogin();
+ }
+ }// GEN-LAST:event_chkGuestLoginActionPerformed
+
+ private void btnOKActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnOKActionPerformed
+ processLogin();
+ }// GEN-LAST:event_btnOKActionPerformed
+
+ private void btnCancelActionPerformed(final java.awt.event.ActionEvent evt) {// GEN-FIRST:event_btnCancelActionPerformed
+ dispose();
+ }// GEN-LAST:event_btnCancelActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPasswordField browserpass;
private javax.swing.JButton btnCancel;
@@ -1109,7 +1107,7 @@ public class LoginDialog extends JDialog {
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JLabel lblBrowserPass;
- private javax.swing.JLabel lblCertMpde;
+ private javax.swing.JLabel lblCertMode;
private javax.swing.JLabel lblCertPass;
private javax.swing.JLabel lblCerts;
private javax.swing.JLabel lblHost;
@@ -1141,86 +1139,97 @@ public class LoginDialog extends JDialog {
private javax.swing.JTextField txtZone;
// End of variables declaration//GEN-END:variables
- private void showAdvancedViewFields() {
- lblHost.setVisible(true);
- txtHost.setVisible(true);
- lblZone.setVisible(true);
- txtZone.setVisible(true);
- txtResource.setVisible(true);
- txtPort.setVisible(true);
- lblPort.setVisible(true);
- lblResource.setVisible(true);
-
- lblCerts.setVisible(true);
- txtCerts.setVisible(true);
- btnCerts.setVisible(true);
- }
-
- private void hideAdvancedViewFields() {
- lblHost.setVisible(false);
- txtHost.setVisible(false);
- lblZone.setVisible(false);
- txtZone.setVisible(false);
- txtResource.setVisible(false);
- txtPort.setVisible(false);
- lblPort.setVisible(false);
- lblResource.setVisible(false);
-
- lblCerts.setVisible(false);
- txtCerts.setVisible(false);
- btnCerts.setVisible(false);
- }
-
- private void hideForGuestLogin() {
- lblUserName.setVisible(false);
- txtUserName.setVisible(false);
- lblPassword.setVisible(false);
- password.setVisible(false);
- lblLoginMode.setVisible(false);
- comboLoginMode.setVisible(false);
- }
-
- private void showWhenGuestLogin() {
- lblUserName.setVisible(true);
- txtUserName.setVisible(true);
- lblPassword.setVisible(true);
- password.setVisible(true);
- }
-
- private void showProxyLoginFields(){
+ private void hideNormalLoginFields(){
+ password.setVisible(false);
+ lblPassword.setVisible(false);
+ txtUserName.setVisible(false);
+ lblUserName.setVisible(false);
+ }
+
+ private void showAdvancedViewFields() {
+ lblHost.setVisible(true);
+ txtHost.setVisible(true);
+ lblZone.setVisible(true);
+ txtZone.setVisible(true);
+ txtResource.setVisible(true);
+ txtPort.setVisible(true);
+ lblPort.setVisible(true);
+ lblResource.setVisible(true);
+
+ lblCerts.setVisible(true);
+ txtCerts.setVisible(true);
+ btnCerts.setVisible(true);
+ }
+
+ private void hideAdvancedViewFields() {
+ lblHost.setVisible(false);
+ txtHost.setVisible(false);
+ lblZone.setVisible(false);
+ txtZone.setVisible(false);
+ txtResource.setVisible(false);
+ txtPort.setVisible(false);
+ lblPort.setVisible(false);
+ lblResource.setVisible(false);
+
+ lblCerts.setVisible(false);
+ txtCerts.setVisible(false);
+ btnCerts.setVisible(false);
+ }
+
+ private void hideForGuestLogin() {
+ lblUserName.setVisible(false);
+ txtUserName.setVisible(false);
+ lblPassword.setVisible(false);
+ password.setVisible(false);
+ lblLoginMode.setVisible(false);
+ comboLoginMode.setVisible(false);
+ }
+
+ private void showWhenGuestLogin() {
+ lblUserName.setVisible(true);
+ txtUserName.setVisible(true);
+ lblPassword.setVisible(true);
+ password.setVisible(true);
+ lblLoginMode.setVisible(true);//symetric
+ comboLoginMode.setVisible(true);
+ }
+
+ private void showProxyLoginFields() {
//show buttngroup to let user choose a way to authenticate
btnProxyBrowser.setVisible(true);
btnProxyCertKeyPair.setVisible(true);
btnProxyFile.setVisible(true);
btnProxyP12.setVisible(true);
- lblCertMpde.setVisible(true);
+ lblCertMode.setVisible(true);
}
- private void hideProxyLoginFields(){
+ private void hideProxyLoginFields() {
btnProxyBrowser.setVisible(false);
btnProxyCertKeyPair.setVisible(false);
btnProxyFile.setVisible(false);
btnProxyP12.setVisible(false);
- lblCertMpde.setVisible(false);
+ lblCertMode.setVisible(false);
hideCertKeyPairFields();
hideCertP12Fields();
hideCertInBrowserFields();
hideProxyFileFields();
- lblPassword.setVisible(true);
- password.setVisible(true);
+ // lblPassword.setVisible(true);
+ // password.setVisible(true);
}
- private void hideCertKeyPairFields(){
+
+ private void hideCertKeyPairFields() {
lblPEMCertificateLocation.setVisible(false);
txtPEMCertificateLocation.setVisible(false);
btnPEMCertificateLocation.setVisible(false);
lblKeyLocation.setVisible(false);
txtKeyLocation.setVisible(false);
- btnKeyLocation.setVisible(false);
+ btnKeyLocation.setVisible(false);
lblCertPass.setVisible(false);
certpass.setVisible(false);
}
- private void showCertKeyPairFields(){
+
+ private void showCertKeyPairFields() {
lblPEMCertificateLocation.setVisible(true);
txtPEMCertificateLocation.setVisible(true);
btnPEMCertificateLocation.setVisible(true);
@@ -1230,21 +1239,24 @@ public class LoginDialog extends JDialog {
lblCertPass.setVisible(true);
certpass.setVisible(true);
}
- private void hideCertP12Fields(){
+
+ private void hideCertP12Fields() {
lblP12CertificateLocation.setVisible(false);
txtP12CertificateLocation.setVisible(false);
btnP12CertificateLocation.setVisible(false);
lblCertPass.setVisible(false);
certpass.setVisible(false);
}
- private void showCertP12Fields(){
+
+ private void showCertP12Fields() {
lblP12CertificateLocation.setVisible(true);
txtP12CertificateLocation.setVisible(true);
btnP12CertificateLocation.setVisible(true);
lblCertPass.setVisible(true);
certpass.setVisible(true);
}
- private void hideCertInBrowserFields(){
+
+ private void hideCertInBrowserFields() {
lblBrowserPass.setVisible(false);
browserpass.setVisible(false);
lbllBrowserCombo.setVisible(false);
@@ -1255,97 +1267,108 @@ public class LoginDialog extends JDialog {
cmbCertificates.removeAllItems();
cmbBrowsers.removeAllItems();
}
- private void showCertInBrowserFields(){
+
+ private void showCertInBrowserFields() {
lblBrowserPass.setVisible(true);
browserpass.setVisible(true);
lbllBrowserCombo.setVisible(true);
- cmbBrowsers.setVisible(true);
+ cmbBrowsers.setVisible(true);
lbllCertCombo.setVisible(true);
cmbCertificates.setVisible(true);
btnCheckCertsInBrowser.setVisible(true);
cmbCertificates.removeAllItems();
cmbBrowsers.removeAllItems();
}
- private void hideProxyFileFields(){
+
+ private void hideProxyFileFields() {
lblProxy.setVisible(false);
txtProxy.setVisible(false);
btnProxy.setVisible(false);
}
- private void showProxyFileFields(){
+
+ private void showProxyFileFields() {
lblProxy.setVisible(true);
txtProxy.setVisible(true);
btnProxy.setVisible(true);
}
-/*
- * Set selected the proper radiobutton depending the number of mode
- * used while reading from properties
- */
+ /*
+ * Set selected the proper radiobutton depending the number of mode
+ * used while reading from properties
+ */
+
private void setSelectedModeFields(int num) {
- switch(num){
+ switch (num) {
case PEM_MODE:
btnProxyCertKeyPair.setSelected(true);
- break;
+ break;
case P12_MODE:
btnProxyP12.setSelected(true);
- break;
+ break;
case BROWSER_MODE:
- btnProxyBrowser.setSelected(true);
- break;
+ btnProxyBrowser.setSelected(true);
+ break;
case PROXY_MODE:
btnProxyFile.setSelected(true);
- break;
+ break;
}
}
+
private int getSelectedModeFieldNum() {
- if(btnProxyCertKeyPair.isSelected())
+ if (btnProxyCertKeyPair.isSelected()) {
return PEM_MODE;
- if(btnProxyP12.isSelected())
+ }
+ if (btnProxyP12.isSelected()) {
return P12_MODE;
- if(btnProxyBrowser.isSelected())
+ }
+ if (btnProxyBrowser.isSelected()) {
return BROWSER_MODE;
- if(btnProxyFile.isSelected())
+ }
+ if (btnProxyFile.isSelected()) {
return PROXY_MODE;
- return PROXY_MODE; //old option used as default
+ }
+ return -1; //old option used as default
}
+
private void showProxyChoosenModeFields() {
- if(btnProxyCertKeyPair.isSelected()){
+ if (btnProxyCertKeyPair.isSelected()) {
showCertKeyPairFields();
- }else if(btnProxyP12.isSelected()){
+ } else if (btnProxyP12.isSelected()) {
showCertP12Fields();
- }else if(btnProxyBrowser.isSelected()){
+ } else if (btnProxyBrowser.isSelected()) {
showCertInBrowserFields();
- }else if(btnProxyFile.isSelected()){
+ } else if (btnProxyFile.isSelected()) {
showProxyFileFields();
- }
+ }
}
/*
- * Creates a GSSCredential form diferent data: proxy file, p12, pem form file system or browser
- * Proxy type as default in grid-proxy-init (GSIConstants.GSI_3_IMPERSONATION_PROXY).
- */
- private GSSCredential getGssCredential() throws GlobusCredentialException, GSSException {
+ * Creates a GSSCredential form diferent data: proxy file, p12, pem form file system or browser
+ * Proxy type as default in grid-proxy-init (GSIConstants.GSI_3_IMPERSONATION_PROXY).
+ */
+
+ private GSSCredential getGssCredential() throws GlobusCredentialException, GSSException {
// should it be possinble to change by user?
int proxyLifetimeSeconds = 1000;
- if(btnProxyFile.isSelected()){
+ if (btnProxyFile.isSelected()) {
//a it was previously
String proxyFilePath = txtProxy.getText();
- GlobusCredential globusCred = new GlobusCredential(proxyFilePath);
- return new GlobusGSSCredentialImpl(globusCred, GSSCredential.INITIATE_AND_ACCEPT);
- }else if(btnProxyCertKeyPair.isSelected()){
+ GlobusCredential globusCred = new GlobusCredential(proxyFilePath);
+ return new GlobusGSSCredentialImpl(globusCred, GSSCredential.INITIATE_AND_ACCEPT);
+ } else if (btnProxyCertKeyPair.isSelected()) {
String pemCert = txtPEMCertificateLocation.getText();
- String pemKey = txtKeyLocation.getText();
- return GssUtil.createCredentialFromCertKeyPassTime(pemCert, pemKey, certpass.getText(), proxyLifetimeSeconds, GSIConstants.GSI_3_IMPERSONATION_PROXY);
- }else if(btnProxyP12.isSelected()){
+ String pemKey = txtKeyLocation.getText();
+ return GssUtil.createCredentialFromCertKeyPassTime(pemCert, pemKey, certpass.getText(), proxyLifetimeSeconds, GSIConstants.GSI_3_IMPERSONATION_PROXY);
+ } else if (btnProxyP12.isSelected()) {
String p12Cert = txtP12CertificateLocation.getText();
//convert p12 to pem pair
- String certPath = System.getProperty("user.home") + File.separator + ".idrop" + File.separator + "usercert.pem";
- String keyPath = System.getProperty("user.home") + File.separator + ".idrop" + File.separator + "userkey.pem";
- try {
+ String certPath = System.getProperty("user.home") + File.separator + ".idrop" + File.separator + "usercert.pem";
+ String keyPath = System.getProperty("user.home") + File.separator + ".idrop" + File.separator + "userkey.pem";
+ try {
CertificateConverter.PKCS12ToPem(p12Cert, certpass.getText());
} catch (Exception ex) {
- log.error("Error during certificate conversion." + ex.getMessage());
+ log.error("Error during certificate conversion." + ex.getMessage());
}
return GssUtil.createCredentialFromCertKeyPassTime(certPath, keyPath, certpass.getText(), proxyLifetimeSeconds, GSIConstants.GSI_3_IMPERSONATION_PROXY);
- }else if(btnProxyBrowser.isSelected()){
+ } else if (btnProxyBrowser.isSelected()) {
String dn = (String) cmbCertificates.getSelectedItem();
X509Certificate browserCert = getSelectedCertificateFromBrowser(dn);
PrivateKey browserKey = getSelectedKeyFromBrowser(dn);
@@ -1354,41 +1377,46 @@ public class LoginDialog extends JDialog {
}
return null;
}
-/*
- * WARNING:
- * - partly untested code below
- * - code based on correct function actionPerformed from CertificateManager.java in Certman project
- *
- * - to install requred jar file in yout local maven repo please excute:
- * mvn install:install-file -Dfile=<your location of this jar>/libbrowser.jar -DgroupId=vine_certman -DartifactId=libbrowser -Dversion=1 -Dpackaging=jar -e
- *
- * It is necessary due to he fact, that this jar is unreachable in main maven repo
- */
- private void fillBrowserComboBox(){
+ /*
+ * WARNING:
+ * - partly untested code below
+ * - code based on correct function actionPerformed from CertificateManager.java in Certman project
+ *
+ * - to install requred jar file in yout local maven repo please excute:
+ * mvn install:install-file -Dfile=<your location of this jar>/libbrowser.jar -DgroupId=vine_certman -DartifactId=libbrowser -Dversion=1 -Dpackaging=jar -e
+ *
+ * It is necessary due to he fact, that this jar is unreachable in main maven repo
+ */
+
+ private void fillBrowserComboBox() {
cmbBrowsers.removeAllItems();
String[] browsers = getBrowsersList();
- if(browsers != null){
- for(String s : browsers){
+ if (browsers != null) {
+ for (String s : browsers) {
cmbBrowsers.addItem(s);
- }
+ }
}
}
- private void fillCertificateComboBox(){
+
+ private void fillCertificateComboBox() {
cmbCertificates.removeAllItems();
String[] certs = getCertifiatesInBrowserList();
- if(certs != null){
- for(String s : certs){
+ if (certs != null) {
+ for (String s : certs) {
cmbCertificates.addItem(s);
- }
+ }
}
}
/*
* Class needed by Browser class used by code based on certman
*/
+
private static class PasswordPrompt implements Browser.PasswordCallback {
+
public char[] prompt(String promptString) {
return dialog.browserpass.getPassword();
}
+
public PasswordPrompt(LoginDialog tmp) {
this.dialog = tmp;
}
@@ -1398,8 +1426,9 @@ public class LoginDialog extends JDialog {
/*
* Gets the list of browsers.
*/
- private String[] getBrowsersList(){
- //Browser.getCurrentBrowser();
+
+ private String[] getBrowsersList() {
+ //Browser.getCurrentBrowser();
String profiles[] = null;
if (profile == null) {
profiles = new String[0];
@@ -1407,12 +1436,12 @@ public class LoginDialog extends JDialog {
profiles = Browser.getBrowserList();
} catch (IOException e) {
log.debug("Could not find any recognized browsers." + e);
- MessageManager.showError(this,"Could not find any recognized browsers.", "Browser Error");
+ MessageManager.showError(this, "Could not find any recognized browsers.", "Browser Error");
return null;
}
if (profiles.length == 0) {
log.debug("No browsers found");
- MessageManager.showError(this,"No browsers found.", "Browser Error");
+ MessageManager.showError(this, "No browsers found.", "Browser Error");
return null;
}
}
@@ -1422,12 +1451,14 @@ public class LoginDialog extends JDialog {
* Sets the selected browser, what is needed for other funkctions to know
* where to look for the certificates
*/
- private void setSelectedBrowser(String browserChoosen){
+
+ private void setSelectedBrowser(String browserChoosen) {
log.debug("Response option: " + browserChoosen);
- if (browserChoosen == null)
+ if (browserChoosen == null) {
return;
- else
- Browser.setBrowser(browserChoosen);
+ } else {
+ Browser.setBrowser(browserChoosen);
+ }
profile = Browser.getCurrentBrowser();
log.debug("Current browser profile: " + profile);
}
@@ -1435,8 +1466,9 @@ public class LoginDialog extends JDialog {
* Gets list of certificates in selected browser keystore
* Acceses selected browser keystore, uses prossword provided by user
*/
- private String[] getCertifiatesInBrowserList(){
- if(Browser.getCurrentBrowser() == null){
+
+ private String[] getCertifiatesInBrowserList() {
+ if (Browser.getCurrentBrowser() == null) {
return null;
}
String dnlist[] = null;
@@ -1449,7 +1481,7 @@ public class LoginDialog extends JDialog {
return null;
} catch (KeyStoreException e) {
log.debug("Could not access keystore in profile: " + profile + " : " + e);
- MessageManager.showError(this, "Could not access keystore in profile: " + profile, e.getLocalizedMessage());
+ MessageManager.showError(this, "Could not access keystore in profile: " + profile, e.getLocalizedMessage());
return null;
} catch (NoSuchAlgorithmException e) {
log.debug("Could not access keystore in profile: " + profile + " : " + e);
@@ -1490,9 +1522,10 @@ public class LoginDialog extends JDialog {
/*
* Gets the choosen certificate from actual browser.
*/
- private X509Certificate getSelectedCertificateFromBrowser(String dnChoosen){
+
+ private X509Certificate getSelectedCertificateFromBrowser(String dnChoosen) {
X509Certificate certificateBrowser = null;
- String browserDNChosen = dnChoosen;
+ String browserDNChosen = dnChoosen;
log.debug("Browser cert DN chosen : " + browserDNChosen);
Browser.CertInfo info = null;
try {
@@ -1508,15 +1541,16 @@ public class LoginDialog extends JDialog {
log.debug("Could not access certificate in the browser keystore in profile: " + profile + " : " + e);
MessageManager.showError(this, e.getMessage(), "Could not access certificate in the browser keystore in profile: " + profile);
return null;
- }
+ }
return certificateBrowser;
}
/*
* Gets the choosen key from actual browser.
*/
- private PrivateKey getSelectedKeyFromBrowser(String dnChoosen){
- PrivateKey browserKey = uk.ac.rl.esc.browser.IECertificateInterface.getKey(dnChoosen);
- log.debug("Browser cert key present : " + (browserKey != null));
- return browserKey;
- }
+
+ private PrivateKey getSelectedKeyFromBrowser(String dnChoosen) {
+ PrivateKey browserKey = uk.ac.rl.esc.browser.IECertificateInterface.getKey(dnChoosen);
+ log.debug("Browser cert key present : " + (browserKey != null));
+ return browserKey;
+ }
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
index e6dfe07..146ed9d 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/iDrop.java
@@ -1894,9 +1894,9 @@ public class iDrop extends javax.swing.JFrame implements ActionListener,
}//GEN-LAST:event_btnMainToolbarTreeActionPerformed
private void btnMainToolbarSettings1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMainToolbarSettings1ActionPerformed
- MetaSearch idropMetaSearch = new MetaSearch(this, true);
- idropMetaSearch.setLocationRelativeTo(null);
- idropMetaSearch.setVisible(true);
+// MetaSearch idropMetaSearch = new MetaSearch(this, true);
+// idropMetaSearch.setLocationRelativeTo(null);
+// idropMetaSearch.setVisible(true);
}//GEN-LAST:event_btnMainToolbarSettings1ActionPerformed
private void btnMainToolbarSettingsActionPerformed(
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java
index 8f9c8b2..bc3281c 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java
@@ -1,5 +1,5 @@
package org.irods.jargon.idrop.desktop.systraygui.utils;
public final class Version {
public static String VERSION="2.0.1-SNAPSHOT";
- public static String BUILD_TIME="20130813-1014";
+ public static String BUILD_TIME="20130829-1603";
}