Package net.snowflake.ingest.connection
Class JWTManager
- java.lang.Object
-
- net.snowflake.ingest.connection.JWTManager
-
- All Implemented Interfaces:
AutoCloseable
public final class JWTManager extends Object
This class manages creating and automatically renewing the JWT token- Author:
- obabarinsa
-
-
Field Summary
Fields Modifier and Type Field Description protected String
account
protected static org.slf4j.Logger
LOGGER
protected String
publicKeyFingerPrint
protected AtomicBoolean
refreshFailed
protected TelemetryService
telemetryService
protected ScheduledExecutorService
tokenRefresher
protected String
user
-
Constructor Summary
Constructors Constructor Description JWTManager(String accountName, String username, KeyPair keyPair, TelemetryService telemetryService)
Creates a JWTManager entity for a given account, user and KeyPair with the default time to renew (RENEWAL_INTERVAL_IN_MINUTES minutes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Currently, it only shuts down the instance of ExecutorService.String
getToken()
-
-
-
Field Detail
-
LOGGER
protected static final org.slf4j.Logger LOGGER
-
account
protected final String account
-
publicKeyFingerPrint
protected String publicKeyFingerPrint
-
user
protected final String user
-
refreshFailed
protected final AtomicBoolean refreshFailed
-
tokenRefresher
protected ScheduledExecutorService tokenRefresher
-
telemetryService
protected final TelemetryService telemetryService
-
-
Constructor Detail
-
JWTManager
public JWTManager(String accountName, String username, KeyPair keyPair, TelemetryService telemetryService)
Creates a JWTManager entity for a given account, user and KeyPair with the default time to renew (RENEWAL_INTERVAL_IN_MINUTES minutes)- Parameters:
accountName
- - the snowflake account name of this userusername
- - the snowflake username of the current userkeyPair
- - the public/private key pair we're using to connecttelemetryService
- reference to the telemetry service
-
-
Method Detail
-
getToken
public String getToken()
-
close
public void close()
Currently, it only shuts down the instance of ExecutorService.- Specified by:
close
in interfaceAutoCloseable
-
-