Closed vkagamlyk closed 1 year ago
I signed CLA
Any updates on this? Definitely something I'm looking forward to use.
Hi vkagamlyk,
Reiterating our reply on you PR for the python driver. Thank you for the effort and time spent on these PRs. We have ongoing work to implement a refresh mechanism on the drivers in a more general way that should be released Q1 of this year (all things going well that is).
There are considerations to be made around the interaction of a token refresh, the retry mechanism that the drivers supply and the connection pooling. This is why our solution is more involved.
As a side note, did you intend to raise the PR against the 4.3 version of the driver? This version is out of support and will not be updated. The current LTS version is 4.4, and the latest driver version is 5.4.
Add the ability to Refresh Auth Token Credentials
Currently when credentials expire, GraphDatabase.Driver will continue trying to connect with the outdated login/password. There is no ability to update or refresh login credentials (See https://github.com/neo4j/neo4j-dotnet-driver/issues/664).
This PR introduces the ability to pass an optional tokenRefresher function to an AuthToken object which will change credentials as they become obsolete.
There are no breaking changes introduced in this PR.
There is a test which validates these modifications by using a simple tokenRefresher which increments the credentials and verifies that the auth token is being updated as expected.
Also tested with connection idle timeout 20 seconds and interval between requests 30 seconds, new credentials were correctly used to create a new connection.
Intended use
var authToken = new SecretsProvider().GetNeo4jToken(); var driver = GraphDatabase.Driver(Url, authToken, o => o.WithEncryptionLevel(EncryptionLevel.Encrypted));
GetNeo4jToken
will receive credits from the secret manager and update them if necessary. This is useful because when changing the password, there is no need to restart the microservices that are connected to the database.