Skip to content

Extract credentials from URI in Neo4j auto-configuration - #52901

Open
manthansharma6767 wants to merge 1 commit into
spring-projects:mainfrom
manthansharma6767:fix/extract-neo4j-credentials-from-uri
Open

manthansharma6767 wants to merge 1 commit into
spring-projects:mainfrom
manthansharma6767:fix/extract-neo4j-credentials-from-uri

Conversation

@manthansharma6767

Copy link
Copy Markdown
Contributor

When configuring Neo4j via spring.neo4j.uri with embedded credentials (e.g., bolt://user:secret@localhost:7687), PropertiesNeo4jConnectionDetails.getAuthToken() previously returned AuthTokens.none() if explicit spring.neo4j.authentication.* properties were not set.

This PR updates PropertiesNeo4jConnectionDetails to:

  • Fall back to extracting and URL-decoding any username and password present in spring.neo4j.uri when spring.neo4j.authentication.username and kerberosTicket are not specified.
  • Retain precedence for explicitly configured authentication properties (username / password / kerberosTicket).
  • Add comprehensive test coverage in Neo4jAutoConfigurationTests for standard credentials, percent-encoded characters, and property precedence.

When spring.neo4j.uri contains user info and explicit authentication
properties (username/password/kerberosTicket) are not configured,
extract and URL-decode credentials from the URI rather than defaulting
to AuthTokens.none().

Signed-off-by: Manthan Sharma <manthansharma795@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted. label Nov 23, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue that has not yet been triaged. Contributions will not be accepted.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants