use of io.cdap.cdap.securestore.spi.secret.Secret in project cdap by caskdata.
the class SecretManagerSecureStoreService method get.
@Override
public SecureStoreData get(String namespace, String name) throws Exception {
validate(namespace);
try {
Secret secret = secretManager.get(namespace, name);
SecretMetadata metadata = secret.getMetadata();
return new SecureStoreData(new SecureStoreMetadata(metadata.getName(), metadata.getDescription(), metadata.getCreationTimeMs(), metadata.getProperties()), secret.getData());
} catch (SecretNotFoundException e) {
throw new SecureKeyNotFoundException(new SecureKeyId(namespace, name), e);
}
}
use of io.cdap.cdap.securestore.spi.secret.Secret in project cdap by caskdata.
the class CloudSecretManager method get.
@Override
public Secret get(String namespace, String name) throws SecretNotFoundException, IOException {
SecretInfo secretInfo = store.get(namespace, name, encoderDecoder);
byte[] decrypted = client.decrypt(CRYPTO_KEY_PREFIX + namespace, secretInfo.getSecretData());
return new Secret(decrypted, new SecretMetadata(secretInfo.getName(), secretInfo.getDescription(), secretInfo.getCreationTimeMs(), secretInfo.getProperties()));
}
use of io.cdap.cdap.securestore.spi.secret.Secret in project cdap by caskdata.
the class SecretManagerSecureStoreService method put.
@Override
public void put(String namespace, String name, String data, @Nullable String description, Map<String, String> properties) throws Exception {
validate(namespace);
secretManager.store(namespace, new Secret(data.getBytes(StandardCharsets.UTF_8), new SecretMetadata(name, description, System.currentTimeMillis(), ImmutableMap.copyOf(properties))));
}
Aggregations