Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'ruby/lib/gitlab/git/http_auth.rb')
-rw-r--r--ruby/lib/gitlab/git/http_auth.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/ruby/lib/gitlab/git/http_auth.rb b/ruby/lib/gitlab/git/http_auth.rb
new file mode 100644
index 000000000..135135efe
--- /dev/null
+++ b/ruby/lib/gitlab/git/http_auth.rb
@@ -0,0 +1,20 @@
+module Git
+ module Gitlab
+ class HttpAuth
+ def self.from_gitaly(request)
+ repo = request.repository
+ params = request.remote_params
+ # validate params, don't set config if bad, or raise error?
+
+ key = "http.#{params.url}.extraHeader"
+ repo.rugged.config[key] = params.httpAuth
+
+ begin
+ yield # yield back to fetch_remote RPC handler
+ ensure
+ repo.rugged.config.delete(key)
+ end
+ end
+ end
+ end
+end