The Snowflake .NET driver provides the ability to cache tokens using different implementations.
The SSO token cache is enabled by setting the parameter client_store_temporary_credential to true. The default value is based on OS:
- Windows: true
- Linux: false
- Mac: false
- In-memory implementation: The most secure option. Stores credentials that persist within the application's runtime
- Windows Credential Manager: The second most secure option. Leverages built-in Windows capabilities to cache tokens in the Windows Credential Manager
- File-based implementation: The least secure option. Stores credentials in a JSON file on the system
- Custom implementation: Users can choose to implement their own version of the cache
Windows
- Windows Credential Manager (default)
- In-memory implementation
Linux
- File-based implementation (default)
- In-memory implementation
Mac
- File-based implementation (default)
- In-memory implementation
To switch the cache type, simply call the following method based on your preference:
- In-memory implementation:
SnowflakeCredentialManagerFactory.UseInMemoryCredentialManager();
- Windows Credential Manager:
SnowflakeCredentialManagerFactory.UseWindowsCredentialManager();
- File-based implementation:
SnowflakeCredentialManagerFactory.UseFileCredentialManager();
- Custom implementation:
SnowflakeCredentialManagerFactory.SetCredentialManager(CustomCredentialManagerImplementation);