Repository: snowflakedb/gosnowflake
Pull request #1388 (2025-04-29 10:28:35)

SNOW-1825500 Drop PrPr flag for oauth and pat
### Description

SNOW-1825500 Drop PrPr flag for oauth and pat

### Checklist
- [x] Created tests which fail without the change (if possible)
- [x] Extended the README / documentation, if necessary


sfc-gh-snowflakedb-snyk-sa: ![](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)

### :tada: **Snyk checks have passed. No issues have been found so far.**

:white_check_mark: **security/snyk** check is complete. No issues have been found. [(View Details)](https://app.snyk.io/org/snowflakedb-sca-scanning-public-repo/pr-checks/569b9a17-5ff7-411a-ae71-084444b12d59?refs=63a2074469451b80505165ef657e686f40b9569a&source=prChecksComment)

:white_check_mark: **license/snyk** check is complete. No issues have been found. [(View Details)](https://app.snyk.io/org/snowflakedb-sca-scanning-public-repo/pr-checks/569b9a17-5ff7-411a-ae71-084444b12d59/license?refs=63a2074469451b80505165ef657e686f40b9569a&source=prChecksComment)



codecov[bot]: ## [Codecov](https://app.codecov.io/gh/snowflakedb/gosnowflake/pull/1388?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=snowflakedb) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Project coverage is 82.08%. Comparing base [(`3bc1bf8`)](https://app.codecov.io/gh/snowflakedb/gosnowflake/commit/3bc1bf89eab85f9a0f4c2dc6c00386ab0b5f4c4b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=snowflakedb) to head [(`63a2074`)](https://app.codecov.io/gh/snowflakedb/gosnowflake/commit/63a2074469451b80505165ef657e686f40b9569a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=snowflakedb).
> Report is 1 commits behind head on master.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##           master    #1388      +/-   ##
==========================================
+ Coverage   82.05%   82.08%   +0.02%     
==========================================
  Files          58       58              
  Lines       14413    14401      -12     
==========================================
- Hits        11827    11821       -6     
+ Misses       2586     2580       -6     
```

</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/snowflakedb/gosnowflake/pull/1388?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=snowflakedb).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=snowflakedb).

<details><summary> :rocket: New features to boost your workflow: </summary>

- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>

Patch:
diff --git a/Jenkinsfile b/Jenkinsfile
index 3a13898..f5d62f0 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -53,8 +53,6 @@ pipeline {
     // remove SCM URL + .git at the end
 
     BASELINE_BRANCH = "${env.CHANGE_TARGET}"
-
-    SF_ENABLE_EXPERIMENTAL_AUTHENTICATION = true
   }
   stages {
     stage('Checkout') {
diff --git a/auth.go b/auth.go
index 1edda0f..79818d6 100644
--- a/auth.go
+++ b/auth.go
@@ -11,7 +11,6 @@ import (
 	"io"
 	"net/http"
 	"net/url"
-	"os"
 	"runtime"
 	"slices"
 	"strconv"
@@ -88,13 +87,13 @@ func determineAuthenticatorType(cfg *Config, value string) error {
 	} else if upperCaseValue == AuthTypeTokenAccessor.String() {
 		cfg.Authenticator = AuthTypeTokenAccessor
 		return nil
-	} else if upperCaseValue == AuthTypePat.String() && experimentalAuthEnabled() {
+	} else if upperCaseValue == AuthTypePat.String() {
 		cfg.Authenticator = AuthTypePat
 		return nil
-	} else if upperCaseValue == AuthTypeOAuthAuthorizationCode.String() && experimentalAuthEnabled() {
+	} else if upperCaseValue == AuthTypeOAuthAuthorizationCode.String() {
 		cfg.Authenticator = AuthTypeOAuthAuthorizationCode
 		return nil
-	} else if upperCaseValue == AuthTypeOAuthClientCredentials.String() && experimentalAuthEnabled() {
+	} else if upperCaseValue == AuthTypeOAuthClientCredentials.String() {
 		cfg.Authenticator = AuthTypeOAuthClientCredentials
 		return nil
 	} else {
@@ -476,9 +475,6 @@ func createRequestBody(sc *snowflakeConn, sessionParameters map[string]interface
 		}
 		requestMain.Token = jwtTokenString
 	case AuthTypePat:
-		if !experimentalAuthEnabled() {
-			return nil, errors.New("programmatic access tokens are not ready to use")
-		}
 		logger.WithContext(sc.ctx).Info("Programmatic access token")
 		requestMain.Authenticator = AuthTypePat.String()
 		requestMain.LoginName = sc.cfg.User
@@ -508,9 +504,6 @@ func createRequestBody(sc *snowflakeConn, sessionParameters map[string]interface
 			requestMain.ExtAuthnDuoMethod = "passcode"
 		}
 	case AuthTypeOAuthAuthorizationCode:
-		if !experimentalAuthEnabled() {
-			return nil, errors.New("OAuth2 is not ready to use")
-		}
 		logger.WithContext(sc.ctx).Debug("OAuth authorization code")
 		oauthClient, err := newOauthClient(sc.ctx, sc.cfg)
 		if err != nil {
@@ -524,9 +517,6 @@ func createRequestBody(sc *snowflakeConn, sessionParameters map[string]interface
 		requestMain.Token = token
 		requestMain.OauthType = "OAUTH_AUTHORIZATION_CODE"
 	case AuthTypeOAuthClientCredentials:
-		if !experimentalAuthEnabled() {
-			return nil, errors.New("OAuth2 is not ready to use")
-		}
 		logger.WithContext(sc.ctx).Debug("OAuth client credentials")
 		oauthClient, err := newOauthClient(sc.ctx, sc.cfg)
 		if err != nil {
@@ -671,8 +661,3 @@ func authenticateWithConfig(sc *snowflakeConn) error {
 	sc.ctx = context.WithValue(sc.ctx, SFSessionIDKey, authData.SessionID)
 	return nil
 }
-
-func experimentalAuthEnabled() bool {
-	val, ok := os.LookupEnv("SF_ENABLE_EXPERIMENTAL_AUTHENTICATION")
-	return ok && strings.EqualFold(val, "true")
-}


Test patch:
diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml
index 7e16548..12243c5 100644
--- a/.github/workflows/build-test.yml
+++ b/.github/workflows/build-test.yml
@@ -67,7 +67,6 @@ jobs:
                 GO_TEST_PARAMS: ${{ inputs.goTestParams }}
                 WIREMOCK_PORT: 14335
                 WIREMOCK_HTTPS_PORT: 13567
-                SF_ENABLE_EXPERIMENTAL_AUTHENTICATION: true
               run: ./ci/test.sh
             - name: Upload coverage to Codecov
               uses: codecov/codecov-action@v5
@@ -99,7 +98,6 @@ jobs:
                 GO_TEST_PARAMS: ${{ inputs.goTestParams }}
                 WIREMOCK_PORT: 14335
                 WIREMOCK_HTTPS_PORT: 13567
-                SF_ENABLE_EXPERIMENTAL_AUTHENTICATION: true
               run: ./ci/test.sh
             - name: Upload coverage to Codecov
               uses: codecov/codecov-action@v5
@@ -135,7 +133,6 @@ jobs:
                 GO_TEST_PARAMS: ${{ inputs.goTestParams }}
                 WIREMOCK_PORT: 14335
                 WIREMOCK_HTTPS_PORT: 13567
-                SF_ENABLE_EXPERIMENTAL_AUTHENTICATION: true
               run: ci\\test.bat
             - name: Upload coverage to Codecov
               uses: codecov/codecov-action@v5
diff --git a/ci/container/test_authentication.sh b/ci/container/test_authentication.sh
index d5c2c10..85745d2 100755
--- a/ci/container/test_authentication.sh
+++ b/ci/container/test_authentication.sh
@@ -8,7 +8,6 @@ eval $(jq -r '.authtestparams | to_entries | map("export \(.key)=\(.value|tostri
 export SNOWFLAKE_AUTH_TEST_PRIVATE_KEY_PATH=./.github/workflows/rsa_keys/rsa_key.p8
 export SNOWFLAKE_AUTH_TEST_INVALID_PRIVATE_KEY_PATH=./.github/workflows/rsa_keys/rsa_key_invalid.p8
 export RUN_AUTH_TESTS=true
-export SF_ENABLE_EXPERIMENTAL_AUTHENTICATION=true
 
 export AUTHENTICATION_TESTS_ENV="docker"
 
diff --git a/ci/test.sh b/ci/test.sh
index f94f24f..b92e447 100755
--- a/ci/test.sh
+++ b/ci/test.sh
@@ -57,7 +57,6 @@ if [[ -n "$JENKINS_HOME" ]]; then
           -e JOB_NAME \
           -e BUILD_NUMBER \
           -e JENKINS_HOME \
-          -e SF_ENABLE_EXPERIMENTAL_AUTHENTICATION=true \
           ${TEST_IMAGE_NAMES[$name]} \
           /mnt/host/ci/container/test_component.sh
           echo "[INFO] Test Results: $WORKSPACE/junit.xml"