Commit 6022ff8
Add per-HTTP-attempt timeout for non-JWT authentication
Mirror the existing JWTClient / JWTClientTimeout pattern for general
(non-JWT) authentication so callers can bound per-HTTP-attempt time for
auth requests independently of the query timeout.
Before this change, gosnowflake routed JWT auth through a dedicated
JWTClient (default 10s) but every other authenticator (warehouse password,
native OAuth, MFA, SSO, PAT, external browser) shared the main Client
with the query path (default ClientTimeout = 900s). That meant downstream
callers like dbt-fusion could not tighten the per-attempt auth timeout
without also limiting how long queries can run.
Changes:
- New AuthClient *http.Client field on snowflakeRestful, instantiated
from sc.cfg.AuthClientTimeout in connection.go.
- getClientFor() now returns AuthClient for any non-JWT authenticator,
falling back to Client when AuthClient is nil (for tests/callers that
build snowflakeRestful directly without going through the standard
connection path).
- New Config.AuthClientTimeout field with defaultAuthClientTimeout = 60s
(matches snowflake-connector-python's per-call requests timeout for
auth requests; see auth/by_plugin.py).
- DSN serialization and parsing for the authClientTimeout key, plus
default-fill logic in FillMissingConfigParameters.
JWT auth path is unchanged. Query path is unchanged. Existing fixtures
in dsn_test.go are extended with the new defaulted field.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 337c068 commit 6022ff8
4 files changed
Lines changed: 126 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
916 | 916 | | |
917 | 917 | | |
918 | 918 | | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
919 | 928 | | |
920 | 929 | | |
921 | 930 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
103 | 104 | | |
104 | 105 | | |
105 | 106 | | |
| 107 | + | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| |||
303 | 306 | | |
304 | 307 | | |
305 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
306 | 312 | | |
307 | 313 | | |
308 | 314 | | |
| |||
651 | 657 | | |
652 | 658 | | |
653 | 659 | | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
654 | 663 | | |
655 | 664 | | |
656 | 665 | | |
| |||
918 | 927 | | |
919 | 928 | | |
920 | 929 | | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
921 | 935 | | |
922 | 936 | | |
923 | 937 | | |
| |||
0 commit comments