public void setDefaultValue(String defaultValue) { this.defaultValue = Secret.fromString(defaultValue); }
/** * We don't let the external code set the API token, * but for the initial value of the token we need to compute the seed by ourselves. */ /*package*/ ApiTokenProperty(@CheckForNull String seed) { if(seed != null){ apiToken = Secret.fromString(seed); } }
@DataBoundConstructor public PasswordParameterDefinition(String name, String defaultValue, String description) { super(name, description); this.defaultValue = Secret.fromString(defaultValue); }
@DataBoundConstructor public PasswordParameterValue(String name, String value, String description) { super(name, description); this.value = Secret.fromString(value); }
public Secret convert(Class type, Object value) { return Secret.fromString(value.toString()); } }, Secret.class);
@Deprecated private void _changeApiToken(){ byte[] random = new byte[16]; // 16x8=128bit worth of randomness, since we use md5 digest as the API token RANDOM.nextBytes(random); apiToken = Secret.fromString(Util.toHexString(random)); }
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) { return fromString(reader.getValue()); } }
private Credentials createCredentials(String userName, String password) { if (userName.indexOf('\\') >= 0){ final String domain = userName.substring(0, userName.indexOf('\\')); final String user = userName.substring(userName.indexOf('\\') + 1); return new NTCredentials(user, Secret.fromString(password).getPlainText(), "", domain); } else { return new UsernamePasswordCredentials(userName, Secret.fromString(password).getPlainText()); } } }
private Object readResolve() { if (secretPassword == null) // backward compatibility : get scrambled password and store it encrypted secretPassword = Secret.fromString(Scrambler.descramble(password)); password = null; authenticator = newAuthenticator(); return this; }
@DataBoundSetter public void setSecretToken(String secretToken) { this.secretToken = Secret.fromString(secretToken); }
@DataBoundConstructor public ProxyConfiguration(String name, int port, String userName, String password, String noProxyHost, String testUrl) { this.name = Util.fixEmptyAndTrim(name); this.port = port; this.userName = Util.fixEmptyAndTrim(userName); this.secretPassword = Secret.fromString(password); this.noProxyHost = Util.fixEmptyAndTrim(noProxyHost); this.testUrl = Util.fixEmptyAndTrim(testUrl); this.authenticator = newAuthenticator(); }
@Nonnull @Restricted(NoExternalUse.class) /*package*/ String getApiTokenInsecure() { if(apiToken == null){ return Messages.ApiTokenProperty_NoLegacyToken(); } String p = apiToken.getPlainText(); if (p.equals(Util.getDigestOf(Jenkins.getInstance().getSecretKey()+":"+user.getId()))) { // if the current token is the initial value created by pre SECURITY-49 Jenkins, we can't use that. // force using the newer value apiToken = Secret.fromString(p=API_KEY_SEED.mac(user.getId())); } return Util.getDigestOf(p); }
this.acceptMergeRequestOnSuccess = acceptMergeRequestOnSuccess; this.mergeRequestLabelFilterConfig = mergeRequestLabelFilterConfig; this.secretToken = Secret.fromString(secretToken); this.triggerOnApprovedMergeRequest = triggerOnApprovedMergeRequest; this.pendingBuildName = pendingBuildName;
@Initializer(after = InitMilestone.PLUGINS_STARTED) public static void migrate() throws IOException { GitLabConnectionConfig descriptor = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class); for (GitLabConnection connection : descriptor.getConnections()) { if (connection.apiTokenId == null && connection.apiToken != null) { for (CredentialsStore credentialsStore : CredentialsProvider.lookupStores(Jenkins.getInstance())) { if (credentialsStore instanceof SystemCredentialsProvider.StoreImpl) { List<Domain> domains = credentialsStore.getDomains(); connection.apiTokenId = UUID.randomUUID().toString(); credentialsStore.addCredentials(domains.get(0), new GitLabApiTokenImpl(CredentialsScope.SYSTEM, connection.apiTokenId, "GitLab API Token", Secret.fromString(connection.apiToken))); } } } } descriptor.save(); } }
/** * We don't let the external code set the API token, * but for the initial value of the token we need to compute the seed by ourselves. */ /*package*/ ApiTokenProperty(String seed) { apiToken = Secret.fromString(seed); }
DummyPrivateKey(String id, String user, String passphrase, final String keyContent) { this.id = id; this.user = user; this.passphrase = Secret.fromString(passphrase); this.keyContent = keyContent; }
public Object readResolve() { if (secretPassword == null) // backward compatibility : get scrambled password and store it encrypted secretPassword = Secret.fromString(Scrambler.descramble(password)); password = null; return this; }
public static String createCredentials(String serverAPIUrl, String token) throws Exception { String description = serverAPIUrl + " GitHub auto generated token credentials"; StringCredentialsImpl credentials = new StringCredentialsImpl( CredentialsScope.GLOBAL, UUID.randomUUID().toString(), description, Secret.fromString(token)); return createCredentials(serverAPIUrl, credentials); }
/** * Computes the key that identifies this Hudson among other Hudsons that the user has a credential for. */ @VisibleForTesting String getPropertyKey() { String url = Jenkins.getActiveInstance().getRootUrl(); if (url!=null) return url; return Secret.fromString("key").getEncryptedValue(); }
@Nonnull @Restricted(NoExternalUse.class) /*package*/ String getApiTokenInsecure() { String p = apiToken.getPlainText(); if (p.equals(Util.getDigestOf(Jenkins.getInstance().getSecretKey()+":"+user.getId()))) { // if the current token is the initial value created by pre SECURITY-49 Jenkins, we can't use that. // force using the newer value apiToken = Secret.fromString(p=API_KEY_SEED.mac(user.getId())); } return Util.getDigestOf(p); }