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/gitaly_remote_repository.rb')
-rw-r--r--ruby/lib/gitlab/git/gitaly_remote_repository.rb10
1 files changed, 7 insertions, 3 deletions
diff --git a/ruby/lib/gitlab/git/gitaly_remote_repository.rb b/ruby/lib/gitlab/git/gitaly_remote_repository.rb
index ab0380ed7..d841c52db 100644
--- a/ruby/lib/gitlab/git/gitaly_remote_repository.rb
+++ b/ruby/lib/gitlab/git/gitaly_remote_repository.rb
@@ -56,13 +56,13 @@ module Gitlab
end
def token
- gitaly_client.token(storage).to_s
+ @token ||= gitaly_client.token(storage).to_s
end
def request_kwargs
@request_kwargs ||= begin
metadata = {
- 'authorization' => "Bearer #{auhtorization_token}",
+ 'authorization' => "Bearer #{authorization_token}",
'client_name' => CLIENT_NAME
}
@@ -70,7 +70,11 @@ module Gitlab
end
end
- def auhtorization_token
+ def authorization_token
+ # TODO: Remove support for direct secret handling (i.e. v1 auth scheme)
+ # https://gitlab.com/gitlab-org/gitaly/issues/1388
+ return token if token.split('.')[0] == 'v2'
+
issued_at = Time.now.to_i.to_s
hmac = OpenSSL::HMAC.hexdigest(OpenSSL::Digest::SHA256.new, token, issued_at)