Skip to content

Commit

Permalink
SNOW-916949: Fix throwing an exception for correct authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-ext-simba-lf committed Feb 9, 2024
1 parent 14bec01 commit 1d6ac86
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 12 deletions.
45 changes: 36 additions & 9 deletions Snowflake.Data.Tests/Mock/MockOkta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,45 @@ public Task<T> PostAsync<T>(IRestRequest postRequest, CancellationToken cancella
{
if (postRequest is SFRestRequest)
{
// authenticator
var authnResponse = new AuthenticatorResponse
if (((SFRestRequest)postRequest).jsonBody is AuthenticatorRequest)
{
success = true,
data = new AuthenticatorResponseData
// authenticator
var authnResponse = new AuthenticatorResponse
{
tokenUrl = TokenUrl,
ssoUrl = SSOUrl,
}
};
success = true,
data = new AuthenticatorResponseData
{
tokenUrl = TokenUrl,
ssoUrl = SSOUrl,
}
};

return Task.FromResult<T>((T)(object)authnResponse);
}
else
{
// login
var loginResponse = new LoginResponse
{
success = true,
data = new LoginResponseData
{
sessionId = "",
token = "",
masterToken = "",
masterValidityInSeconds = 0,
authResponseSessionInfo = new SessionInfo
{
databaseName = "",
schemaName = "",
roleName = "",
warehouseName = "",
}
}
};

return Task.FromResult<T>((T)(object)authnResponse);
return Task.FromResult<T>((T)(object)loginResponse);
}
}
else
{
Expand Down
Loading

0 comments on commit 1d6ac86

Please sign in to comment.