co.com.bancolombia.secretsmanager.vaultsync.connector.VaultAuthenticator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of vault-sync Show documentation
Show all versions of vault-sync Show documentation
Secrets Manager connector for Vault
package co.com.bancolombia.secretsmanager.vaultsync.connector;
import co.com.bancolombia.secretsmanager.api.exceptions.SecretException;
import co.com.bancolombia.secretsmanager.commons.utils.GsonUtils;
import co.com.bancolombia.secretsmanager.vault.K8sTokenReader;
import co.com.bancolombia.secretsmanager.vault.auth.AuthResponse;
import co.com.bancolombia.secretsmanager.vault.auth.K8sAuth;
import co.com.bancolombia.secretsmanager.vault.auth.RoleAuth;
import co.com.bancolombia.secretsmanager.vault.config.VaultSecretsManagerProperties;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.reflect.TypeToken;
import java.io.IOException;
import java.lang.reflect.Type;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
/**
* Class in charge of authenticating with vault
*/
public class VaultAuthenticator {
private final Logger logger = Logger.getLogger("connector.VaultAuthenticator");
private static final String CONTENT_TYPE_HEADER = "Content-Type";
private static final String ERROR_TEMPLATE = "Error performing operation with vault: %s";
private final HttpClient httpClient;
private final VaultSecretsManagerProperties properties;
private final Cache cache;
private final K8sTokenReader k8sTokenReader;
private final Gson gson = new Gson();
private final Type mapType = new TypeToken
© 2015 - 2024 Weber Informatics LLC | Privacy Policy