summaryrefslogtreecommitdiff
path: root/app/controllers/jwt_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/jwt_controller.rb')
-rw-r--r--app/controllers/jwt_controller.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/jwt_controller.rb b/app/controllers/jwt_controller.rb
index 67057b5b126..4d9922e1bb0 100644
--- a/app/controllers/jwt_controller.rb
+++ b/app/controllers/jwt_controller.rb
@@ -55,5 +55,17 @@ class JwtController < ApplicationController
def auth_params
params.permit(:service, :scope, :account, :client_id)
+ .merge(scopes: scopes_param)
+ end
+
+ # We have to parse scope as Docker Clients send.
+ # And we loose second scope when being processed by Rails:
+ # scope=scopeA&scope=scopeB
+ #
+ # This method always returns an array of scopes
+ def scopes_param
+ return unless params[:scope].present?
+
+ [Rack::Utils.parse_query(request.query_string)['scope']].flatten
end
end