當前位置: 首頁>>代碼示例>>Java>>正文


Java Secret.toString方法代碼示例

本文整理匯總了Java中hudson.util.Secret.toString方法的典型用法代碼示例。如果您正苦於以下問題:Java Secret.toString方法的具體用法?Java Secret.toString怎麽用?Java Secret.toString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在hudson.util.Secret的用法示例。


在下文中一共展示了Secret.toString方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createCredentialsProvider

import hudson.util.Secret; //導入方法依賴的package包/類
public static AWSCredentialsProvider createCredentialsProvider(
        final boolean useInstanceProfileForCredentials,
        final String accessId, final Secret secretKey) {

    if (useInstanceProfileForCredentials) {
        return new InstanceProfileCredentialsProvider();
    }

    BasicAWSCredentials credentials = new BasicAWSCredentials(accessId, Secret.toString(secretKey));
    return new StaticCredentialsProvider(credentials);
}
 
開發者ID:hudson3-plugins,項目名稱:ec2-plugin,代碼行數:12,代碼來源:EC2Cloud.java

示例2: connect

import hudson.util.Secret; //導入方法依賴的package包/類
public static Connection connect(HostAndPort host, StandardUsernameCredentials credentials) throws IOException {
    Connection connection = new Connection(host.getHostText(), host.getPortOrDefault(22));
    connection.setTCPNoDelay(true);
    connection.connect();

    try {
        if (credentials instanceof StandardUsernamePasswordCredentials) {
            StandardUsernamePasswordCredentials passwordCredentials = (StandardUsernamePasswordCredentials) credentials;
            connection.authenticateWithPassword(passwordCredentials.getUsername(), Secret.toString(passwordCredentials.getPassword()));
        } else if (credentials instanceof SSHUserPrivateKey) {
            SSHUserPrivateKey sshCredentials = (SSHUserPrivateKey) credentials;
            checkState(sshCredentials.getPrivateKeys().size() > 0, "no private keys defined");

            String username = credentials.getUsername();
            String password = Secret.toString(sshCredentials.getPassphrase());

            for (String privateKey : sshCredentials.getPrivateKeys()) {
                if (connection.authenticateWithPublicKey(username, privateKey.toCharArray(), password)) {
                    break;
                }
            }
        } else {
            connection.authenticateWithNone(credentials.getUsername());
        }

        checkState(connection.isAuthenticationComplete(), "Authentication failed");
    } catch (Throwable ex) {
        connection.close();
        throw Throwables.propagate(ex);
    }

    return connection;
}
 
開發者ID:dump247,項目名稱:jenkins-docker-build-plugin,代碼行數:34,代碼來源:Ssh.java

示例3: getPemKey

import hudson.util.Secret; //導入方法依賴的package包/類
public String getPemKey() {
	if (convertedSecret) {
		return Secret.toString(pemKey);
	} else {
		return Scrambler.descramble(pemKey.getPlainText());
	}
}
 
開發者ID:jenkinsci,項目名稱:chef-identity-plugin,代碼行數:8,代碼來源:ChefIdentity.java

示例4: getKnifeRb

import hudson.util.Secret; //導入方法依賴的package包/類
public String getKnifeRb() {
	if (convertedSecret) {
		return Secret.toString(knifeRb);
	} else {
		return Scrambler.descramble(knifeRb.getPlainText());
	}
}
 
開發者ID:jenkinsci,項目名稱:chef-identity-plugin,代碼行數:8,代碼來源:ChefIdentity.java

示例5: copyWithDefaultValue

import hudson.util.Secret; //導入方法依賴的package包/類
@Override
public ParameterDefinition copyWithDefaultValue(ParameterValue defaultValue) {
    if (defaultValue instanceof LeroyPasswordParameterValue) {
        LeroyPasswordParameterValue value = (LeroyPasswordParameterValue) defaultValue;
        return new LeroyPasswordParameterDefinition(getName(), Secret.toString(value.getValue()), getDescription());
    } else {
        return this;
    }
}
 
開發者ID:epicforce,項目名稱:leroy_jenkins,代碼行數:10,代碼來源:LeroyPasswordParameterDefinition.java

示例6: getPassword

import hudson.util.Secret; //導入方法依賴的package包/類
public String getPassword() {
    String authType = this.getAuthType();
    String password = null;

    if (authType.equals(NONE)) {
        password = "";
    } else if (authType.equals(API_TOKEN)) {
        password = this.getApiToken();
    } else if (authType.equals(CREDENTIALS_PLUGIN)) {
        password = Secret.toString(this.getCredentials().getPassword());
    }

    return password;
}
 
開發者ID:morficus,項目名稱:Parameterized-Remote-Trigger-Plugin,代碼行數:15,代碼來源:Auth.java

示例7: getPass

import hudson.util.Secret; //導入方法依賴的package包/類
public String getPass() {
    return Secret.toString(secretPass);
}
 
開發者ID:jenkinsci,項目名稱:sonar-quality-gates-plugin,代碼行數:4,代碼來源:GlobalConfigDataForSonarInstance.java

示例8: setCredentials

import hudson.util.Secret; //導入方法依賴的package包/類
/**
 * Set the user section of the kube configuration file.
 *
 * @throws IOException          on file operations
 * @throws InterruptedException on file operations
 */
private void setCredentials(String configFile) throws IOException, InterruptedException {
    Set<String> tempFiles = newHashSet();
    final StandardCredentials credentials = getCredentials(build);

    String credentialsArgs;
    int sensitiveFieldsCount = 1;
    if (credentials == null) {
        throw new AbortException("No credentials defined to setup Kubernetes CLI");
    } else if (credentials instanceof TokenProducer) {
        credentialsArgs = "--token=\"" + ((TokenProducer) credentials).getToken(serverUrl, null, true) + "\"";
    } else if (credentials instanceof StringCredentials) {
        credentialsArgs = "--token=\"" + ((StringCredentials) credentials).getSecret() + "\"";
    } else if (credentials instanceof UsernamePasswordCredentials) {
        UsernamePasswordCredentials upc = (UsernamePasswordCredentials) credentials;
        credentialsArgs = "--username=\"" + upc.getUsername() + "\" --password=\"" + Secret.toString(upc.getPassword()) + "\"";
    } else if (credentials instanceof StandardCertificateCredentials) {
        sensitiveFieldsCount = 0;
        FilePath clientCrtFile = workspace.createTempFile("client", "crt");
        FilePath clientKeyFile = workspace.createTempFile("client", "key");
        CertificateHelper.extractFromCertificate((StandardCertificateCredentials) credentials, clientCrtFile, clientKeyFile);
        tempFiles.add(clientCrtFile.getRemote());
        tempFiles.add(clientKeyFile.getRemote());
        credentialsArgs = "--embed-certs=true --client-certificate=" + clientCrtFile.getRemote() + " --client-key="
                + clientKeyFile.getRemote();
    } else {
        throw new AbortException("Unsupported Credentials type " + credentials.getClass().getName());
    }

    String[] cmds = QuotedStringTokenizer.tokenize(String.format("%s config set-credentials %s %s",
            KUBECTL_BINARY,
            USERNAME,
            credentialsArgs));

    int status = launcher.launch()
            .envs(String.format("KUBECONFIG=%s", configFile))
            .cmds(cmds)
            .masks(getMasks(cmds.length, sensitiveFieldsCount))
            .stdout(launcher.getListener())
            .join();
    if (status != 0) throw new IOException("Failed to add kubectl credentials (exit code  " + status + ")");

    for (String tempFile : tempFiles) {
        workspace.child(tempFile).delete();
    }

}
 
開發者ID:maxlaverse,項目名稱:kubernetes-cli-plugin,代碼行數:53,代碼來源:KubeConfigWriter.java

示例9: getPassword

import hudson.util.Secret; //導入方法依賴的package包/類
public String getPassword() {
	return Secret.toString(secret);
}
 
開發者ID:jenkinsci,項目名稱:openshift-deployer-plugin,代碼行數:4,代碼來源:Server.java

示例10: getReviewboardPassword

import hudson.util.Secret; //導入方法依賴的package包/類
public String getReviewboardPassword() {
  return Secret.toString(reviewboardPassword);
}
 
開發者ID:vmware,項目名稱:jenkins-reviewbot,代碼行數:4,代碼來源:ReviewboardDescriptor.java

示例11: getSecret

import hudson.util.Secret; //導入方法依賴的package包/類
/**
 * @deprecated Use MesosCloud#getCredentials().getPassword() instead.
 * @return
 */
@Deprecated
public String getSecret() {
  StandardUsernamePasswordCredentials credentials = getCredentials();
  return credentials == null ? "" : Secret.toString(credentials.getPassword());
}
 
開發者ID:jenkinsci,項目名稱:mesos-plugin,代碼行數:10,代碼來源:MesosCloud.java

示例12: getPrivateToken

import hudson.util.Secret; //導入方法依賴的package包/類
/**
 * Gets the private GitLab API token.
 *
 * @return the private token
 */
public String getPrivateToken() {
    return Secret.toString(privateToken);
}
 
開發者ID:enil,項目名稱:gitlab-api-plugin,代碼行數:9,代碼來源:GitLabConfiguration.java

示例13: getPassword

import hudson.util.Secret; //導入方法依賴的package包/類
/**
 * Get password to unlock keychain.
 * @return password as plain text
 */
public final String getPassword() {
    return Secret.toString(password);
}
 
開發者ID:SICSoftwareGmbH,項目名稱:kpp-management-plugin,代碼行數:8,代碼來源:KPPKeychain.java


注:本文中的hudson.util.Secret.toString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。