Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-workhorse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-workhorse
Commits
58e7dc3c
Commit
58e7dc3c
authored
Jan 10, 2020
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! fixup NXD blob/auth: Teach it to handle HTTP Basic Auth too
parent
fb86140c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
internal/api/auth.go
internal/api/auth.go
+7
-4
No files found.
internal/api/auth.go
View file @
58e7dc3c
// API calls related to authentication
package
api
//"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
import
(
"gitlab.com/gitlab-org/gitlab-workhorse/internal/badgateway"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/helper"
proxypkg
"gitlab.com/gitlab-org/gitlab-workhorse/internal/proxy"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/senddata"
"gitlab.com/gitlab-org/gitlab-workhorse/internal/sendfile"
"gitlab.com/gitlab-org/gitaly/proto/go/gitalypb"
"fmt"
"net/http"
"net/http/httptest"
...
...
@@ -249,7 +250,8 @@ func (aok *testDownloadOkViaSendArchive) Inject(w http.ResponseWriter, r *http.R
// if we ever get to this point - auth handler approved
// access and thus it is ok to download
aok
.
authReply
.
RepoPath
=
param
.
RepoPath
//aok.authReply.RepoPath = param.RepoPath
aok
.
authReply
.
Repository
=
gitalypb
.
Repository
{
RelativePath
:
param
.
RepoPath
}
}
// Ask auth backend about whether download is ok for a project.
...
...
@@ -303,7 +305,7 @@ func (a *API) verifyDownloadAccess(project string, user *url.Userinfo, query str
sendfile
.
SendFile
(
proxypkg
.
NewProxy
(
a
.
URL
,
a
.
Version
,
a
.
Client
.
Transport
.
(
*
badgateway
.
RoundTripper
),
a
.
Client
.
Transport
.
(
http
.
RoundTripper
),
)),
aok
,
)
...
...
@@ -315,7 +317,8 @@ func (a *API) verifyDownloadAccess(project string, user *url.Userinfo, query str
// The reason we want to do this second try is that HTTP auth is
// handled by upstream auth backend for git requests only, and we might
// want to use e.g. https://gitlab-ci-token:token@/.../raw/...
if
authReply
.
RepoPath
!=
""
||
query
!=
""
||
len
(
header
)
!=
0
{
//if authReply.RepoPath != "" || query != "" || len(header) != 0 {
if
authReply
.
Repository
.
RelativePath
!=
""
||
query
!=
""
||
len
(
header
)
!=
0
{
return
authReply
}
if
user
==
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment