/** * @return * the AWS Product Token provided by the user. */ public String getAWSProductToken() { return loginCredentialsPanel.getAWSProductToken().trim(); }
/** * @return * the AWS User Token provided by the user. */ public String getAWSUserToken() { return loginCredentialsPanel.getAWSUserToken().trim(); }
/** * @return * the Access Key provided by the user. */ public String getAccessKey() { return loginCredentialsPanel.getAccessKey().trim(); }
loginLocalFolderPanel.getCredentialsFile(), loginLocalFolderPanel.getPassword()); } else if (loginMode == LOGIN_MODE_DIRECT) { String[] inputErrors = loginCredentialsPanel.checkForInputErrors(); if (inputErrors.length > 0) { String errorMessages = "<html>Please correct the following errors:<ul>"; if (loginCredentialsPanel.getUsingDevPay()) { this.credentials = new AWSDevPayCredentials( loginCredentialsPanel.getAccessKey(), loginCredentialsPanel.getSecretKey(), loginCredentialsPanel.getAWSUserToken(), loginCredentialsPanel.getAWSProductToken(), loginCredentialsPanel.getFriendlyName()); } else { if (targetS3.isSelected()) { this.credentials = new AWSCredentials( loginCredentialsPanel.getAccessKey(), loginCredentialsPanel.getSecretKey(), loginCredentialsPanel.getFriendlyName()); } else { this.credentials = new GSCredentials( loginCredentialsPanel.getAccessKey(), loginCredentialsPanel.getSecretKey(), loginCredentialsPanel.getFriendlyName());
/** * Verifies that the user has provided the correct inputs, and returns a list * of error messages if not. * * @return * an empty array if there a no input errors, otherwise the array will contain * a list of error messages. */ public String[] checkForInputErrors() { ArrayList errors = new ArrayList(); if (getAccessKey().trim().length() == 0) { errors.add("Access Key must be provided"); } if (getSecretKey().trim().length() == 0) { errors.add("Secret Key must be provided"); } if (getUsingDevPay()) { if (getAWSUserToken().trim().length() == 0) { errors.add("DevPay User Token must be provided"); } if (getAWSProductToken().trim().length() == 0) { errors.add("DevPay Product Token must be provided"); } } return (String[]) errors.toArray(new String[errors.size()]); }
add(descriptionLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); if (askForFriendlyName) { friendlyNameTextField.setText("My Credentials"); add(friendlyNameLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(friendlyNameTextField, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(accessKeyLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(accessKeyTextField, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(secretKeyLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(secretKeyPasswordField, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(useDevPayCheckBox, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(awsUserTokenLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(awsUserTokenTextField, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(awsProductPanel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); add(new JLabel(), new GridBagConstraints(0, row++,
this.loginCredentialsPanel = new LoginCredentialsPanel(askForFriendlyName, hyperlinkListener);
public LoginCredentialsPanel(boolean askForFriendlyName, HyperlinkActivatedListener hyperlinkListener) { super(new GridBagLayout()); this.hyperlinkListener = hyperlinkListener; this.askForFriendlyName = askForFriendlyName; initGui(); }
/** * @return * the Secret Key provided by the user. */ public String getSecretKey() { return loginCredentialsPanel.getSecretKey().trim(); }
/** * @return * whether or not DevPay authentication should be used */ public boolean getUsingDevPay() { return loginCredentialsPanel.getUsingDevPay(); }
/** * @return * the Friendly Name (nickname) provided by the user, or an empty string if the user was not * prompted to provide one (the askForFriendlyName option was false). */ public String getFriendlyName() { return loginCredentialsPanel.getFriendlyName().trim(); }
public void actionPerformed(ActionEvent e) { if (e.getSource().equals(okButton)) { String[] inputErrors = loginCredentialsPanel.checkForInputErrors(); if (inputErrors.length == 0) { isConfirmed = true; this.setVisible(false); } else { // Sanity-check provided information String errorMessages = "<html>Please correct the following errors:<ul>"; for (int i = 0; i < inputErrors.length; i++) { errorMessages += "<li>" + inputErrors[i] + "</li>"; } errorMessages += "</ul></html>"; ErrorDialog.showDialog(this, null, errorMessages, null); } } else if ("Cancel".equals(e.getActionCommand())) { isConfirmed = false; this.setVisible(false); } }
loginLocalFolderPanel.getCredentialsFile(), loginLocalFolderPanel.getPassword()); } else if (loginMode == LOGIN_MODE_DIRECT) { String[] inputErrors = loginCredentialsPanel.checkForInputErrors(); if (inputErrors.length > 0) { String errorMessages = "<html>Please correct the following errors:<ul>"; if (loginCredentialsPanel.getUsingDevPay()) { this.credentials = new AWSDevPayCredentials( loginCredentialsPanel.getAccessKey(), loginCredentialsPanel.getSecretKey(), loginCredentialsPanel.getAWSUserToken(), loginCredentialsPanel.getAWSProductToken(), loginCredentialsPanel.getFriendlyName()); } else { if (targetS3.isSelected()) { this.credentials = new AWSCredentials( loginCredentialsPanel.getAccessKey(), loginCredentialsPanel.getSecretKey(), loginCredentialsPanel.getFriendlyName()); } else { this.credentials = new GSCredentials( loginCredentialsPanel.getAccessKey(), loginCredentialsPanel.getSecretKey(), loginCredentialsPanel.getFriendlyName());
/** * Verifies that the user has provided the correct inputs, and returns a list * of error messages if not. * * @return * an empty array if there a no input errors, otherwise the array will contain * a list of error messages. */ public String[] checkForInputErrors() { ArrayList errors = new ArrayList(); if (getAccessKey().trim().length() == 0) { errors.add("Access Key must be provided"); } if (getSecretKey().trim().length() == 0) { errors.add("Secret Key must be provided"); } if (getUsingDevPay()) { if (getAWSUserToken().trim().length() == 0) { errors.add("DevPay User Token must be provided"); } if (getAWSProductToken().trim().length() == 0) { errors.add("DevPay Product Token must be provided"); } } return (String[]) errors.toArray(new String[errors.size()]); }
add(descriptionLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0)); if (askForFriendlyName) { friendlyNameTextField.setText("My Credentials"); add(friendlyNameLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(friendlyNameTextField, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(accessKeyLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(accessKeyTextField, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(secretKeyLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(secretKeyPasswordField, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(useDevPayCheckBox, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(awsUserTokenLabel, new GridBagConstraints(0, row++, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(awsUserTokenTextField, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0)); add(awsProductPanel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0)); add(new JLabel(), new GridBagConstraints(0, row++,
this.loginCredentialsPanel = new LoginCredentialsPanel(askForFriendlyName, hyperlinkListener);
public LoginCredentialsPanel(boolean askForFriendlyName, HyperlinkActivatedListener hyperlinkListener) { super(new GridBagLayout()); this.hyperlinkListener = hyperlinkListener; this.askForFriendlyName = askForFriendlyName; initGui(); }
/** * @return * the Secret Key provided by the user. */ public String getSecretKey() { return loginCredentialsPanel.getSecretKey().trim(); }
/** * @return * whether or not DevPay authentication should be used */ public boolean getUsingDevPay() { return loginCredentialsPanel.getUsingDevPay(); }
/** * @return * the Friendly Name (nickname) provided by the user, or an empty string if the user was not * prompted to provide one (the askForFriendlyName option was false). */ public String getFriendlyName() { return loginCredentialsPanel.getFriendlyName().trim(); }