ruowan commented on code in PR #1323:
URL: https://github.com/apache/arrow-adbc/pull/1323#discussion_r1410334476
##########
csharp/test/Drivers/Snowflake/ClientTests.cs:
##########
@@ -228,22 +228,37 @@ private Adbc.Client.AdbcConnection
GetSnowflakeAdbcConnectionUsingConnectionStri
builder[SnowflakeParameters.HOST] = testConfiguration.Host;
builder[SnowflakeParameters.DATABASE] = testConfiguration.Database;
builder[SnowflakeParameters.USERNAME] = testConfiguration.User;
- if
(!string.IsNullOrEmpty(testConfiguration.AuthenticationTokenPath))
+ if (authType == SnowflakeAuthentication.AuthJwt)
{
- builder[SnowflakeParameters.AUTH_TYPE] =
testConfiguration.AuthenticationType;
- string privateKey =
File.ReadAllText(testConfiguration.AuthenticationTokenPath);
- if (testConfiguration.AuthenticationType.Equals("auth_jwt",
StringComparison.OrdinalIgnoreCase))
+ string privateKeyFile =
testConfiguration.Authentication.SnowflakeJwt.PrivateKeyFile;
+ string privateKey =
testConfiguration.Authentication.SnowflakeJwt.PrivateKey;
+
+ if (privateKeyFile != null)
{
- builder[SnowflakeParameters.PKCS8_VALUE] = privateKey;
- if(!string.IsNullOrEmpty(testConfiguration.Pkcs8Passcode))
- {
- builder[SnowflakeParameters.PKCS8_PASS] =
testConfiguration.Pkcs8Passcode;
- }
+ privateKey = File.ReadAllText(privateKeyFile);
+ }
+ builder[SnowflakeParameters.AUTH_TYPE] =
SnowflakeAuthentication.AuthJwt;
+ builder[SnowflakeParameters.PKCS8_VALUE] = privateKey;
+ builder[SnowflakeParameters.USERNAME] =
testConfiguration.Authentication.SnowflakeJwt.User;
+ if
(!string.IsNullOrEmpty(testConfiguration.Authentication.SnowflakeJwt.PrivateKeyPassPhrase))
+ {
+ builder[SnowflakeParameters.PKCS8_PASS] =
testConfiguration.Authentication.SnowflakeJwt.PrivateKeyPassPhrase;
+ }
+ }
+ else if (authType == SnowflakeAuthentication.AuthOAuth)
+ {
+ builder[SnowflakeParameters.AUTH_TYPE] =
SnowflakeAuthentication.AuthOAuth;
+ builder[SnowflakeParameters.AUTH_TOKEN] =
testConfiguration.Authentication.OAuth.Token;
+ if (testConfiguration.Authentication.OAuth.User != null)
+ {
+ builder[SnowflakeParameters.USERNAME] =
testConfiguration.Authentication.OAuth.User;
}
}
else
{
- builder[SnowflakeParameters.PASSWORD] =
testConfiguration.Password;
+ // default basic auth
Review Comment:
Changed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]