summaryrefslogtreecommitdiff
path: root/lib/api/helpers/packages/basic_auth_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/helpers/packages/basic_auth_helpers.rb')
-rw-r--r--lib/api/helpers/packages/basic_auth_helpers.rb13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/api/helpers/packages/basic_auth_helpers.rb b/lib/api/helpers/packages/basic_auth_helpers.rb
index 835b5f4614c..e35a8712131 100644
--- a/lib/api/helpers/packages/basic_auth_helpers.rb
+++ b/lib/api/helpers/packages/basic_auth_helpers.rb
@@ -4,6 +4,8 @@ module API
module Helpers
module Packages
module BasicAuthHelpers
+ extend ::Gitlab::Utils::Override
+
module Constants
AUTHENTICATE_REALM_HEADER = 'Www-Authenticate: Basic realm'
AUTHENTICATE_REALM_NAME = 'GitLab Packages Registry'
@@ -11,10 +13,6 @@ module API
include Constants
- def find_personal_access_token
- find_personal_access_token_from_http_basic_auth
- end
-
def unauthorized_user_project
@unauthorized_user_project ||= find_project(params[:id])
end
@@ -44,12 +42,13 @@ module API
end
def unauthorized_or!
- current_user ? yield : unauthorized_with_header!
+ current_user ? yield : unauthorized!
end
- def unauthorized_with_header!
+ override :unauthorized!
+ def unauthorized!
header(AUTHENTICATE_REALM_HEADER, AUTHENTICATE_REALM_NAME)
- unauthorized!
+ super
end
end
end