Skip to content

Propagate authentication errors #239

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

Merged
merged 3 commits into from
May 4, 2017
Merged

Conversation

lutovich
Copy link
Contributor

@lutovich lutovich commented May 2, 2017

Authentication errors happen during connection initialization when INIT message is send. Server validates provided credentials and then responds with either SUCCESS if credentials are fine or with FAILURE and closes the connection when credentials are wrong. Previously auth errors were not propagated to external observers (including those defined by user's Result promise). This means auth errors were only propagated to Driver.onError callback but all other places received ServiceUnavailable or SessionExpired because of closed connection.

This commit makes driver treat INIT error as fatal and corresponding connection as broken. Initialization error is memorized and propagated to all message observers. So they see specific failure reason and not generic ServiceUnavailable \ SessionExpired.

Fixes #233

lutovich added 3 commits May 2, 2017 15:21
Authentication errors happen during connection initialization when INIT
message is send. Server validates provided credentials and then responds
with either SUCCESS if credentials are fine or with FAILURE and closes
the connection when credentials are wrong. Previously auth errors were
not propagated to external observers (including those defined by user's
Result promise). This means auth errors were only propagated to
`Driver.onError` callback but all other places received `ServiceUnavailable`
or `SessionExpired` because of closed connection.

This commit makes driver treat INIT error as fatal and corresponding
connection as broken. Initialization error is memorized and propagated
to all message observers. So they see specific failure reason and not
generic `ServiceUnavailable` \ `SessionExpired`.
To investigate test failure on TeamCity.
Neo4j 3.1 closes connection on INIT error. This made it possible to
handle such errors in driver as fatal because we do not expect to
receive anything else from the server. However Neo4j 3.0 does not
close the connection after INIT failure and thus connection might
receive more incoming messages.

This commit makes sure all incoming messages are ignored after
a fatal error.
@zhenlineo
Copy link
Contributor

LG

@lutovich lutovich merged commit 5d3b349 into neo4j:1.2 May 4, 2017
@lutovich lutovich deleted the 1.2-auth-error branch May 4, 2017 14:58
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