diff options
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 |