Refine search
static String createAuthorization(final StandardUsernamePasswordCredentials credentials) { final String username = credentials.getUsername(); final Secret secretPassword = credentials.getPassword(); final String password = secretPassword.getPlainText(); final String credPair = username + ":" + password; final byte[] credBytes = credPair.getBytes(MediaType.UTF_8); final String base64enc = DatatypeConverter.printBase64Binary(credBytes); final String result = "Basic " + base64enc; return result; }
protected Object readResolve() { if (StringUtils.isNotBlank(collectionUrl) && password != null && StringUtils.isNotBlank(password.getPlainText())) { try { final URI uri = new URI(collectionUrl); String hostName = uri.getHost(); List<StandardUsernamePasswordCredentials> credentials = TeamCollectionConfiguration.findCredentials(hostName); for (StandardUsernamePasswordCredentials credential : credentials) { if ((StringUtils.isBlank(username) || credential.getUsername().equals(username)) && credential.getPassword().getPlainText().equals(password.getPlainText())) { this.credentialsId = credential.getId(); return this; } } this.credentialsId = TeamCollectionConfiguration.setCredentials(hostName, username, password.getPlainText()); } catch (Exception ex) { logger.log(Level.WARNING, String.format("Get or generate credentials for collection url: %s and username: %s failed.", collectionUrl, username), ex); } } return this; }
@DataBoundConstructor public ReleaseManagementCI(String collectionUrl, String projectName, String releaseDefinitionName, String credentialsId) { if (collectionUrl.endsWith("/")) { this.collectionUrl = collectionUrl; } else { this.collectionUrl = collectionUrl + "/"; } this.projectName = projectName; this.releaseDefinitionName = releaseDefinitionName; StandardUsernamePasswordCredentials credential = TeamCollectionConfiguration.findCredentialsById(credentialsId); this.username = credential == null ? "" : credential.getUsername(); this.password = credential == null ? Secret.fromString("") : credential.getPassword(); this.credentialsId = credentialsId; }
public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) { // most SSH servers just use keyboard interactive to prompt for the password // match "assword" is safer than "password"... you don't *want* to know why! return prompt != null && prompt.length > 0 && prompt[0].toLowerCase().contains("assword") ? new String[]{getUser().getPassword().getPlainText()} : new String[0]; } }
String passwordValue = Base64.encodeBase64String(Secret.toString(credentials.getPassword()).getBytes()); npmrc.set(compose(registryPrefix, NPM_SETTINGS_USER), credentials.getUsername()); npmrc.set(compose(registryPrefix, NPM_SETTINGS_PASSWORD), passwordValue); npmrc.set(NPM_SETTINGS_ALWAYS_AUTH, credentials != null); if (credentials != null) { String authValue = credentials.getUsername() + ':' + Secret.toString(credentials.getPassword()); authValue = Base64.encodeBase64String(authValue.getBytes()); npmrc.set(NPM_SETTINGS_AUTH, authValue);
CredentialsMatchers.withUsername(username)); for (final StandardUsernamePasswordCredentials cred : credentials) { if (StringUtils.equals(password, Secret.toString(cred.getPassword()))) { credentialsId = cred.getId(); break; password); SystemCredentialsProvider.getInstance().getCredentials().add(newCredentials); credentialsId = newCredentials.getId();
LOGGER.log(Level.FINE, "Maven Server ID {0}: use {1} / {2}", new Object[]{mavenServerId, usernamePasswordCredentials.getId(), usernamePasswordCredentials.getDescription()}); id.setTextContent(mavenServerId); final Element password = doc.createElement("password"); password.setTextContent(Secret.toString(usernamePasswordCredentials.getPassword())); final Element username = doc.createElement("username"); username.setTextContent(usernamePasswordCredentials.getUsername()); passphrase.setTextContent(Secret.toString(sshUserPrivateKey.getPassphrase()));
final String password = user.getPassword().getPlainText(); boolean tried = false; username, user.getId()); tried = true; .error("Failed to authenticate as %s. Wrong password. " + "(credentialId:%s/method:keyboard-interactive)", username, user.getId()); tried = true; e.printStackTrace(getListener() .error("Unexpected error while trying to authenticate as %s with credential=%s", username, user.getId()));
/** * @deprecated Use MesosCloud#getCredentials().getPassword() instead. * @return */ @Deprecated public String getSecret() { StandardUsernamePasswordCredentials credentials = getCredentials(); return credentials == null ? "" : Secret.toString(credentials.getPassword()); }
return listBoxModel; String username = credential.getUsername(); Secret password = credential.getPassword();
public boolean matches(@NonNull Credentials item) { if (item instanceof StandardUsernamePasswordCredentials && password != null && StandardUsernamePasswordCredentials.class.cast(item).getPassword().equals(password)) { return true; } if (privatekeyContent != null && item instanceof SSHUserPrivateKey) { for (String key : SSHUserPrivateKey.class.cast(item).getPrivateKeys()) { if (pemKeyEquals(key, privatekeyContent)) { return true; } } } return false; } }));
/** * @deprecated Use MesosCloud#getCredentials().getUsername() instead. * @return */ @Deprecated public String getPrincipal() { StandardUsernamePasswordCredentials credentials = getCredentials(); return credentials == null ? "jenkins" : credentials.getUsername(); }
if (c instanceof StandardUsernamePasswordCredentials) { LOGGER.info("Using username/password as adminCredentials"); String password = CredentialsHelper.getPassword(((StandardUsernamePasswordCredentials)c).getPassword()); LoginCredentials lc = LoginCredentials.builder().user(adminUser).password(password).build(); options.overrideLoginCredentials(lc);
@Override public String getKeyName() { return credential.getId(); }
listener.getLogger().println("using GIT_ASKPASS to set credentials " + userPass.getDescription());
public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo) { // most SSH servers just use keyboard interactive to prompt for the password // match "assword" is safer than "password"... you don't *want* to know why! return prompt != null && prompt.length > 0 && prompt[0].toLowerCase().contains("assword") ? new String[]{getUser().getPassword().getPlainText()} : new String[0]; } }
if (webUrl == null) webUrl = System.getenv("JENKINS_URL"); StandardUsernamePasswordCredentials credentials = mesosCloud.getCredentials(); String principal = credentials == null ? "jenkins" : credentials.getUsername(); String secret = credentials == null ? "" : Secret.toString(credentials.getPassword());
this.username = credential == null ? "" : credential.getUsername(); this.password = credential == null ? Secret.fromString("") : credential.getPassword();
); for (StandardUsernamePasswordCredentials cred: credentials) { if (StringUtils.equals(secret, Secret.toString(cred.getPassword()))) { this.credentialsId = cred.getId(); break; CredentialsScope.SYSTEM, null, null, principal, secret); SystemCredentialsProvider.getInstance().getCredentials().add(newCredentials); this.credentialsId = newCredentials.getId();
private File createPasswordFile(StandardUsernamePasswordCredentials userPass) throws IOException { File passwordFile = createTempFile("password", ".txt"); try (PrintWriter w = new PrintWriter(passwordFile, "UTF-8")) { w.println(Secret.toString(userPass.getPassword())); } return passwordFile; }