Skip to content

Commit 5e69a93

Browse files
NO-SNOW: Remove requirement for WIF experimental flag (#2275)
1 parent 7888c0a commit 5e69a93

File tree

5 files changed

+0
-66
lines changed

5 files changed

+0
-66
lines changed

ci/container/test_authentication.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ MVNW_EXE=$SOURCE_ROOT/mvnw
99
AUTH_PARAMETER_FILE=./.github/workflows/parameters_aws_auth_tests.json
1010
eval $(jq -r '.authtestparams | to_entries | map("export \(.key)=\(.value|tostring)")|.[]' $AUTH_PARAMETER_FILE)
1111

12-
export SF_ENABLE_EXPERIMENTAL_AUTHENTICATION=true
13-
1412
$MVNW_EXE -DjenkinsIT \
1513
-Dnet.snowflake.jdbc.temporaryCredentialCacheDir=/mnt/workspace/abc \
1614
-Dnet.snowflake.jdbc.ocspResponseCacheDir=/mnt/workspace/abc \

ci/container/test_component.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ cd $SOURCE_ROOT
7676
# Avoid connection timeout on plugin dependency fetch or fail-fast when dependency cannot be fetched
7777
$MVNW_EXE --batch-mode --show-version dependency:go-offline
7878

79-
export SF_ENABLE_EXPERIMENTAL_AUTHENTICATION=true
80-
8179
if [[ "$is_old_driver" == "true" ]]; then
8280
pushd TestOnly >& /dev/null
8381
JDBC_VERSION=$($MVNW_EXE org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version --batch-mode | grep -v "[INFO]")

ci/test_windows.bat

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ echo "MAVEN OPTIONS %MAVEN_OPTS%"
111111
REM Avoid connection timeout on plugin dependency fetch or fail-fast when dependency cannot be fetched
112112
cmd /c %MVNW_EXE% --batch-mode --show-version dependency:go-offline
113113

114-
set SF_ENABLE_EXPERIMENTAL_AUTHENTICATION=true
115-
116114
if "%JDBC_TEST_SUITES%"=="FipsTestSuite" (
117115
pushd FIPS
118116
echo "[INFO] Run Fips tests"

src/main/java/net/snowflake/client/core/SessionUtil.java

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import static net.snowflake.client.core.SFTrustManager.resetOCSPResponseCacherServerURL;
44
import static net.snowflake.client.core.SFTrustManager.setOCSPResponseCacheServerURL;
55
import static net.snowflake.client.jdbc.SnowflakeUtil.isNullOrEmpty;
6-
import static net.snowflake.client.jdbc.SnowflakeUtil.systemGetEnv;
76
import static net.snowflake.client.jdbc.SnowflakeUtil.systemGetProperty;
87

98
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -300,7 +299,6 @@ static SFLoginOutput openSession(
300299
loginInput.getLoginTimeout() >= 0, "negative login timeout for opening session");
301300

302301
final AuthenticatorType authenticator = getAuthenticator(loginInput);
303-
checkIfExperimentalAuthnEnabled(authenticator);
304302

305303
if (isTokenOrPasswordRequired(authenticator)) {
306304
AssertUtil.assertTrue(
@@ -402,16 +400,6 @@ private static WorkloadIdentityAttestation getWorkloadIdentityAttestation(SFLogi
402400
return attestationProvider.getAttestation(loginInput.getWorkloadIdentityProvider());
403401
}
404402

405-
static void checkIfExperimentalAuthnEnabled(AuthenticatorType authenticator) throws SFException {
406-
if (authenticator.equals(AuthenticatorType.WORKLOAD_IDENTITY)) {
407-
boolean experimentalAuthenticationMethodsEnabled =
408-
Boolean.parseBoolean(systemGetEnv("SF_ENABLE_EXPERIMENTAL_AUTHENTICATION"));
409-
AssertUtil.assertTrue(
410-
experimentalAuthenticationMethodsEnabled,
411-
"Following authentication method not yet supported: " + authenticator);
412-
}
413-
}
414-
415403
private static boolean isEligibleForTokenCaching(AuthenticatorType authenticator) {
416404
return authenticator.equals(AuthenticatorType.EXTERNALBROWSER)
417405
|| authenticator.equals(AuthenticatorType.OAUTH_AUTHORIZATION_CODE)

src/test/java/net/snowflake/client/core/SessionUtilTest.java

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
package net.snowflake.client.core;
22

33
import static org.hamcrest.MatcherAssert.assertThat;
4-
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
54
import static org.junit.jupiter.api.Assertions.assertEquals;
65
import static org.junit.jupiter.api.Assertions.assertFalse;
7-
import static org.junit.jupiter.api.Assertions.assertThrows;
86
import static org.junit.jupiter.api.Assertions.assertTrue;
97
import static org.junit.jupiter.api.Assertions.fail;
10-
import static org.mockito.Mockito.mockStatic;
118

129
import com.fasterxml.jackson.databind.ObjectMapper;
1310
import com.fasterxml.jackson.databind.node.BooleanNode;
@@ -18,15 +15,12 @@
1815
import java.util.HashMap;
1916
import java.util.List;
2017
import java.util.Map;
21-
import net.snowflake.client.core.auth.AuthenticatorType;
2218
import net.snowflake.client.jdbc.MockConnectionTest;
23-
import net.snowflake.client.jdbc.SnowflakeUtil;
2419
import org.apache.http.client.methods.HttpPost;
2520
import org.apache.http.client.utils.URIBuilder;
2621
import org.junit.jupiter.api.AfterAll;
2722
import org.junit.jupiter.api.BeforeAll;
2823
import org.junit.jupiter.api.Test;
29-
import org.mockito.MockedStatic;
3024

3125
public class SessionUtilTest {
3226
private static String originalUrlValue;
@@ -250,48 +244,6 @@ public void testGetCommonParams() throws Exception {
250244
assertEquals("value", result.get("TIMEZONE"));
251245
}
252246

253-
@Test
254-
public void shouldProperlyCheckIfExperimentalAuthEnabled() {
255-
try (MockedStatic<SnowflakeUtil> snowflakeUtilMockedStatic = mockStatic(SnowflakeUtil.class)) {
256-
snowflakeUtilMockedStatic
257-
.when(() -> SnowflakeUtil.systemGetEnv("SF_ENABLE_EXPERIMENTAL_AUTHENTICATION"))
258-
.thenReturn(null);
259-
assertDoesNotThrow(
260-
() ->
261-
SessionUtil.checkIfExperimentalAuthnEnabled(
262-
AuthenticatorType.OAUTH_AUTHORIZATION_CODE));
263-
assertDoesNotThrow(
264-
() ->
265-
SessionUtil.checkIfExperimentalAuthnEnabled(
266-
AuthenticatorType.OAUTH_CLIENT_CREDENTIALS));
267-
assertDoesNotThrow(
268-
() ->
269-
SessionUtil.checkIfExperimentalAuthnEnabled(
270-
AuthenticatorType.PROGRAMMATIC_ACCESS_TOKEN));
271-
assertThrows(
272-
SFException.class,
273-
() -> SessionUtil.checkIfExperimentalAuthnEnabled(AuthenticatorType.WORKLOAD_IDENTITY));
274-
275-
snowflakeUtilMockedStatic
276-
.when(() -> SnowflakeUtil.systemGetEnv("SF_ENABLE_EXPERIMENTAL_AUTHENTICATION"))
277-
.thenReturn("true");
278-
assertDoesNotThrow(
279-
() ->
280-
SessionUtil.checkIfExperimentalAuthnEnabled(
281-
AuthenticatorType.OAUTH_AUTHORIZATION_CODE));
282-
assertDoesNotThrow(
283-
() ->
284-
SessionUtil.checkIfExperimentalAuthnEnabled(
285-
AuthenticatorType.OAUTH_CLIENT_CREDENTIALS));
286-
assertDoesNotThrow(
287-
() ->
288-
SessionUtil.checkIfExperimentalAuthnEnabled(
289-
AuthenticatorType.PROGRAMMATIC_ACCESS_TOKEN));
290-
assertDoesNotThrow(
291-
() -> SessionUtil.checkIfExperimentalAuthnEnabled(AuthenticatorType.WORKLOAD_IDENTITY));
292-
}
293-
}
294-
295247
private void resetOcspConfiguration() {
296248
SFTrustManager.SF_OCSP_RESPONSE_CACHE_SERVER_URL_VALUE = null;
297249
SFTrustManager.SF_OCSP_RESPONSE_CACHE_SERVER_RETRY_URL_PATTERN = null;

0 commit comments

Comments
 (0)