Skip to content

Commit

Permalink
Remove dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dheyman committed Dec 19, 2024
1 parent d07da78 commit d1f3114
Showing 1 changed file with 4 additions and 11 deletions.
15 changes: 4 additions & 11 deletions src/main/java/net/snowflake/client/core/SessionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -1079,24 +1079,17 @@ private static void deleteOAuthRefreshTokenCache(String host, String user) {
/**
* Renew a session.
*
* <p>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
*
* @param loginInput login information
* @return login output
* @throws SFException if unexpected uri information
* @throws SnowflakeSQLException if failed to renew the session
*/
static SFLoginOutput renewSession(SFLoginInput loginInput)
throws SFException, SnowflakeSQLException {
return tokenRequest(loginInput, TokenRequestType.RENEW);
return tokenRequest(loginInput);
}

private static SFLoginOutput tokenRequest(SFLoginInput loginInput, TokenRequestType requestType)
private static SFLoginOutput tokenRequest(SFLoginInput loginInput)
throws SFException, SnowflakeSQLException {
AssertUtil.assertTrue(loginInput.getServerUrl() != null, "missing server URL for tokenRequest");

Expand Down Expand Up @@ -1140,7 +1133,7 @@ private static SFLoginOutput tokenRequest(SFLoginInput loginInput, TokenRequestT
Map<String, String> payload = new HashMap<>();
String headerToken = loginInput.getMasterToken();
payload.put("oldSessionToken", loginInput.getSessionToken());
payload.put("requestType", requestType.value);
payload.put("requestType", TokenRequestType.RENEW.value);
String json = mapper.writeValueAsString(payload);

// attach the login info json body to the post request
Expand All @@ -1163,7 +1156,7 @@ private static SFLoginOutput tokenRequest(SFLoginInput loginInput, TokenRequestT

logger.debug(
"Request type: {}, old session token: {}, " + "master token: {}",
requestType.value,
TokenRequestType.RENEW.value,
(ArgSupplier) () -> loginInput.getSessionToken() != null ? "******" : null,
(ArgSupplier) () -> loginInput.getMasterToken() != null ? "******" : null);

Expand Down

0 comments on commit d1f3114

Please sign in to comment.