-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5489a9b
commit 6c2b04f
Showing
3 changed files
with
158 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
188 changes: 94 additions & 94 deletions
188
Snowflake.Data.Tests/AuthenticationTests/OktaConnection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,94 +1,94 @@ | ||
// /* | ||
// * Copyright (c) 2012-2025 Snowflake Computing Inc. All rights reserved. | ||
// */ | ||
// | ||
// using NUnit.Framework; | ||
// using Snowflake.Data.Core; | ||
// | ||
// namespace Snowflake.Data.Tests.AuthenticationTests | ||
// { | ||
// | ||
// [NonParallelizable] | ||
// public class OktaConnectionTest : SFBaseTest | ||
// { | ||
// private string _connectionString = ""; | ||
// | ||
// [SetUp] | ||
// public void SetUp() | ||
// { | ||
// AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
// | ||
// var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
// _connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
// authTestHelper.CleanBrowserProcess(); | ||
// | ||
// } | ||
// | ||
// [Test, IgnoreOnCI] | ||
// public void TestAuthenticateUsingOktaSuccessful() | ||
// { | ||
// AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
// | ||
// authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
// authTestHelper.VerifyExceptionIsNotThrown(); | ||
// | ||
// } | ||
// | ||
// [Test, IgnoreOnCI] | ||
// public void TestAuthenticateUsingOktaWrongUsernameParam() | ||
// { | ||
// AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
// | ||
// var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
// parameters[SFSessionProperty.USER] = "differentUser"; | ||
// _connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
// | ||
// authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
// authTestHelper.VerifyExceptionIsThrown("401 (Unauthorized)"); | ||
// } | ||
// | ||
// [Test, IgnoreOnCI] | ||
// public void TestAuthenticateUsingOktaWrongCredentials() | ||
// { | ||
// AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
// | ||
// var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
// parameters[SFSessionProperty.USER] = "differentUser"; | ||
// parameters[SFSessionProperty.PASSWORD] = "fakepassword"; | ||
// | ||
// _connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
// | ||
// authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
// authTestHelper.VerifyExceptionIsThrown("401 (Unauthorized)"); | ||
// } | ||
// | ||
// [Test, IgnoreOnCI] | ||
// public void TestAuthenticateUsingOktaWrongUrl() | ||
// { | ||
// AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
// | ||
// var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
// parameters[SFSessionProperty.AUTHENTICATOR] = "https://invalid.okta.com/"; | ||
// | ||
// _connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
// | ||
// authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
// authTestHelper.VerifyExceptionIsThrown("The specified authenticator is not accepted by your Snowflake account configuration"); | ||
// } | ||
// | ||
// | ||
// [Test, IgnoreOnCI] | ||
// public void TestAuthenticateUsingUrlWithoutOkta() | ||
// { | ||
// AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
// | ||
// var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
// parameters[SFSessionProperty.AUTHENTICATOR] = "https://invalid.abc.com/"; | ||
// | ||
// _connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
// | ||
// authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
// authTestHelper.VerifyExceptionIsThrown("Unknown authenticator"); | ||
// } | ||
// } | ||
// } | ||
/* | ||
* Copyright (c) 2012-2025 Snowflake Computing Inc. All rights reserved. | ||
*/ | ||
|
||
using NUnit.Framework; | ||
using Snowflake.Data.Core; | ||
|
||
namespace Snowflake.Data.AuthenticationTests | ||
{ | ||
|
||
[NonParallelizable] | ||
public class OktaConnectionTest | ||
{ | ||
private string _connectionString = ""; | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
|
||
var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
_connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
authTestHelper.CleanBrowserProcess(); | ||
|
||
} | ||
|
||
[Test] | ||
public void TestAuthenticateUsingOktaSuccessful() | ||
{ | ||
AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
|
||
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
authTestHelper.VerifyExceptionIsNotThrown(); | ||
|
||
} | ||
|
||
[Test] | ||
public void TestAuthenticateUsingOktaWrongUsernameParam() | ||
{ | ||
AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
|
||
var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
parameters[SFSessionProperty.USER] = "differentUser"; | ||
_connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
|
||
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
authTestHelper.VerifyExceptionIsThrown("401 (Unauthorized)"); | ||
} | ||
|
||
[Test] | ||
public void TestAuthenticateUsingOktaWrongCredentials() | ||
{ | ||
AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
|
||
var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
parameters[SFSessionProperty.USER] = "differentUser"; | ||
parameters[SFSessionProperty.PASSWORD] = "fakepassword"; | ||
|
||
_connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
|
||
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
authTestHelper.VerifyExceptionIsThrown("401 (Unauthorized)"); | ||
} | ||
|
||
[Test] | ||
public void TestAuthenticateUsingOktaWrongUrl() | ||
{ | ||
AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
|
||
var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
parameters[SFSessionProperty.AUTHENTICATOR] = "https://invalid.okta.com/"; | ||
|
||
_connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
|
||
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
authTestHelper.VerifyExceptionIsThrown("The specified authenticator is not accepted by your Snowflake account configuration"); | ||
} | ||
|
||
|
||
[Test] | ||
public void TestAuthenticateUsingUrlWithoutOkta() | ||
{ | ||
AuthTestHelper authTestHelper = new AuthTestHelper(); | ||
|
||
var parameters = AuthConnectionString.GetOktaConnectionString(); | ||
parameters[SFSessionProperty.AUTHENTICATOR] = "https://invalid.abc.com/"; | ||
|
||
_connectionString = AuthConnectionString.SetOktaConnectionString(parameters); | ||
|
||
authTestHelper.ConnectAndExecuteSimpleQuery(_connectionString); | ||
authTestHelper.VerifyExceptionIsThrown("Unknown authenticator"); | ||
} | ||
} | ||
} |