Skip to content

added credentialsRefresher #1

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
Closed

added credentialsRefresher #1

wants to merge 3 commits into from

Conversation

vkagamlyk
Copy link

@vkagamlyk vkagamlyk commented Jan 9, 2023

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 neo4j#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
    }
  );
}

Copy link

@Cole-Greer Cole-Greer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test which validates the refresher works and also demonstrates its use?

@Cole-Greer
Copy link

LGTM

@vkagamlyk
Copy link
Author

opened as neo4j#1051

@vkagamlyk vkagamlyk closed this Jan 13, 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