Package net.snowflake.client.core
Class SessionUtil
- java.lang.Object
-
- net.snowflake.client.core.SessionUtil
-
public class SessionUtil extends Object
Low level session util
-
-
Field Summary
-
Constructor Summary
Constructors Constructor Description SessionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
deleteIdTokenCache(String host, String user)
Delete the id token cachestatic void
deleteMfaTokenCache(String host, String user)
Delete the mfa token cachestatic String
generateJWTToken(PrivateKey privateKey, String privateKeyFile, String privateKeyFilePwd, String accountName, String userName)
Deprecated.static String
generateJWTToken(PrivateKey privateKey, String privateKeyFile, String privateKeyBase64, String privateKeyPwd, String accountName, String userName)
Helper function to generate a JWT tokenstatic Map<String,Object>
getCommonParams(com.fasterxml.jackson.databind.JsonNode paramsNode)
Helper function to parse a JsonNode from a GS response containing CommonParameters, emitting an EnumMap of parametersstatic boolean
isNewRetryStrategyRequest(org.apache.http.client.methods.HttpRequestBase request)
Helper method to check if the request path is a login/auth request to use for retry strategy.static void
resetOCSPUrlIfNecessary(String serverUrl)
Reset OCSP cache server if the snowflake server URL is for private link.
-
-
-
Field Detail
-
SF_PATH_AUTHENTICATOR_REQUEST
public static final String SF_PATH_AUTHENTICATOR_REQUEST
- See Also:
- Constant Field Values
-
SF_PATH_CONSOLE_LOGIN_REQUEST
public static final String SF_PATH_CONSOLE_LOGIN_REQUEST
- See Also:
- Constant Field Values
-
SF_QUERY_SESSION_DELETE
public static final String SF_QUERY_SESSION_DELETE
- See Also:
- Constant Field Values
-
SF_HEADER_AUTHORIZATION
@Deprecated public static final String SF_HEADER_AUTHORIZATION
Deprecated.- See Also:
- Constant Field Values
-
JDBC_CHUNK_DOWNLOADER_MAX_RETRY
public static final String JDBC_CHUNK_DOWNLOADER_MAX_RETRY
- See Also:
- Constant Field Values
-
CLIENT_RESULT_CHUNK_SIZE
public static final String CLIENT_RESULT_CHUNK_SIZE
- See Also:
- Constant Field Values
-
CLIENT_MEMORY_LIMIT_JVM
public static final String CLIENT_MEMORY_LIMIT_JVM
- See Also:
- Constant Field Values
-
CLIENT_MEMORY_LIMIT
public static final String CLIENT_MEMORY_LIMIT
- See Also:
- Constant Field Values
-
QUERY_CONTEXT_CACHE_SIZE
public static final String QUERY_CONTEXT_CACHE_SIZE
- See Also:
- Constant Field Values
-
JDBC_ENABLE_PUT_GET
public static final String JDBC_ENABLE_PUT_GET
- See Also:
- Constant Field Values
-
CLIENT_PREFETCH_THREADS_JVM
public static final String CLIENT_PREFETCH_THREADS_JVM
- See Also:
- Constant Field Values
-
CLIENT_PREFETCH_THREADS
public static final String CLIENT_PREFETCH_THREADS
- See Also:
- Constant Field Values
-
CLIENT_ENABLE_CONSERVATIVE_MEMORY_USAGE_JVM
public static final String CLIENT_ENABLE_CONSERVATIVE_MEMORY_USAGE_JVM
- See Also:
- Constant Field Values
-
CLIENT_ENABLE_CONSERVATIVE_MEMORY_USAGE
public static final String CLIENT_ENABLE_CONSERVATIVE_MEMORY_USAGE
- See Also:
- Constant Field Values
-
CLIENT_CONSERVATIVE_MEMORY_ADJUST_STEP
public static final String CLIENT_CONSERVATIVE_MEMORY_ADJUST_STEP
- See Also:
- Constant Field Values
-
OCSP_FAIL_OPEN_JVM
public static final String OCSP_FAIL_OPEN_JVM
- See Also:
- Constant Field Values
-
CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY
public static final String CLIENT_SESSION_KEEP_ALIVE_HEARTBEAT_FREQUENCY
- See Also:
- Constant Field Values
-
CLIENT_SFSQL
public static final String CLIENT_SFSQL
- See Also:
- Constant Field Values
-
CLIENT_VALIDATE_DEFAULT_PARAMETERS
public static final String CLIENT_VALIDATE_DEFAULT_PARAMETERS
- See Also:
- Constant Field Values
-
CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS
public static final String CLIENT_ENABLE_LOG_INFO_STATEMENT_PARAMETERS
- See Also:
- Constant Field Values
-
CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX
public static final String CLIENT_METADATA_REQUEST_USE_CONNECTION_CTX
- See Also:
- Constant Field Values
-
CLIENT_METADATA_USE_SESSION_DATABASE
public static final String CLIENT_METADATA_USE_SESSION_DATABASE
- See Also:
- Constant Field Values
-
ENABLE_STAGE_S3_PRIVATELINK_FOR_US_EAST_1
public static final String ENABLE_STAGE_S3_PRIVATELINK_FOR_US_EAST_1
- See Also:
- Constant Field Values
-
SF_HEADER_CLIENT_APP_ID
public static final String SF_HEADER_CLIENT_APP_ID
- See Also:
- Constant Field Values
-
SF_HEADER_CLIENT_APP_VERSION
public static final String SF_HEADER_CLIENT_APP_VERSION
- See Also:
- Constant Field Values
-
DEFAULT_CLIENT_MEMORY_LIMIT
public static long DEFAULT_CLIENT_MEMORY_LIMIT
-
DEFAULT_CLIENT_PREFETCH_THREADS
public static int DEFAULT_CLIENT_PREFETCH_THREADS
-
MIN_CLIENT_CHUNK_SIZE
public static int MIN_CLIENT_CHUNK_SIZE
-
MAX_CLIENT_CHUNK_SIZE
public static int MAX_CLIENT_CHUNK_SIZE
-
-
Method Detail
-
deleteIdTokenCache
public static void deleteIdTokenCache(String host, String user)
Delete the id token cache- Parameters:
host
- The host stringuser
- The user
-
deleteMfaTokenCache
public static void deleteMfaTokenCache(String host, String user)
Delete the mfa token cache- Parameters:
host
- The host stringuser
- The user
-
getCommonParams
public static Map<String,Object> getCommonParams(com.fasterxml.jackson.databind.JsonNode paramsNode)
Helper function to parse a JsonNode from a GS response containing CommonParameters, emitting an EnumMap of parameters- Parameters:
paramsNode
- parameters in JSON form- Returns:
- map object including key and value pairs
-
resetOCSPUrlIfNecessary
public static void resetOCSPUrlIfNecessary(String serverUrl) throws IOException
Reset OCSP cache server if the snowflake server URL is for private link. If the URL is not for private link, do nothing.- Parameters:
serverUrl
- The Snowflake URL includes protocol such as "https://"- Throws:
IOException
- If exception encountered
-
generateJWTToken
public static String generateJWTToken(PrivateKey privateKey, String privateKeyFile, String privateKeyBase64, String privateKeyPwd, String accountName, String userName) throws SFException
Helper function to generate a JWT token- Parameters:
privateKey
- private keyprivateKeyFile
- path to private key fileprivateKeyBase64
- base64 encoded content of the private key fileprivateKeyPwd
- password for private key file or base64 encoded private keyaccountName
- account nameuserName
- user name- Returns:
- JWT token
- Throws:
SFException
- if Snowflake error occurs
-
generateJWTToken
@Deprecated public static String generateJWTToken(PrivateKey privateKey, String privateKeyFile, String privateKeyFilePwd, String accountName, String userName) throws SFException
Deprecated.Helper function to generate a JWT token. UsegenerateJWTToken(PrivateKey, String, String, String, String, String)
- Parameters:
privateKey
- private keyprivateKeyFile
- path to private key fileprivateKeyFilePwd
- password for private key fileaccountName
- account nameuserName
- user name- Returns:
- JWT token
- Throws:
SFException
- if Snowflake error occurs
-
isNewRetryStrategyRequest
public static boolean isNewRetryStrategyRequest(org.apache.http.client.methods.HttpRequestBase request)
Helper method to check if the request path is a login/auth request to use for retry strategy.- Parameters:
request
- the post request- Returns:
- true if this is a login/auth request, false otherwise
-
-