Commit 74793ad3 authored by Alain Takoudjou's avatar Alain Takoudjou

fixup! NXD blob/auth: Teach it to handle HTTP Basic Auth too

User signin location is now '/users/sign_in.zip' on gitlab-workhorse v3.0.0
parent 6fac8b94
...@@ -326,7 +326,7 @@ func (a *API) verifyDownloadAccess(project string, user *url.Userinfo, query str ...@@ -326,7 +326,7 @@ func (a *API) verifyDownloadAccess(project string, user *url.Userinfo, query str
// first send request without auth set and expect server to send them auth challenge. // first send request without auth set and expect server to send them auth challenge.
// and only after the challenge they retry the request with Authorization header set. // and only after the challenge they retry the request with Authorization header set.
if authReply.RawReply.Code == http.StatusFound && if authReply.RawReply.Code == http.StatusFound &&
strings.HasSuffix(authReply.RawReply.HeaderMap.Get("location"), "/users/sign_in") { strings.HasSuffix(authReply.RawReply.HeaderMap.Get("location"), "/users/sign_in.zip") {
r := httptest.NewRecorder() r := httptest.NewRecorder()
r.Header().Set("WWW-Authenticate", "Basic realm=\"\"") r.Header().Set("WWW-Authenticate", "Basic realm=\"\"")
r.WriteHeader(http.StatusUnauthorized) r.WriteHeader(http.StatusUnauthorized)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment