Repository navigation
Conversation
…n subject A client that signs in a user can get a Google credential for that user at query time. The driver could not take two kinds of it. Add the auth type access_token with the option bigquery.auth.access_token. The driver sends the OAuth 2.0 access token as it is, and never refreshes it. An empty token is refused. Every other auth type ignores the token, so the driver refuses a token that the auth type does not select, and a token that is set together with an impersonation option, because impersonation replaces the base credential. Add the option bigquery.impersonate.subject. The driver copies it into impersonate.CredentialsConfig.Subject, which enables domain-wide delegation without a service account key. A subject without a target principal is refused, as any impersonation option is. Both options can be read with GetOption. They have no URI parameter. Closes adbc-drivers#333
lidavidm
left a comment
There was a problem hiding this comment.
Warning
Automated review generated by GPT-6.1 Sol.
Adds caller-provided access tokens and an impersonation subject. One credential-propagation issue is noted inline.
- [P0] Shorten the description to the motivation and significant design decisions; remove the test inventory, mutation-testing report, and command results. Complete the required validation before submission and add the required
Assisted-by:trailer.
| } | ||
| } | ||
| c.Logger.Debug("Using a static OAuth access token") | ||
| authOptions = append(authOptions, option.WithTokenSource(oauth2.StaticTokenSource(&oauth2.Token{AccessToken: c.accessToken}))) |
There was a problem hiding this comment.
[P1] Preserve the caller’s identity for Storage Write ingestion. With auth_type=access_token and bulk_ingest.method=storage_write, the separately constructed write client receives no token and falls back to ADC. Token-only deployments therefore fail, while deployments with ADC write as the host identity instead of the caller. Although the underlying omission predates this PR, the new auth mode exposes it too. Pass the selected credential to the write client, or reject this combination before ingestion.
There was a problem hiding this comment.
Are you fine with my last commit to address this?
Reject the unsupported combination before table or stream requests can fall back to ADC. Document load ingestion as the supported alternative and cover connection and statement options through both execution paths. Assisted-by: OpenAI Codex (GPT-6)
| `bigquery.auth.access_token` | ||
| : **Type:** string. **Default:** (empty) | ||
|
|
||
| If using `access_token` authentication, this is the OAuth 2.0 access token. The driver sends it as it is and does not refresh it, so it must stay valid for the life of the connection. An empty token is an error. A token set under any other `bigquery.auth_type` is an error, because that auth type would ignore it. A token set together with an impersonation option is also an error, because impersonation would replace it. Storage Write ingestion (`bigquery.bulk_ingest.method=storage_write`) is refused before ingestion because its separate client does not use this token; use the default `load` method instead. |
There was a problem hiding this comment.
| If using `access_token` authentication, this is the OAuth 2.0 access token. The driver sends it as it is and does not refresh it, so it must stay valid for the life of the connection. An empty token is an error. A token set under any other `bigquery.auth_type` is an error, because that auth type would ignore it. A token set together with an impersonation option is also an error, because impersonation would replace it. Storage Write ingestion (`bigquery.bulk_ingest.method=storage_write`) is refused before ingestion because its separate client does not use this token; use the default `load` method instead. | |
| If using `access_token` authentication, this is the OAuth 2.0 access token. The driver does not refresh it, so it must stay valid for the life of the connection. Not compatible with impersonation or Storage Write. |
|
|
||
| authOptions := []option.ClientOption{} | ||
|
|
||
| // Every other arm ignores the token, which would drop it silently. |
There was a problem hiding this comment.
| // Every other arm ignores the token, which would drop it silently. |
| // newImpersonatedTokenSource is a variable so that a test can observe the impersonation config. | ||
| var newImpersonatedTokenSource = impersonate.CredentialsTokenSource |
There was a problem hiding this comment.
I really dislike tests that rely on globals like this. This is a -1.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Addressed the review feedback. |
What's Changed
Allow applications to supply an OAuth 2.0 access token through
bigquery.auth_type=access_tokenandbigquery.auth.access_token. The driver uses the token without refreshing it.Add
bigquery.impersonate.subjectfor domain-wide delegation through the existing ADC-backed impersonation path. A subject requires a target principal.Closes #333.
Generated-by: OpenAI Codex