{"action":"created","comment":{"url":"https://api.github.com/repos/wercker/docker-check-access/pulls/comments/180086075","pull_request_review_id":110443991,"id":180086075,"diff_hunk":"@@ -55,7 +55,7 @@ func (d *DockerAuth) CheckAccess(repository string, scope Scope) (bool, error) {\n \tif err != nil {\n \t\treturn false, err\n \t}\n-\n+\td.authenticate(req)","path":"docker-auth.go","position":5,"original_position":5,"commit_id":"7b33d11ab7c4a7b3cc11c834e7b0836241c7e86c","original_commit_id":"7b33d11ab7c4a7b3cc11c834e7b0836241c7e86c","user":{"login":"lake-of-dreams","id":18029655,"avatar_url":"https://avatars2.githubusercontent.com/u/18029655?v=4","gravatar_id":"","url":"https://api.github.com/users/lake-of-dreams","html_url":"https://github.com/lake-of-dreams","followers_url":"https://api.github.com/users/lake-of-dreams/followers","following_url":"https://api.github.com/users/lake-of-dreams/following{/other_user}","gists_url":"https://api.github.com/users/lake-of-dreams/gists{/gist_id}","starred_url":"https://api.github.com/users/lake-of-dreams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lake-of-dreams/subscriptions","organizations_url":"https://api.github.com/users/lake-of-dreams/orgs","repos_url":"https://api.github.com/users/lake-of-dreams/repos","events_url":"https://api.github.com/users/lake-of-dreams/events{/privacy}","received_events_url":"https://api.github.com/users/lake-of-dreams/received_events","type":"User","site_admin":false},"body":"and No. 2 above in PR description - the request to getToken itself can throw 401, thats why the check for 401","created_at":"2018-04-09T13:02:00Z","updated_at":"2018-04-09T13:02:00Z","html_url":"https://github.com/wercker/docker-check-access/pull/6#discussion_r180086075","pull_request_url":"https://api.github.com/repos/wercker/docker-check-access/pulls/6","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/wercker/docker-check-access/pulls/comments/180086075"},"html":{"href":"https://github.com/wercker/docker-check-access/pull/6#discussion_r180086075"},"pull_request":{"href":"https://api.github.com/repos/wercker/docker-check-access/pulls/6"}},"in_reply_to_id":180078619},"pull_request":{"url":"https://api.github.com/repos/wercker/docker-check-access/pulls/6","id":180216318,"html_url":"https://github.com/wercker/docker-check-access/pull/6","diff_url":"https://github.com/wercker/docker-check-access/pull/6.diff","patch_url":"https://github.com/wercker/docker-check-access/pull/6.patch","issue_url":"https://api.github.com/repos/wercker/docker-check-access/issues/6","number":6,"state":"open","locked":false,"title":"Fixes #1740 Enable Basic Auth and check for 401 after access request with token ","user":{"login":"lake-of-dreams","id":18029655,"avatar_url":"https://avatars2.githubusercontent.com/u/18029655?v=4","gravatar_id":"","url":"https://api.github.com/users/lake-of-dreams","html_url":"https://github.com/lake-of-dreams","followers_url":"https://api.github.com/users/lake-of-dreams/followers","following_url":"https://api.github.com/users/lake-of-dreams/following{/other_user}","gists_url":"https://api.github.com/users/lake-of-dreams/gists{/gist_id}","starred_url":"https://api.github.com/users/lake-of-dreams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lake-of-dreams/subscriptions","organizations_url":"https://api.github.com/users/lake-of-dreams/orgs","repos_url":"https://api.github.com/users/lake-of-dreams/repos","events_url":"https://api.github.com/users/lake-of-dreams/events{/privacy}","received_events_url":"https://api.github.com/users/lake-of-dreams/received_events","type":"User","site_admin":false},"body":"**What this PR does / why we need it:**\r\nContributes to fix for [1740](https://github.com/wercker/backlog/issues/1740)\r\n\r\n1. Comments on docker-auth.CheckAccess mention that first a basic auth request is made to docker registry - however in code nowhere did we set username/password from the config to request. Enabled this by adding a call to authenticate() which will add username/password to request so as to perform basic auth.\r\n\r\n2. When a request is being made to docker registry using bearer token - it is possible that it can send a 401 unauthorized since the user might be \"authenticated\" to the registry but might not have push \"authorization\" on the repository in the same registry. Therefore added a check to 401 after token based request.","created_at":"2018-04-09T05:48:44Z","updated_at":"2018-04-09T13:02:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"93859337fcfda8c435b1790a2930995b46425da2","assignee":null,"assignees":[],"requested_reviewers":[{"login":"nigeldeakin","id":6053562,"avatar_url":"https://avatars2.githubusercontent.com/u/6053562?v=4","gravatar_id":"","url":"https://api.github.com/users/nigeldeakin","html_url":"https://github.com/nigeldeakin","followers_url":"https://api.github.com/users/nigeldeakin/followers","following_url":"https://api.github.com/users/nigeldeakin/following{/other_user}","gists_url":"https://api.github.com/users/nigeldeakin/gists{/gist_id}","starred_url":"https://api.github.com/users/nigeldeakin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nigeldeakin/subscriptions","organizations_url":"https://api.github.com/users/nigeldeakin/orgs","repos_url":"https://api.github.com/users/nigeldeakin/repos","events_url":"https://api.github.com/users/nigeldeakin/events{/privacy}","received_events_url":"https://api.github.com/users/nigeldeakin/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/wercker/docker-check-access/pulls/6/commits","review_comments_url":"https://api.github.com/repos/wercker/docker-check-access/pulls/6/comments","review_comment_url":"https://api.github.com/repos/wercker/docker-check-access/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wercker/docker-check-access/issues/6/comments","statuses_url":"https://api.github.com/repos/wercker/docker-check-access/statuses/7b33d11ab7c4a7b3cc11c834e7b0836241c7e86c","head":{"label":"wercker:issue-1740","ref":"issue-1740","sha":"7b33d11ab7c4a7b3cc11c834e7b0836241c7e86c","user":{"login":"wercker","id":1695193,"avatar_url":"https://avatars3.githubusercontent.com/u/1695193?v=4","gravatar_id":"","url":"https://api.github.com/users/wercker","html_url":"https://github.com/wercker","followers_url":"https://api.github.com/users/wercker/followers","following_url":"https://api.github.com/users/wercker/following{/other_user}","gists_url":"https://api.github.com/users/wercker/gists{/gist_id}","starred_url":"https://api.github.com/users/wercker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wercker/subscriptions","organizations_url":"https://api.github.com/users/wercker/orgs","repos_url":"https://api.github.com/users/wercker/repos","events_url":"https://api.github.com/users/wercker/events{/privacy}","received_events_url":"https://api.github.com/users/wercker/received_events","type":"Organization","site_admin":false},"repo":{"id":53627900,"name":"docker-check-access","full_name":"wercker/docker-check-access","owner":{"login":"wercker","id":1695193,"avatar_url":"https://avatars3.githubusercontent.com/u/1695193?v=4","gravatar_id":"","url":"https://api.github.com/users/wercker","html_url":"https://github.com/wercker","followers_url":"https://api.github.com/users/wercker/followers","following_url":"https://api.github.com/users/wercker/following{/other_user}","gists_url":"https://api.github.com/users/wercker/gists{/gist_id}","starred_url":"https://api.github.com/users/wercker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wercker/subscriptions","organizations_url":"https://api.github.com/users/wercker/orgs","repos_url":"https://api.github.com/users/wercker/repos","events_url":"https://api.github.com/users/wercker/events{/privacy}","received_events_url":"https://api.github.com/users/wercker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wercker/docker-check-access","description":"https://godoc.org/github.com/wercker/docker-check-access","fork":false,"url":"https://api.github.com/repos/wercker/docker-check-access","forks_url":"https://api.github.com/repos/wercker/docker-check-access/forks","keys_url":"https://api.github.com/repos/wercker/docker-check-access/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wercker/docker-check-access/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wercker/docker-check-access/teams","hooks_url":"https://api.github.com/repos/wercker/docker-check-access/hooks","issue_events_url":"https://api.github.com/repos/wercker/docker-check-access/issues/events{/number}","events_url":"https://api.github.com/repos/wercker/docker-check-access/events","assignees_url":"https://api.github.com/repos/wercker/docker-check-access/assignees{/user}","branches_url":"https://api.github.com/repos/wercker/docker-check-access/branches{/branch}","tags_url":"https://api.github.com/repos/wercker/docker-check-access/tags","blobs_url":"https://api.github.com/repos/wercker/docker-check-access/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wercker/docker-check-access/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wercker/docker-check-access/git/refs{/sha}","trees_url":"https://api.github.com/repos/wercker/docker-check-access/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wercker/docker-check-access/statuses/{sha}","languages_url":"https://api.github.com/repos/wercker/docker-check-access/languages","stargazers_url":"https://api.github.com/repos/wercker/docker-check-access/stargazers","contributors_url":"https://api.github.com/repos/wercker/docker-check-access/contributors","subscribers_url":"https://api.github.com/repos/wercker/docker-check-access/subscribers","subscription_url":"https://api.github.com/repos/wercker/docker-check-access/subscription","commits_url":"https://api.github.com/repos/wercker/docker-check-access/commits{/sha}","git_commits_url":"https://api.github.com/repos/wercker/docker-check-access/git/commits{/sha}","comments_url":"https://api.github.com/repos/wercker/docker-check-access/comments{/number}","issue_comment_url":"https://api.github.com/repos/wercker/docker-check-access/issues/comments{/number}","contents_url":"https://api.github.com/repos/wercker/docker-check-access/contents/{+path}","compare_url":"https://api.github.com/repos/wercker/docker-check-access/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wercker/docker-check-access/merges","archive_url":"https://api.github.com/repos/wercker/docker-check-access/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wercker/docker-check-access/downloads","issues_url":"https://api.github.com/repos/wercker/docker-check-access/issues{/number}","pulls_url":"https://api.github.com/repos/wercker/docker-check-access/pulls{/number}","milestones_url":"https://api.github.com/repos/wercker/docker-check-access/milestones{/number}","notifications_url":"https://api.github.com/repos/wercker/docker-check-access/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wercker/docker-check-access/labels{/name}","releases_url":"https://api.github.com/repos/wercker/docker-check-access/releases{/id}","deployments_url":"https://api.github.com/repos/wercker/docker-check-access/deployments","created_at":"2016-03-11T00:38:54Z","updated_at":"2016-12-21T14:35:55Z","pushed_at":"2018-04-09T05:48:45Z","git_url":"git://github.com/wercker/docker-check-access.git","ssh_url":"git@github.com:wercker/docker-check-access.git","clone_url":"https://github.com/wercker/docker-check-access.git","svn_url":"https://github.com/wercker/docker-check-access","homepage":"","size":32,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":3,"open_issues":3,"watchers":4,"default_branch":"master"}},"base":{"label":"wercker:master","ref":"master","sha":"593931430a5f89909f84cec539ce8a82c040b855","user":{"login":"wercker","id":1695193,"avatar_url":"https://avatars3.githubusercontent.com/u/1695193?v=4","gravatar_id":"","url":"https://api.github.com/users/wercker","html_url":"https://github.com/wercker","followers_url":"https://api.github.com/users/wercker/followers","following_url":"https://api.github.com/users/wercker/following{/other_user}","gists_url":"https://api.github.com/users/wercker/gists{/gist_id}","starred_url":"https://api.github.com/users/wercker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wercker/subscriptions","organizations_url":"https://api.github.com/users/wercker/orgs","repos_url":"https://api.github.com/users/wercker/repos","events_url":"https://api.github.com/users/wercker/events{/privacy}","received_events_url":"https://api.github.com/users/wercker/received_events","type":"Organization","site_admin":false},"repo":{"id":53627900,"name":"docker-check-access","full_name":"wercker/docker-check-access","owner":{"login":"wercker","id":1695193,"avatar_url":"https://avatars3.githubusercontent.com/u/1695193?v=4","gravatar_id":"","url":"https://api.github.com/users/wercker","html_url":"https://github.com/wercker","followers_url":"https://api.github.com/users/wercker/followers","following_url":"https://api.github.com/users/wercker/following{/other_user}","gists_url":"https://api.github.com/users/wercker/gists{/gist_id}","starred_url":"https://api.github.com/users/wercker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wercker/subscriptions","organizations_url":"https://api.github.com/users/wercker/orgs","repos_url":"https://api.github.com/users/wercker/repos","events_url":"https://api.github.com/users/wercker/events{/privacy}","received_events_url":"https://api.github.com/users/wercker/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wercker/docker-check-access","description":"https://godoc.org/github.com/wercker/docker-check-access","fork":false,"url":"https://api.github.com/repos/wercker/docker-check-access","forks_url":"https://api.github.com/repos/wercker/docker-check-access/forks","keys_url":"https://api.github.com/repos/wercker/docker-check-access/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wercker/docker-check-access/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wercker/docker-check-access/teams","hooks_url":"https://api.github.com/repos/wercker/docker-check-access/hooks","issue_events_url":"https://api.github.com/repos/wercker/docker-check-access/issues/events{/number}","events_url":"https://api.github.com/repos/wercker/docker-check-access/events","assignees_url":"https://api.github.com/repos/wercker/docker-check-access/assignees{/user}","branches_url":"https://api.github.com/repos/wercker/docker-check-access/branches{/branch}","tags_url":"https://api.github.com/repos/wercker/docker-check-access/tags","blobs_url":"https://api.github.com/repos/wercker/docker-check-access/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wercker/docker-check-access/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wercker/docker-check-access/git/refs{/sha}","trees_url":"https://api.github.com/repos/wercker/docker-check-access/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wercker/docker-check-access/statuses/{sha}","languages_url":"https://api.github.com/repos/wercker/docker-check-access/languages","stargazers_url":"https://api.github.com/repos/wercker/docker-check-access/stargazers","contributors_url":"https://api.github.com/repos/wercker/docker-check-access/contributors","subscribers_url":"https://api.github.com/repos/wercker/docker-check-access/subscribers","subscription_url":"https://api.github.com/repos/wercker/docker-check-access/subscription","commits_url":"https://api.github.com/repos/wercker/docker-check-access/commits{/sha}","git_commits_url":"https://api.github.com/repos/wercker/docker-check-access/git/commits{/sha}","comments_url":"https://api.github.com/repos/wercker/docker-check-access/comments{/number}","issue_comment_url":"https://api.github.com/repos/wercker/docker-check-access/issues/comments{/number}","contents_url":"https://api.github.com/repos/wercker/docker-check-access/contents/{+path}","compare_url":"https://api.github.com/repos/wercker/docker-check-access/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wercker/docker-check-access/merges","archive_url":"https://api.github.com/repos/wercker/docker-check-access/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wercker/docker-check-access/downloads","issues_url":"https://api.github.com/repos/wercker/docker-check-access/issues{/number}","pulls_url":"https://api.github.com/repos/wercker/docker-check-access/pulls{/number}","milestones_url":"https://api.github.com/repos/wercker/docker-check-access/milestones{/number}","notifications_url":"https://api.github.com/repos/wercker/docker-check-access/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wercker/docker-check-access/labels{/name}","releases_url":"https://api.github.com/repos/wercker/docker-check-access/releases{/id}","deployments_url":"https://api.github.com/repos/wercker/docker-check-access/deployments","created_at":"2016-03-11T00:38:54Z","updated_at":"2016-12-21T14:35:55Z","pushed_at":"2018-04-09T05:48:45Z","git_url":"git://github.com/wercker/docker-check-access.git","ssh_url":"git@github.com:wercker/docker-check-access.git","clone_url":"https://github.com/wercker/docker-check-access.git","svn_url":"https://github.com/wercker/docker-check-access","homepage":"","size":32,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"archived":false,"open_issues_count":3,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":3,"open_issues":3,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wercker/docker-check-access/pulls/6"},"html":{"href":"https://github.com/wercker/docker-check-access/pull/6"},"issue":{"href":"https://api.github.com/repos/wercker/docker-check-access/issues/6"},"comments":{"href":"https://api.github.com/repos/wercker/docker-check-access/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/wercker/docker-check-access/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/wercker/docker-check-access/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wercker/docker-check-access/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/wercker/docker-check-access/statuses/7b33d11ab7c4a7b3cc11c834e7b0836241c7e86c"}},"author_association":"NONE"}}
{"actor":{"display_login":"lake-of-dreams"}}