-
Notifications
You must be signed in to change notification settings - Fork 141
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
SNOW-715524: Add SSO token cache #921
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #921 +/- ##
==========================================
+ Coverage 86.23% 87.49% +1.25%
==========================================
Files 132 133 +1
Lines 12664 12721 +57
Branches 1299 1305 +6
==========================================
+ Hits 10921 11130 +209
+ Misses 1417 1267 -150
+ Partials 326 324 -2 ☔ View full report in Codecov by Sentry. |
…nector-net into SNOW-715524-SSO-Token-Cache
…nector-net into SNOW-715524-SSO-Token-Cache
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerFactory.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerFactory.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerAdysTechImpl.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerAdysTechImpl.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerFileImpl.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerInMemoryImpl.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerInMemoryImpl.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerInMemoryImpl.cs
Outdated
Show resolved
Hide resolved
Any updates on this PR ? Can I help ? I been waiting for this SSO Token Cache for long time |
Currently we're trying out different libraries/packages for the credential manager. Then it'll be reviewed if it meets the security requirements |
Snowflake.Data/Client/SnowflakeCredentialManager/ISnowflakeCredentialManager.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerFactory.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerFactory.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerFactory.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerFactory.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerInMemoryImpl.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerInMemoryImpl.cs
Outdated
Show resolved
Hide resolved
Snowflake.Data/Client/SnowflakeCredentialManager/SnowflakeCredentialManagerFactory.cs
Outdated
Show resolved
Hide resolved
|
||
namespace Snowflake.Data.Client | ||
{ | ||
public class SnowflakeCredentialManagerNativeImpl : ISnowflakeCredentialManager |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move all the implementations into subpackage Infrastructure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…nector-net into SNOW-715524-SSO-Token-Cache # Conflicts: # Snowflake.Data.Tests/UnitTests/SFSessionPropertyTest.cs
…nector-net into SNOW-715524-SSO-Token-Cache
…nector-net into SNOW-715524-SSO-Token-Cache
…nector-net into SNOW-715524-SSO-Token-Cache # Conflicts: # Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs
…nector-net into SNOW-715524-SSO-Token-Cache # Conflicts: # Snowflake.Data/Core/SFError.cs
…nector-net into SNOW-715524-SSO-Token-Cache # Conflicts: # Snowflake.Data.Tests/IntegrationTests/SFConnectionIT.cs # Snowflake.Data.Tests/UnitTests/SFSessionPropertyTest.cs # Snowflake.Data/Core/Authenticator/ExternalBrowserAuthenticator.cs # Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerFileImpl.cs # Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerInMemoryImpl.cs # Snowflake.Data/Core/CredentialManager/Infrastructure/SFCredentialManagerWindowsNativeImpl.cs # Snowflake.Data/Core/RestResponse.cs # Snowflake.Data/Core/SFError.cs # Snowflake.Data/Core/Session/SFSession.cs # Snowflake.Data/Core/Session/SFSessionParameter.cs # Snowflake.Data/Core/Session/SFSessionProperty.cs # Snowflake.Data/Core/Tools/FileOperations.cs # Snowflake.Data/Core/Tools/UnixOperations.cs # doc/Connecting.md
…nector-net into SNOW-715524-SSO-Token-Cache
…flakedb/snowflake-connector-net into SNOW-715524-SSO-Token-Cache
|
||
int localPort = GetRandomUnusedPort(); | ||
using (var httpListener = GetHttpListener(localPort)) | ||
var idToken = new NetworkCredential(string.Empty, session._idToken).Password; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use SecureStringHelper.Decode()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
data.Token = _samlResponseToken; | ||
data.ProofKey = _proofKey; | ||
SetSecondaryAuthenticationData(ref data); | ||
var idToken = new NetworkCredential(string.Empty, session._idToken).Password; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could use SecureStringHelper.Decode()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
else | ||
{ | ||
data.Token = idToken; | ||
data.Authenticator = TokenType.IdToken.GetAttribute<StringAttr>().value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be id_token not externalbrowser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's for the server response to contain an ID token
It's similar to how other connectors handle it: https://github.com/snowflakedb/snowflake-connector-nodejs/blob/9cae04323ef4f76d91342e80cfef39952fe652c3/lib/authentication/auth_idtoken.js#L28
} | ||
s_logger.Info("Unable to get credentials for the specified key"); | ||
return ""; | ||
s_logger.Debug($"Getting credentials from memory for key: {key}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this extra tab is not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I'm not able to see an extra tab. I checked with the formatter and it doesn't find anything either
@@ -12,7 +12,6 @@ | |||
|
|||
namespace Snowflake.Data.Core.CredentialManager.Infrastructure | |||
{ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would revert this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
Description
Add SSO token cache
Checklist
dotnet test
)