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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-20 18:07:34 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-09-20 20:15:13 +0300
commitcf6a35f09a3f38b124bd0e6013950f21b5bb1851 (patch)
treee8b7664ffe5a4e7588cd57c94618a1843ab88327 /app
parent0672c5a92e8be90da0cb79f277bb7aee82fdba8a (diff)
Improve JwtController implementation
Diffstat (limited to 'app')
-rw-r--r--app/controllers/jwt_controller.rb6
-rw-r--r--app/services/auth/container_registry_authentication_service.rb2
2 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb
index 06d96774754..34d5d99558e 100644
--- a/app/controllers/jwt_controller.rb
+++ b/app/controllers/jwt_controller.rb
@@ -11,10 +11,8 @@ class JwtController < ApplicationController
service = SERVICES[params[:service]]
return head :not_found unless service
- @authentication_result ||= Gitlab::Auth::Result.new
-
result = service.new(@authentication_result.project, @authentication_result.actor, auth_params).
- execute(authentication_abilities: @authentication_result.authentication_abilities)
+ execute(authentication_abilities: @authentication_result.authentication_abilities || [])
render json: result, status: result[:http_status]
end
@@ -22,6 +20,8 @@ class JwtController < ApplicationController
private
def authenticate_project_or_user
+ @authentication_result = Gitlab::Auth::Result.new
+
authenticate_with_http_basic do |login, password|
@authentication_result = Gitlab::Auth.find_for_git_client(login, password, project: nil, ip: request.ip)
diff --git a/app/services/auth/container_registry_authentication_service.rb b/app/services/auth/container_registry_authentication_service.rb
index 98da6563947..38ac6631228 100644
--- a/app/services/auth/container_registry_authentication_service.rb
+++ b/app/services/auth/container_registry_authentication_service.rb
@@ -5,7 +5,7 @@ module Auth
AUDIENCE = 'container_registry'
def execute(authentication_abilities:)
- @authentication_abilities = authentication_abilities || []
+ @authentication_abilities = authentication_abilities
return error('not found', 404) unless registry.enabled