Skip to content

feat(csharp/src/Drivers/Apache/Spark): Add OAuth access token auth type to Csharp Spark Driver #2579

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

eric-wang-1990
Copy link
Contributor

@eric-wang-1990 eric-wang-1990 commented Mar 6, 2025

Introduce a new OAuth type for adbc.spark.auth_type as oauth.
Introduce a new parameter adbc.spark.access_token which accept the pass through OAuth access token.
Closes #2578

@eric-wang-1990 eric-wang-1990 changed the title add oauth access token Add OAuth access token auth type to Csharp Spark Driver Mar 6, 2025
@eric-wang-1990 eric-wang-1990 changed the title Add OAuth access token auth type to Csharp Spark Driver feat(csharp/src/Drivers/Apache/Spark): Add OAuth access token auth type to Csharp Spark Driver Mar 6, 2025
@@ -205,6 +214,10 @@ private HttpClientHandler NewHttpClientHandler()
{
return new AuthenticationHeaderValue(BasicAuthenticationScheme, Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username}:")));
}
else if (!string.IsNullOrEmpty(access_token) && authType == SparkAuthType.OAuth)
{
return new AuthenticationHeaderValue(BearerAuthenticationScheme, access_token);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like mechanically, the only difference between token and oauth are the names and values of the connection parameters; an adbc.spark.auth_type of token with an adbc.spark.token property produces an identical outcome as an 'adbc.spark.auth_typeofoauthwith anadbc.spark.access_token` property. Is this expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, they should all put the token at the Bearer header.
The reason I add another auth_type and another access_token is to differentiate from existing token mode, and we will need to support other OAuth features like service principal in the future, which will follow the oauth pattern.

@CurtHagenlocher CurtHagenlocher merged commit 4823ca2 into apache:main Mar 12, 2025
5 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

csharp/src/Drivers/Apache/Spark: Support OAuth access token passthrough type
3 participants