Skip to content

Commit

Permalink
SNOW-1940294: Convert string CLIENT_REQUEST_MFA_TOKEN to boolean (#2089)
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-dprzybysz authored Feb 20, 2025
1 parent 087647d commit dcb60b2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/net/snowflake/client/core/SessionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ static SFLoginOutput openSession(
}
}

convertSessionParameterStringValueToBooleanIfGiven(loginInput, CLIENT_REQUEST_MFA_TOKEN);

preNewSession(loginInput);

try {
Expand All @@ -317,6 +319,16 @@ static SFLoginOutput openSession(
}
}

private static void convertSessionParameterStringValueToBooleanIfGiven(
SFLoginInput loginInput, String parameterName) {
Object currentClientRequestMfaToken = loginInput.getSessionParameters().get(parameterName);
if (currentClientRequestMfaToken instanceof String) {
loginInput
.getSessionParameters()
.put(parameterName, Boolean.parseBoolean((String) currentClientRequestMfaToken));
}
}

private static void preNewSession(SFLoginInput loginInput) throws SFException {
if (asBoolean(loginInput.getSessionParameters().get(CLIENT_STORE_TEMPORARY_CREDENTIAL))) {
CredentialManager.getInstance().fillCachedIdToken(loginInput);
Expand Down

0 comments on commit dcb60b2

Please sign in to comment.