net.snowflake.client.core

## Class SessionUtil

- java.lang.Object
- - net.snowflake.client.core.SessionUtil

    public class SessionUtil
    extends Object

Created by jhuang on 1/23/16.

### Property Summary

All Methods Static Methods Concrete Methods
`static boolean` `checkCRLSystem` Check if com.sun.security.enableCRLDP and com.sun.net.ssl.checkRevocation are set to true

### Nested Class Summary

Nested Classes
`static class` `SessionUtil.LoginInput` A class for holding all information required for login
`static class` `SessionUtil.LoginOutput` Login output information including session tokens, database versions

### Field Summary

Fields
`static String` `CACHE_FILE_NAME`
`static String` `CLIENT_MEMORY_LIMIT`
`static String` `CLIENT_MEMORY_LIMIT_JVM`
`static String` `CLIENT_PREFETCH_THREADS`
`static String` `CLIENT_PREFETCH_THREADS_JVM`
`static String` `CLIENT_RESULT_CHUNK_SIZE`
`static String` `CLIENT_RESULT_CHUNK_SIZE_JVM`
`static String` `CLIENT_RESULT_COLUMN_CASE_INSENSITIVE`
`static String` `CLIENT_STORE_TEMPORARY_CREDENTIAL`
`static long` `DEFAULT_CLIENT_MEMORY_LIMIT`
`protected static net.snowflake.client.core.FileCacheManager` `fileCacheManager`
`static String` `JDBC_RS_COLUMN_CASE_INSENSITIVE`
`static Map<String,String>` `JVM_PARAMS_TO_PARAMS`
`static String` `SERVICE_NAME`
`static String` `SF_HEADER_AUTHORIZATION`
`static String` `SF_HEADER_BASIC_AUTHTYPE`
`static String` `SF_HEADER_SNOWFLAKE_AUTHTYPE`
`static String` `SF_HEADER_TOKEN_TAG`
`static String` `SF_PATH_AUTHENTICATOR_REQUEST`
`static String` `SF_QUERY_DATABASE`
`static String` `SF_QUERY_REQUEST_ID`
`static String` `SF_QUERY_ROLE`
`static String` `SF_QUERY_SCHEMA`
`static String` `SF_QUERY_SESSION_DELETE`
`static String` `SF_QUERY_WAREHOUSE`

### Constructor Summary

Constructors
Constructor and Description
`SessionUtil()`

### Method Summary

All Methods Static Methods Concrete Methods
`static boolean` `checkCRLSystemProperty()` Check if com.sun.security.enableCRLDP and com.sun.net.ssl.checkRevocation are set to true
`static void` `closeSession(SessionUtil.LoginInput loginInput)` Close a session
`static void` `deleteIdTokenCache()` Delete the id token cache
`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
`static SessionUtil.LoginOutput` `issueSession(SessionUtil.LoginInput loginInput)` Issue a session
`static SessionUtil.LoginOutput` `openSession(SessionUtil.LoginInput loginInput)` Open a new session
`static SessionUtil.LoginOutput` `renewSession(SessionUtil.LoginInput loginInput)` Renew a session.
`static void` `updateSfDriverParamValues(Map<String,Object> parameters, SFSession session)`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Property Detail

#### checkCRLSystem

    public static boolean checkCRLSystemProperty

Check if com.sun.security.enableCRLDP and com.sun.net.ssl.checkRevocation are set to true

### Field Detail

#### SF_QUERY_DATABASE

    public static final String SF_QUERY_DATABASE

See Also:
  Constant Field Values

#### SF_QUERY_SCHEMA

    public static final String SF_QUERY_SCHEMA

See Also:
  Constant Field Values

#### SF_QUERY_WAREHOUSE

    public static final String SF_QUERY_WAREHOUSE

See Also:
  Constant Field Values

#### SF_QUERY_ROLE

    public static final String SF_QUERY_ROLE

See Also:
  Constant Field Values

#### SF_QUERY_REQUEST_ID

    public static final String SF_QUERY_REQUEST_ID

See Also:
  Constant Field Values

#### SF_PATH_AUTHENTICATOR_REQUEST

    public static final String SF_PATH_AUTHENTICATOR_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

    public static final String SF_HEADER_AUTHORIZATION

See Also:
  Constant Field Values

#### SF_HEADER_BASIC_AUTHTYPE

    public static final String SF_HEADER_BASIC_AUTHTYPE

See Also:
  Constant Field Values

#### SF_HEADER_SNOWFLAKE_AUTHTYPE

    public static final String SF_HEADER_SNOWFLAKE_AUTHTYPE

See Also:
  Constant Field Values

#### SF_HEADER_TOKEN_TAG

    public static final String SF_HEADER_TOKEN_TAG

See Also:
  Constant Field Values

#### DEFAULT_CLIENT_MEMORY_LIMIT

    public static long DEFAULT_CLIENT_MEMORY_LIMIT

#### CLIENT_STORE_TEMPORARY_CREDENTIAL

    public static final String CLIENT_STORE_TEMPORARY_CREDENTIAL

See Also:
  Constant Field Values

#### SERVICE_NAME

    public static final String SERVICE_NAME

See Also:
  Constant Field Values

#### CLIENT_RESULT_COLUMN_CASE_INSENSITIVE

    public static final String CLIENT_RESULT_COLUMN_CASE_INSENSITIVE

See Also:
  Constant Field Values

#### JDBC_RS_COLUMN_CASE_INSENSITIVE

    public static final String JDBC_RS_COLUMN_CASE_INSENSITIVE

See Also:
  Constant Field Values

#### CLIENT_RESULT_CHUNK_SIZE_JVM

    public static final String CLIENT_RESULT_CHUNK_SIZE_JVM

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

#### 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

#### JVM_PARAMS_TO_PARAMS

    public static Map<String,String> JVM_PARAMS_TO_PARAMS

#### CACHE_FILE_NAME

    public static final String CACHE_FILE_NAME

See Also:
  Constant Field Values

#### fileCacheManager

    protected static final net.snowflake.client.core.FileCacheManager fileCacheManager

### Constructor Detail

#### SessionUtil

    public SessionUtil()

### Method Detail

#### openSession

    public static SessionUtil.LoginOutput openSession(SessionUtil.LoginInput loginInput)
                                               throws SFException,
                                                      SnowflakeSQLException

Open a new session

Parameters:
  `loginInput` - login information
Returns:
  information get after login such as token information
Throws:
  `SFException` - if unexpected uri syntax
  `SnowflakeSQLException` - if failed to establish connection with snowflake

#### deleteIdTokenCache

    public static void deleteIdTokenCache()

Delete the id token cache

#### renewSession

    public static SessionUtil.LoginOutput renewSession(SessionUtil.LoginInput loginInput)
                                                throws SFException,
                                                       SnowflakeSQLException

Renew a session.

Use cases: - Session and Master tokens are provided. No Id token: - succeed in getting a new Session token. - fail and raise SnowflakeReauthenticationRequest because Master token expires. Since no id token exists, the exception is thrown to the upstream. - Session and Id tokens are provided. No Master token: - fail and raise SnowflakeReauthenticationRequest and issue a new Session token - fail and raise SnowflakeReauthenticationRequest and fail to issue a new Session token as the

Parameters:
  `loginInput` - login information
Returns:
  login output
Throws:
  `SFException` - if unexpected uri information
  `SnowflakeSQLException` - if failed to renew the session

#### issueSession

    public static SessionUtil.LoginOutput issueSession(SessionUtil.LoginInput loginInput)
                                                throws SFException,
                                                       SnowflakeSQLException

Issue a session

Parameters:
  `loginInput` - login information
Returns:
  login output
Throws:
  `SFException` - if unexpected uri information
  `SnowflakeSQLException` - if failed to renew the session

#### closeSession

    public static void closeSession(SessionUtil.LoginInput loginInput)
                             throws SFException,
                                    SnowflakeSQLException

Close a session

Parameters:
  `loginInput` - login information
Throws:
  `SnowflakeSQLException` - if failed to close session
  `SFException` - if failed to close session

#### checkCRLSystemProperty

    public static boolean checkCRLSystemProperty()

Check if com.sun.security.enableCRLDP and com.sun.net.ssl.checkRevocation are set to true

#### 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

#### updateSfDriverParamValues

    public static void updateSfDriverParamValues(Map<String,Object> parameters,
                                                 SFSession session)