Skip to content
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

Add http auth header on :GET, :POST etc requests when appropriate #559

Merged
merged 1 commit into from
May 26, 2017

Conversation

oskarhane
Copy link
Member

Info

If a requested url matches any of these criterias, the Authorization header will be added to requests from the commands :GET, :POST etc.

  1. is local url (no host defined, i.e. :GET /db/data)
  2. has same host (protocol, hostname, port) as from where the browser is hosted ( i.e. :GET http://localhost:7474/db/data/ from a browser host on http://localhost:7474)
  3. has the same hostname as the active database connection (i.e. :GET http://localhost:7474/db/data/ from a browser which is connected to Neo4j on bolt://localhost:7687)

(the reason we need (2) above is because the bolt host can be different from the host where the browser is served from even though it's the same machine)

Manual test cases

Open the web browsers dev tools, network tab.

  • :GET /hello - Should include authorization header.
  • :GET http://localhost:7474/db/data/ (note trailing slash) - if request when connected to localhost over bolt: should include an authorization header. Response should be available.
  • :GET http://127.0.01:7474/db/data/ - should fail with error code 401 because no auth header present.
  • :GET https://oskarhane-dropshare-eu.s3-eu-central-1.amazonaws.com/conf2-SX8pcCviMC/conf2.json should not include an authorization header. Response should be available.

changelog: Fix missing auth headers on local :GET, :POST etc command requests

If a requested url matches any of these criterias, the `Authorization` header will be added to requests from the commands `:GET`, `:POST` etc.

1. is local url (no host defined, i.e. `:GET /db/data`)
1. has same host (protocol, hostname, port) as from where the browser is hosted ( i.e. `:GET http://localhost:7474/db/data/` from a browser host on `http://localhost:7474`)
1. has the same hostname as the active database connection (i.e. `:GET http://localhost:7474/db/data/` from a browser which is connected to Neo4j on `bolt://localhost:7687`)

(the reason we need #2 above is because the bolt host can be different from the host where the browser is served from even though it's the same machine)
@pe4cey pe4cey merged commit 53c5ddc into neo4j:3.0 May 26, 2017
@oskarhane oskarhane deleted the 3.0-http-auth-headers branch June 14, 2017 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants