Skip to content

Add the ability to Refresh Auth Token Credentials #1051

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

Closed
wants to merge 3 commits into from

Conversation

vkagamlyk
Copy link

Add the ability to Refresh Auth Token Credentials

Currently when credentials expire, driver will continue trying to connect with the outdated credentials. There is no ability to update or refresh login credentials (See #993).

This PR introduces the ability to pass an optional credentialsRefresher 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 credentialsRefresher not breaks serialization.

Also tested with AWS Neptune, new credentials were correctly used to create a new connection.

Intended use

async function createDriver() {
  let authToken = { scheme: "basic", realm: "realm", principal: "username", credentialsRefresher: signedHeader };

  return neo4j.driver(url, authToken, {
      encrypted: "ENCRYPTION_ON",
      trust: "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES",
      maxConnectionPoolSize: 2,
      maxConnectionLifetime: 2000
    }
  );
}

I'm a first-time contributor and have just signed the CLA

@bigmontz
Copy link
Contributor

Hi and thank you very much for taking the time to work on this PR.

I am really sorry, but I have to close this PR. We've been working on a more general solution for this and other use-cases. There is no estimate yet as to when it will be released but you can see its current state here: #1050

This is planned across all official drivers. Again, I'm sorry for this. Consider contacting us before starting to work a feature PR to help avoid such unlucky situations.

@bigmontz bigmontz closed this Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants