@TaskAction void removeCredentials() { // get credentials key from the project properties String key = getCredentialsKey(); LOGGER.debug(String.format("Remove credentials with key: '%s'", key)); // read the current persisted credentials OrderedProperties credentials = credentialsPersistenceManager.readCredentials(); // remove the credentials with the given key credentials.removeProperty(key); // persist the updated credentials credentialsPersistenceManager.storeCredentials(credentials); }
@TaskAction void removeCredentials() throws IOException { // get credentials key from the project properties String key = getCredentialsKey(); LOGGER.debug(String.format("Remove credentials with key: '%s'", key)); // read the current persisted credentials OrderedProperties credentials = credentialsPersistenceManager.readCredentials(); // remove the credentials with the given key credentials.removeProperty(key); // persist the updated credentials credentialsPersistenceManager.storeCredentials(credentials); }
@TaskAction void addCredentials() throws IOException { // get credentials key and value from the project properties String key = getCredentialsKey(); String value = getCredentialsValue(); char[] placeholderValue = new char[value.length()]; Arrays.fill(placeholderValue, '*'); LOGGER.debug(String.format("Add credentials with key: '%s', value: '%s'", key, new String(placeholderValue))); // read the current persisted credentials OrderedProperties credentials = credentialsPersistenceManager.readCredentials(); // encrypt value and update credentials String encryptedValue = credentialsEncryptor.encrypt(value); credentials.setProperty(key, encryptedValue); // persist the updated credentials credentialsPersistenceManager.storeCredentials(credentials); }
@TaskAction void addCredentials() { // get credentials key and value from the command line or project properties String key = getCredentialsKey(); if (key == null) { throw new IllegalArgumentException("Credentials key must not be null"); } String value = getCredentialsValue(); if (value == null) { throw new IllegalArgumentException("Credentials value must not be null"); } char[] placeholderValue = new char[value.length()]; Arrays.fill(placeholderValue, '*'); LOGGER.debug(String.format("Add credentials with key: '%s', value: '%s'", key, new String(placeholderValue))); // read the current persisted credentials OrderedProperties credentials = credentialsPersistenceManager.readCredentials(); // encrypt value and update credentials String encryptedValue = credentialsEncryptor.encrypt(value); credentials.setProperty(key, encryptedValue); // persist the updated credentials credentialsPersistenceManager.storeCredentials(credentials); }
CredentialsContainer credentialsContainer = new CredentialsContainer(credentialsEncryptor, credentialsPersistenceManager.readCredentials()); project.getExtensions().getExtraProperties().set(CREDENTIALS_CONTAINER_PROPERTY, credentialsContainer); LOGGER.debug("Registered property '" + CREDENTIALS_CONTAINER_PROPERTY + "'");
CredentialsContainer credentialsContainer = new CredentialsContainer(credentialsEncryptor, credentialsPersistenceManager.readCredentials()); project.getExtensions().getExtraProperties().set(CREDENTIALS_CONTAINER_PROPERTY, credentialsContainer); LOGGER.debug("Registered property '" + CREDENTIALS_CONTAINER_PROPERTY + "'");