@Override public void applyChanges(Object customData) { //ConnectionManagerAccessor access = ConnectionManagerAccessor.getDefault(); if (customData instanceof ExecutionEnvironment) { ExecutionEnvironment e = (ExecutionEnvironment) customData; Authentication a = Authentication.getFor(e); a.setTimeout(auth.getTimeout()); authListModel.storeAuthenticationMethods(auth); a.setAuthenticationMethods(auth.getAuthenticationMethods()); if (auth.getType() == Authentication.Type.SSH_KEY) { a.setSSHKeyFile(auth.getSSHKeyFile()); } else { a.setPassword(); } a.store(); AuthenticationUtils.changeAuth(e, a); } else if (env != null) { authListModel.storeAuthenticationMethods(auth); auth.store(); AuthenticationUtils.changeAuth(env, auth); } }
public AuthenticationSettingsPanel(Authentication auth, boolean showClearPwdButton) { this.env = auth.getEnv(); this.auth = auth; initComponents(); if (auth.getType() == Authentication.Type.SSH_KEY) { keyRadioButton.setSelected(true); pwdRadioButton.setSelected(false); keyFileFld.setText(auth.getSSHKeyFile()); connectionSettings.setIcon(getCollapsedIcon()); authListModel = new AuthenticationListModel(auth.getAuthenticationMethods()); authenticationsList.setModel(authListModel); authenticationsList.setCellRenderer(new AuthentificationCheckboxListRenderer()); timeoutSpinner.setModel(new SpinnerNumberModel(auth.getTimeout(), 1, 500, 1)); timeoutSpinner.addChangeListener(new ChangeListener() { @Override
if (!needskeyFile) { problem = null; auth.setPassword(); return true; if (!Authentication.isValidSSHKeyFile(file.getAbsolutePath())) { problem = NbBundle.getMessage(AuthenticationSettingsPanel.class, "AuthenticationSettingsPanel.validationError.invalidKey.text", keyFile);//NOI18N auth.setSSHKeyFile(file.getAbsolutePath()); problem = null; return true;
@Override public ValidateablePanel getHostPropertyPanel(ExecutionEnvironment env) { Authentication auth = Authentication.getFor(env); AuthenticationSettingsPanel panel = new AuthenticationSettingsPanel(auth, env != null); return panel; } }
public void storeAuthenticationMethods(Authentication auth) { auth.setAuthenticationMethods(toMethodList()); } }
return Authentication.isValidSSHKeyFile(file.getAbsolutePath());