Class SessionUtil


  • public class SessionUtil
    extends Object
    Low level session util
    • Constructor Detail

      • SessionUtil

        public SessionUtil()
    • Method Detail

      • deleteIdTokenCache

        public static void deleteIdTokenCache​(String host,
                                              String user)
        Delete the id token cache
        Parameters:
        host - The host string
        user - The user
      • deleteMfaTokenCache

        public static void deleteMfaTokenCache​(String host,
                                               String user)
        Delete the mfa token cache
        Parameters:
        host - The host string
        user - 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 key
        privateKeyFile - path to private key file
        privateKeyBase64 - base64 encoded content of the private key file
        privateKeyPwd - password for private key file or base64 encoded private key
        accountName - account name
        userName - 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