{"action":"created","comment":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/55944357","id":55944357,"diff_hunk":"@@ -0,0 +1,59 @@\n+/*\n+ * Copyright (c) 2002-2016 \"Neo Technology,\"\n+ * Network Engine for Objects in Lund AB [http://neotechnology.com]\n+ *\n+ * This file is part of Neo4j.\n+ *\n+ * Neo4j is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+ */\n+package org.neo4j.bolt.v1.runtime.integration;\n+\n+import org.junit.Rule;\n+import org.junit.Test;\n+\n+import org.neo4j.bolt.v1.runtime.Session;\n+import org.neo4j.kernel.api.exceptions.Status;\n+\n+import static org.hamcrest.MatcherAssert.assertThat;\n+import static org.neo4j.bolt.v1.runtime.integration.SessionMatchers.failedWith;\n+import static org.neo4j.bolt.v1.runtime.integration.SessionMatchers.recorded;\n+import static org.neo4j.bolt.v1.runtime.integration.SessionMatchers.successButRequiresPasswordChange;\n+import static org.neo4j.helpers.collection.MapUtil.map;\n+\n+public class BoltAuthIT\n+{\n+    @Rule\n+    public TestSessions env = new TestSessions().withAuthEnabled( true );\n+\n+    @Test\n+    public void shouldGiveCredentialsExpiredStatusOnExpiredCredentials() throws Throwable\n+    {\n+        // given it is important for client applications to programmatically\n+        // identify expired credentials as the cause of not being authenticated\n+        Session session = env.newSession( \"test\" );\n+        RecordingCallback recorder = new RecordingCallback();\n+\n+        // when\n+        session.init( \"TestClient/1.0.0\", map(\n+                \"scheme\", \"basic\",\n+                \"principal\", \"neo4j\",\n+                \"credentials\", \"neo4j\" ), null, recorder );\n+        session.run( \"CREATE ()\", map(), null, recorder );","path":"community/bolt/src/test/java/org/neo4j/bolt/v1/runtime/integration/BoltAuthIT.java","position":52,"original_position":52,"commit_id":"065e3cec2e5aff96150d36f5679f347cd7072ab1","original_commit_id":"065e3cec2e5aff96150d36f5679f347cd7072ab1","user":{"login":"pontusmelke","id":88000,"avatar_url":"https://avatars.githubusercontent.com/u/88000?v=3","gravatar_id":"","url":"https://api.github.com/users/pontusmelke","html_url":"https://github.com/pontusmelke","followers_url":"https://api.github.com/users/pontusmelke/followers","following_url":"https://api.github.com/users/pontusmelke/following{/other_user}","gists_url":"https://api.github.com/users/pontusmelke/gists{/gist_id}","starred_url":"https://api.github.com/users/pontusmelke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pontusmelke/subscriptions","organizations_url":"https://api.github.com/users/pontusmelke/orgs","repos_url":"https://api.github.com/users/pontusmelke/repos","events_url":"https://api.github.com/users/pontusmelke/events{/privacy}","received_events_url":"https://api.github.com/users/pontusmelke/received_events","type":"User","site_admin":false},"body":"Does the client really need to do a `RUN` to check if credentials has expired? Couldn't the client just try to connect with  `INIT` and react to the error there instead of reacting to the error on `RUN`. To me it feels like `FORBIDDEN` is the correct error when trying to run a query without having properly authorized to the server, and `CREDENTIALS EXPIRED` is the error you should get when doing `INIT` with expired credentials.\r\n","created_at":"2016-03-13T21:50:19Z","updated_at":"2016-03-13T21:50:19Z","html_url":"https://github.com/neo4j/neo4j/pull/6688#discussion_r55944357","pull_request_url":"https://api.github.com/repos/neo4j/neo4j/pulls/6688","_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments/55944357"},"html":{"href":"https://github.com/neo4j/neo4j/pull/6688#discussion_r55944357"},"pull_request":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/6688"}}},"pull_request":{"url":"https://api.github.com/repos/neo4j/neo4j/pulls/6688","id":62680169,"html_url":"https://github.com/neo4j/neo4j/pull/6688","diff_url":"https://github.com/neo4j/neo4j/pull/6688.diff","patch_url":"https://github.com/neo4j/neo4j/pull/6688.patch","issue_url":"https://api.github.com/repos/neo4j/neo4j/issues/6688","number":6688,"state":"open","locked":false,"title":"Proper status code on credentials expired in Bolt.","user":{"login":"jakewins","id":182752,"avatar_url":"https://avatars.githubusercontent.com/u/182752?v=3","gravatar_id":"","url":"https://api.github.com/users/jakewins","html_url":"https://github.com/jakewins","followers_url":"https://api.github.com/users/jakewins/followers","following_url":"https://api.github.com/users/jakewins/following{/other_user}","gists_url":"https://api.github.com/users/jakewins/gists{/gist_id}","starred_url":"https://api.github.com/users/jakewins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakewins/subscriptions","organizations_url":"https://api.github.com/users/jakewins/orgs","repos_url":"https://api.github.com/users/jakewins/repos","events_url":"https://api.github.com/users/jakewins/events{/privacy}","received_events_url":"https://api.github.com/users/jakewins/received_events","type":"User","site_admin":false},"body":"This gives an identifiable error when statements fail due to\r\nexpired credentials. However, it is done as a patch layer in SSM,\r\nrather than down the stack where the authentication fails.\r\n\r\nI chose to do it this way to avoid introducing bugs in the lower\r\nlayers of auth stuff this late in the 3.0 cycle. However, we should\r\nmove more knowledge about the state of authentication down the stack\r\nsuch that the message we patch over in SSM now can be generated at the\r\nsource down in kernel instead. One way to do that would be to introduce\r\na special AccessMode for authenticated_but_needs_credential_change.\r\n\r\nIn any case, this should resolve the current problem in the Browser.","created_at":"2016-03-13T19:21:22Z","updated_at":"2016-03-13T21:50:19Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc57283d66ee6e79709775c8a358f05b94cadadb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/neo4j/neo4j/pulls/6688/commits","review_comments_url":"https://api.github.com/repos/neo4j/neo4j/pulls/6688/comments","review_comment_url":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}","comments_url":"https://api.github.com/repos/neo4j/neo4j/issues/6688/comments","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/065e3cec2e5aff96150d36f5679f347cd7072ab1","head":{"label":"jakewins:3.0-bolt-credentials-expired","ref":"3.0-bolt-credentials-expired","sha":"065e3cec2e5aff96150d36f5679f347cd7072ab1","user":{"login":"jakewins","id":182752,"avatar_url":"https://avatars.githubusercontent.com/u/182752?v=3","gravatar_id":"","url":"https://api.github.com/users/jakewins","html_url":"https://github.com/jakewins","followers_url":"https://api.github.com/users/jakewins/followers","following_url":"https://api.github.com/users/jakewins/following{/other_user}","gists_url":"https://api.github.com/users/jakewins/gists{/gist_id}","starred_url":"https://api.github.com/users/jakewins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakewins/subscriptions","organizations_url":"https://api.github.com/users/jakewins/orgs","repos_url":"https://api.github.com/users/jakewins/repos","events_url":"https://api.github.com/users/jakewins/events{/privacy}","received_events_url":"https://api.github.com/users/jakewins/received_events","type":"User","site_admin":false},"repo":{"id":6761171,"name":"neo4j","full_name":"jakewins/neo4j","owner":{"login":"jakewins","id":182752,"avatar_url":"https://avatars.githubusercontent.com/u/182752?v=3","gravatar_id":"","url":"https://api.github.com/users/jakewins","html_url":"https://github.com/jakewins","followers_url":"https://api.github.com/users/jakewins/followers","following_url":"https://api.github.com/users/jakewins/following{/other_user}","gists_url":"https://api.github.com/users/jakewins/gists{/gist_id}","starred_url":"https://api.github.com/users/jakewins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jakewins/subscriptions","organizations_url":"https://api.github.com/users/jakewins/orgs","repos_url":"https://api.github.com/users/jakewins/repos","events_url":"https://api.github.com/users/jakewins/events{/privacy}","received_events_url":"https://api.github.com/users/jakewins/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jakewins/neo4j","description":"","fork":true,"url":"https://api.github.com/repos/jakewins/neo4j","forks_url":"https://api.github.com/repos/jakewins/neo4j/forks","keys_url":"https://api.github.com/repos/jakewins/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jakewins/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jakewins/neo4j/teams","hooks_url":"https://api.github.com/repos/jakewins/neo4j/hooks","issue_events_url":"https://api.github.com/repos/jakewins/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/jakewins/neo4j/events","assignees_url":"https://api.github.com/repos/jakewins/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/jakewins/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/jakewins/neo4j/tags","blobs_url":"https://api.github.com/repos/jakewins/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jakewins/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jakewins/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/jakewins/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jakewins/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/jakewins/neo4j/languages","stargazers_url":"https://api.github.com/repos/jakewins/neo4j/stargazers","contributors_url":"https://api.github.com/repos/jakewins/neo4j/contributors","subscribers_url":"https://api.github.com/repos/jakewins/neo4j/subscribers","subscription_url":"https://api.github.com/repos/jakewins/neo4j/subscription","commits_url":"https://api.github.com/repos/jakewins/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/jakewins/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/jakewins/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/jakewins/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/jakewins/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/jakewins/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jakewins/neo4j/merges","archive_url":"https://api.github.com/repos/jakewins/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jakewins/neo4j/downloads","issues_url":"https://api.github.com/repos/jakewins/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/jakewins/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/jakewins/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/jakewins/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jakewins/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/jakewins/neo4j/releases{/id}","deployments_url":"https://api.github.com/repos/jakewins/neo4j/deployments","created_at":"2012-11-19T13:59:44Z","updated_at":"2014-06-17T11:02:23Z","pushed_at":"2016-03-13T19:57:17Z","git_url":"git://github.com/jakewins/neo4j.git","ssh_url":"git@github.com:jakewins/neo4j.git","clone_url":"https://github.com/jakewins/neo4j.git","svn_url":"https://github.com/jakewins/neo4j","homepage":null,"size":301816,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"neo4j:3.0","ref":"3.0","sha":"a4ed11d873556a2f7eaddae9ad6660701959ce5c","user":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"repo":{"id":6650539,"name":"neo4j","full_name":"neo4j/neo4j","owner":{"login":"neo4j","id":201120,"avatar_url":"https://avatars.githubusercontent.com/u/201120?v=3","gravatar_id":"","url":"https://api.github.com/users/neo4j","html_url":"https://github.com/neo4j","followers_url":"https://api.github.com/users/neo4j/followers","following_url":"https://api.github.com/users/neo4j/following{/other_user}","gists_url":"https://api.github.com/users/neo4j/gists{/gist_id}","starred_url":"https://api.github.com/users/neo4j/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neo4j/subscriptions","organizations_url":"https://api.github.com/users/neo4j/orgs","repos_url":"https://api.github.com/users/neo4j/repos","events_url":"https://api.github.com/users/neo4j/events{/privacy}","received_events_url":"https://api.github.com/users/neo4j/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/neo4j/neo4j","description":"Graphs for Everyone","fork":false,"url":"https://api.github.com/repos/neo4j/neo4j","forks_url":"https://api.github.com/repos/neo4j/neo4j/forks","keys_url":"https://api.github.com/repos/neo4j/neo4j/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neo4j/neo4j/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neo4j/neo4j/teams","hooks_url":"https://api.github.com/repos/neo4j/neo4j/hooks","issue_events_url":"https://api.github.com/repos/neo4j/neo4j/issues/events{/number}","events_url":"https://api.github.com/repos/neo4j/neo4j/events","assignees_url":"https://api.github.com/repos/neo4j/neo4j/assignees{/user}","branches_url":"https://api.github.com/repos/neo4j/neo4j/branches{/branch}","tags_url":"https://api.github.com/repos/neo4j/neo4j/tags","blobs_url":"https://api.github.com/repos/neo4j/neo4j/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neo4j/neo4j/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neo4j/neo4j/git/refs{/sha}","trees_url":"https://api.github.com/repos/neo4j/neo4j/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neo4j/neo4j/statuses/{sha}","languages_url":"https://api.github.com/repos/neo4j/neo4j/languages","stargazers_url":"https://api.github.com/repos/neo4j/neo4j/stargazers","contributors_url":"https://api.github.com/repos/neo4j/neo4j/contributors","subscribers_url":"https://api.github.com/repos/neo4j/neo4j/subscribers","subscription_url":"https://api.github.com/repos/neo4j/neo4j/subscription","commits_url":"https://api.github.com/repos/neo4j/neo4j/commits{/sha}","git_commits_url":"https://api.github.com/repos/neo4j/neo4j/git/commits{/sha}","comments_url":"https://api.github.com/repos/neo4j/neo4j/comments{/number}","issue_comment_url":"https://api.github.com/repos/neo4j/neo4j/issues/comments{/number}","contents_url":"https://api.github.com/repos/neo4j/neo4j/contents/{+path}","compare_url":"https://api.github.com/repos/neo4j/neo4j/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neo4j/neo4j/merges","archive_url":"https://api.github.com/repos/neo4j/neo4j/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neo4j/neo4j/downloads","issues_url":"https://api.github.com/repos/neo4j/neo4j/issues{/number}","pulls_url":"https://api.github.com/repos/neo4j/neo4j/pulls{/number}","milestones_url":"https://api.github.com/repos/neo4j/neo4j/milestones{/number}","notifications_url":"https://api.github.com/repos/neo4j/neo4j/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neo4j/neo4j/labels{/name}","releases_url":"https://api.github.com/repos/neo4j/neo4j/releases{/id}","deployments_url":"https://api.github.com/repos/neo4j/neo4j/deployments","created_at":"2012-11-12T08:46:15Z","updated_at":"2016-03-11T20:06:57Z","pushed_at":"2016-03-13T21:20:38Z","git_url":"git://github.com/neo4j/neo4j.git","ssh_url":"git@github.com:neo4j/neo4j.git","clone_url":"https://github.com/neo4j/neo4j.git","svn_url":"https://github.com/neo4j/neo4j","homepage":"http://neo4j.com","size":340381,"stargazers_count":2408,"watchers_count":2408,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":857,"mirror_url":null,"open_issues_count":383,"forks":857,"open_issues":383,"watchers":2408,"default_branch":"3.0"}},"_links":{"self":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/6688"},"html":{"href":"https://github.com/neo4j/neo4j/pull/6688"},"issue":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/6688"},"comments":{"href":"https://api.github.com/repos/neo4j/neo4j/issues/6688/comments"},"review_comments":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/6688/comments"},"review_comment":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/neo4j/neo4j/pulls/6688/commits"},"statuses":{"href":"https://api.github.com/repos/neo4j/neo4j/statuses/065e3cec2e5aff96150d36f5679f347cd7072ab1"}}}}