{"action":"created","comment":{"url":"https://api.github.com/repos/github/git-lfs/pulls/comments/71088567","id":71088567,"diff_hunk":"@@ -172,14 +179,25 @@ func SetAuthType(req *http.Request, res *http.Response) {\n }\n \n func GetAuthType(res *http.Response) string {\n-\tauth := res.Header.Get(\"Www-Authenticate\")\n-\tif len(auth) < 1 {\n-\t\tauth = res.Header.Get(\"Lfs-Authenticate\")\n+\n+\tauthType := GetAuthTypeFromHeader(res, WwwAuthenticateHeader)\n+\tif authType == BasicAuthType {\n+\t\t// Let us check Lfs-Authenticate header to see if server supports NTML auth.\n+\t\tauthType = GetAuthTypeFromHeader(res, LfsAuthenticateHeader)\n \t}\n \n-\tif strings.HasPrefix(strings.ToLower(auth), \"ntlm\") {\n-\t\treturn \"ntlm\"\n+\treturn authType\n+}\n+\n+func GetAuthTypeFromHeader(res *http.Response, headerName string) string {\n+\tauthHeaders := res.Header[headerName]\n+\tfor i := range authHeaders {\n+\t\tauth := authHeaders[i]\n+\n+\t\tif strings.HasPrefix(strings.ToLower(auth), NtlmAuthType) {\n+\t\t\treturn NtlmAuthType\n+\t\t}\n \t}\n \n-\treturn \"basic\"\n+\treturn BasicAuthType","path":"httputil/request.go","position":44,"original_position":44,"commit_id":"3c5095d8292544ff830bf881c24fd9e32f447ffe","original_commit_id":"3c5095d8292544ff830bf881c24fd9e32f447ffe","user":{"login":"ttaylorr","id":443245,"avatar_url":"https://avatars.githubusercontent.com/u/443245?v=3","gravatar_id":"","url":"https://api.github.com/users/ttaylorr","html_url":"https://github.com/ttaylorr","followers_url":"https://api.github.com/users/ttaylorr/followers","following_url":"https://api.github.com/users/ttaylorr/following{/other_user}","gists_url":"https://api.github.com/users/ttaylorr/gists{/gist_id}","starred_url":"https://api.github.com/users/ttaylorr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ttaylorr/subscriptions","organizations_url":"https://api.github.com/users/ttaylorr/orgs","repos_url":"https://api.github.com/users/ttaylorr/repos","events_url":"https://api.github.com/users/ttaylorr/events{/privacy}","received_events_url":"https://api.github.com/users/ttaylorr/received_events","type":"User","site_admin":false},"body":"It looks like this code only returns either the `Ntlm` or `Basic` auth types. I'm not super familiar with how this spec works: are there any other authentication types that we should support?","created_at":"2016-07-17T20:14:47Z","updated_at":"2016-07-17T20:14:47Z","html_url":"https://github.com/github/git-lfs/pull/1378#discussion_r71088567","pull_request_url":"https://api.github.com/repos/github/git-lfs/pulls/1378","_links":{"self":{"href":"https://api.github.com/repos/github/git-lfs/pulls/comments/71088567"},"html":{"href":"https://github.com/github/git-lfs/pull/1378#discussion_r71088567"},"pull_request":{"href":"https://api.github.com/repos/github/git-lfs/pulls/1378"}}},"pull_request":{"url":"https://api.github.com/repos/github/git-lfs/pulls/1378","id":77726797,"html_url":"https://github.com/github/git-lfs/pull/1378","diff_url":"https://github.com/github/git-lfs/pull/1378.diff","patch_url":"https://github.com/github/git-lfs/pull/1378.patch","issue_url":"https://api.github.com/repos/github/git-lfs/issues/1378","number":1378,"state":"open","locked":false,"title":"Updated request.GetAuthType to handle multi-value auth headers","user":{"login":"VladimirKhvostov","id":8412548,"avatar_url":"https://avatars.githubusercontent.com/u/8412548?v=3","gravatar_id":"","url":"https://api.github.com/users/VladimirKhvostov","html_url":"https://github.com/VladimirKhvostov","followers_url":"https://api.github.com/users/VladimirKhvostov/followers","following_url":"https://api.github.com/users/VladimirKhvostov/following{/other_user}","gists_url":"https://api.github.com/users/VladimirKhvostov/gists{/gist_id}","starred_url":"https://api.github.com/users/VladimirKhvostov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladimirKhvostov/subscriptions","organizations_url":"https://api.github.com/users/VladimirKhvostov/orgs","repos_url":"https://api.github.com/users/VladimirKhvostov/repos","events_url":"https://api.github.com/users/VladimirKhvostov/events{/privacy}","received_events_url":"https://api.github.com/users/VladimirKhvostov/received_events","type":"User","site_admin":false},"body":"GetAuthType method in https://github.com/github/git-lfs/blob/master/httputil/request.go#L174 only takes first WWW-Authenticate header into account. If server sends the following headers:\r\n```\r\nWWW-Authenticate: Bearer\r\nWWW-Authenticate: Negotiate\r\nWWW-Authenticate: NTLM\r\n```\r\nthe code returns \"basic\", which is definitely not correct in this case.\r\n\r\nThis change fixes this issue. \r\n\r\nBug: https://github.com/github/git-lfs/issues/1377","created_at":"2016-07-17T05:00:19Z","updated_at":"2016-07-17T20:14:47Z","closed_at":null,"merged_at":null,"merge_commit_sha":"be6a9ca6fd20b91bceb0d77b43cb1c3000c2ad6d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/github/git-lfs/pulls/1378/commits","review_comments_url":"https://api.github.com/repos/github/git-lfs/pulls/1378/comments","review_comment_url":"https://api.github.com/repos/github/git-lfs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/github/git-lfs/issues/1378/comments","statuses_url":"https://api.github.com/repos/github/git-lfs/statuses/3c5095d8292544ff830bf881c24fd9e32f447ffe","head":{"label":"VladimirKhvostov:users/VladimirKhvostov/GetAuthTypeFix","ref":"users/VladimirKhvostov/GetAuthTypeFix","sha":"3c5095d8292544ff830bf881c24fd9e32f447ffe","user":{"login":"VladimirKhvostov","id":8412548,"avatar_url":"https://avatars.githubusercontent.com/u/8412548?v=3","gravatar_id":"","url":"https://api.github.com/users/VladimirKhvostov","html_url":"https://github.com/VladimirKhvostov","followers_url":"https://api.github.com/users/VladimirKhvostov/followers","following_url":"https://api.github.com/users/VladimirKhvostov/following{/other_user}","gists_url":"https://api.github.com/users/VladimirKhvostov/gists{/gist_id}","starred_url":"https://api.github.com/users/VladimirKhvostov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladimirKhvostov/subscriptions","organizations_url":"https://api.github.com/users/VladimirKhvostov/orgs","repos_url":"https://api.github.com/users/VladimirKhvostov/repos","events_url":"https://api.github.com/users/VladimirKhvostov/events{/privacy}","received_events_url":"https://api.github.com/users/VladimirKhvostov/received_events","type":"User","site_admin":false},"repo":{"id":63452647,"name":"git-lfs","full_name":"VladimirKhvostov/git-lfs","owner":{"login":"VladimirKhvostov","id":8412548,"avatar_url":"https://avatars.githubusercontent.com/u/8412548?v=3","gravatar_id":"","url":"https://api.github.com/users/VladimirKhvostov","html_url":"https://github.com/VladimirKhvostov","followers_url":"https://api.github.com/users/VladimirKhvostov/followers","following_url":"https://api.github.com/users/VladimirKhvostov/following{/other_user}","gists_url":"https://api.github.com/users/VladimirKhvostov/gists{/gist_id}","starred_url":"https://api.github.com/users/VladimirKhvostov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VladimirKhvostov/subscriptions","organizations_url":"https://api.github.com/users/VladimirKhvostov/orgs","repos_url":"https://api.github.com/users/VladimirKhvostov/repos","events_url":"https://api.github.com/users/VladimirKhvostov/events{/privacy}","received_events_url":"https://api.github.com/users/VladimirKhvostov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/VladimirKhvostov/git-lfs","description":"Git extension for versioning large files","fork":true,"url":"https://api.github.com/repos/VladimirKhvostov/git-lfs","forks_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/forks","keys_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/teams","hooks_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/hooks","issue_events_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/issues/events{/number}","events_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/events","assignees_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/assignees{/user}","branches_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/branches{/branch}","tags_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/tags","blobs_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/statuses/{sha}","languages_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/languages","stargazers_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/stargazers","contributors_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/contributors","subscribers_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/subscribers","subscription_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/subscription","commits_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/contents/{+path}","compare_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/merges","archive_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/downloads","issues_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/issues{/number}","pulls_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/pulls{/number}","milestones_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/milestones{/number}","notifications_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/labels{/name}","releases_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/releases{/id}","deployments_url":"https://api.github.com/repos/VladimirKhvostov/git-lfs/deployments","created_at":"2016-07-15T21:45:40Z","updated_at":"2016-07-15T21:45:41Z","pushed_at":"2016-07-17T04:56:46Z","git_url":"git://github.com/VladimirKhvostov/git-lfs.git","ssh_url":"git@github.com:VladimirKhvostov/git-lfs.git","clone_url":"https://github.com/VladimirKhvostov/git-lfs.git","svn_url":"https://github.com/VladimirKhvostov/git-lfs","homepage":"https://git-lfs.github.com","size":5759,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"github:master","ref":"master","sha":"d7403ce67ee7402df53fa7e02b912e6140f7052e","user":{"login":"github","id":9919,"avatar_url":"https://avatars.githubusercontent.com/u/9919?v=3","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"repo":{"id":13021798,"name":"git-lfs","full_name":"github/git-lfs","owner":{"login":"github","id":9919,"avatar_url":"https://avatars.githubusercontent.com/u/9919?v=3","gravatar_id":"","url":"https://api.github.com/users/github","html_url":"https://github.com/github","followers_url":"https://api.github.com/users/github/followers","following_url":"https://api.github.com/users/github/following{/other_user}","gists_url":"https://api.github.com/users/github/gists{/gist_id}","starred_url":"https://api.github.com/users/github/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/github/subscriptions","organizations_url":"https://api.github.com/users/github/orgs","repos_url":"https://api.github.com/users/github/repos","events_url":"https://api.github.com/users/github/events{/privacy}","received_events_url":"https://api.github.com/users/github/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/github/git-lfs","description":"Git extension for versioning large files","fork":false,"url":"https://api.github.com/repos/github/git-lfs","forks_url":"https://api.github.com/repos/github/git-lfs/forks","keys_url":"https://api.github.com/repos/github/git-lfs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/github/git-lfs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/github/git-lfs/teams","hooks_url":"https://api.github.com/repos/github/git-lfs/hooks","issue_events_url":"https://api.github.com/repos/github/git-lfs/issues/events{/number}","events_url":"https://api.github.com/repos/github/git-lfs/events","assignees_url":"https://api.github.com/repos/github/git-lfs/assignees{/user}","branches_url":"https://api.github.com/repos/github/git-lfs/branches{/branch}","tags_url":"https://api.github.com/repos/github/git-lfs/tags","blobs_url":"https://api.github.com/repos/github/git-lfs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/github/git-lfs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/github/git-lfs/git/refs{/sha}","trees_url":"https://api.github.com/repos/github/git-lfs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/github/git-lfs/statuses/{sha}","languages_url":"https://api.github.com/repos/github/git-lfs/languages","stargazers_url":"https://api.github.com/repos/github/git-lfs/stargazers","contributors_url":"https://api.github.com/repos/github/git-lfs/contributors","subscribers_url":"https://api.github.com/repos/github/git-lfs/subscribers","subscription_url":"https://api.github.com/repos/github/git-lfs/subscription","commits_url":"https://api.github.com/repos/github/git-lfs/commits{/sha}","git_commits_url":"https://api.github.com/repos/github/git-lfs/git/commits{/sha}","comments_url":"https://api.github.com/repos/github/git-lfs/comments{/number}","issue_comment_url":"https://api.github.com/repos/github/git-lfs/issues/comments{/number}","contents_url":"https://api.github.com/repos/github/git-lfs/contents/{+path}","compare_url":"https://api.github.com/repos/github/git-lfs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/github/git-lfs/merges","archive_url":"https://api.github.com/repos/github/git-lfs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/github/git-lfs/downloads","issues_url":"https://api.github.com/repos/github/git-lfs/issues{/number}","pulls_url":"https://api.github.com/repos/github/git-lfs/pulls{/number}","milestones_url":"https://api.github.com/repos/github/git-lfs/milestones{/number}","notifications_url":"https://api.github.com/repos/github/git-lfs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/github/git-lfs/labels{/name}","releases_url":"https://api.github.com/repos/github/git-lfs/releases{/id}","deployments_url":"https://api.github.com/repos/github/git-lfs/deployments","created_at":"2013-09-22T22:03:28Z","updated_at":"2016-07-16T06:52:14Z","pushed_at":"2016-07-17T05:00:20Z","git_url":"git://github.com/github/git-lfs.git","ssh_url":"git@github.com:github/git-lfs.git","clone_url":"https://github.com/github/git-lfs.git","svn_url":"https://github.com/github/git-lfs","homepage":"https://git-lfs.github.com","size":11632,"stargazers_count":3693,"watchers_count":3693,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":508,"mirror_url":null,"open_issues_count":268,"forks":508,"open_issues":268,"watchers":3693,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/github/git-lfs/pulls/1378"},"html":{"href":"https://github.com/github/git-lfs/pull/1378"},"issue":{"href":"https://api.github.com/repos/github/git-lfs/issues/1378"},"comments":{"href":"https://api.github.com/repos/github/git-lfs/issues/1378/comments"},"review_comments":{"href":"https://api.github.com/repos/github/git-lfs/pulls/1378/comments"},"review_comment":{"href":"https://api.github.com/repos/github/git-lfs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/github/git-lfs/pulls/1378/commits"},"statuses":{"href":"https://api.github.com/repos/github/git-lfs/statuses/3c5095d8292544ff830bf881c24fd9e32f447ffe"}}}}
{"actor":{"display_login":"ttaylorr"}}