本文整理匯總了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);
}
示例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;
}
示例3: getPemKey
import hudson.util.Secret; //導入方法依賴的package包/類
public String getPemKey() {
if (convertedSecret) {
return Secret.toString(pemKey);
} else {
return Scrambler.descramble(pemKey.getPlainText());
}
}
示例4: getKnifeRb
import hudson.util.Secret; //導入方法依賴的package包/類
public String getKnifeRb() {
if (convertedSecret) {
return Secret.toString(knifeRb);
} else {
return Scrambler.descramble(knifeRb.getPlainText());
}
}
示例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;
}
}
示例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;
}
示例7: getPass
import hudson.util.Secret; //導入方法依賴的package包/類
public String getPass() {
return Secret.toString(secretPass);
}
示例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();
}
}
示例9: getPassword
import hudson.util.Secret; //導入方法依賴的package包/類
public String getPassword() {
return Secret.toString(secret);
}
示例10: getReviewboardPassword
import hudson.util.Secret; //導入方法依賴的package包/類
public String getReviewboardPassword() {
return Secret.toString(reviewboardPassword);
}
示例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());
}
示例12: getPrivateToken
import hudson.util.Secret; //導入方法依賴的package包/類
/**
* Gets the private GitLab API token.
*
* @return the private token
*/
public String getPrivateToken() {
return Secret.toString(privateToken);
}
示例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);
}