diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-08-20 18:42:06 +0000 |
commit | 6e4e1050d9dba2b7b2523fdd1768823ab85feef4 (patch) | |
tree | 78be5963ec075d80116a932011d695dd33910b4e /spec/support/helpers/http_basic_auth_helpers.rb | |
parent | 1ce776de4ae122aba3f349c02c17cebeaa8ecf07 (diff) | |
download | gitlab-ce-6e4e1050d9dba2b7b2523fdd1768823ab85feef4.tar.gz |
Add latest changes from gitlab-org/gitlab@13-3-stable-ee
Diffstat (limited to 'spec/support/helpers/http_basic_auth_helpers.rb')
-rw-r--r-- | spec/support/helpers/http_basic_auth_helpers.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/spec/support/helpers/http_basic_auth_helpers.rb b/spec/support/helpers/http_basic_auth_helpers.rb index c0b24b3dfa4..bc34e073f9f 100644 --- a/spec/support/helpers/http_basic_auth_helpers.rb +++ b/spec/support/helpers/http_basic_auth_helpers.rb @@ -8,19 +8,22 @@ module HttpBasicAuthHelpers end def job_basic_auth_header(job) - basic_auth_header(Ci::Build::CI_REGISTRY_USER, job.token) + basic_auth_header(::Gitlab::Auth::CI_JOB_USER, job.token) end def client_basic_auth_header(client) basic_auth_header(client.uid, client.secret) end + def build_auth_headers(value) + { 'HTTP_AUTHORIZATION' => value } + end + + def build_token_auth_header(token) + build_auth_headers("Bearer #{token}") + end + def basic_auth_header(username, password) - { - 'HTTP_AUTHORIZATION' => ActionController::HttpAuthentication::Basic.encode_credentials( - username, - password - ) - } + build_auth_headers(ActionController::HttpAuthentication::Basic.encode_credentials(username, password)) end end |