summaryrefslogtreecommitdiff
path: root/app/controllers/oauth
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-05-13 09:10:44 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2021-05-13 09:10:44 +0000
commit19325d74c2a5e7f367c6d1d6a064650f90a5b3e7 (patch)
tree89801bfd3524ac992407048bc1cd2d3f233e50c7 /app/controllers/oauth
parenta9c127515a36f928544b18ddd69e8b2dc6236aba (diff)
downloadgitlab-ce-19325d74c2a5e7f367c6d1d6a064650f90a5b3e7.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/controllers/oauth')
-rw-r--r--app/controllers/oauth/jira/authorizations_controller.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/app/controllers/oauth/jira/authorizations_controller.rb b/app/controllers/oauth/jira/authorizations_controller.rb
index f23149c8544..8169b5fcbb0 100644
--- a/app/controllers/oauth/jira/authorizations_controller.rb
+++ b/app/controllers/oauth/jira/authorizations_controller.rb
@@ -16,7 +16,7 @@ class Oauth::Jira::AuthorizationsController < ApplicationController
redirect_to oauth_authorization_path(client_id: params['client_id'],
response_type: 'code',
- scope: params['scope'],
+ scope: normalize_scope(params['scope']),
redirect_uri: oauth_jira_callback_url)
end
@@ -48,4 +48,12 @@ class Oauth::Jira::AuthorizationsController < ApplicationController
rescue Doorkeeper::Errors::DoorkeeperError => e
render status: :unauthorized, body: e.type
end
+
+ private
+
+ # When using the GitHub Enterprise connector in Jira we receive the "repo" scope,
+ # this doesn't exist in GitLab but we can map it to our "api" scope.
+ def normalize_scope(scope)
+ scope == 'repo' ? 'api' : scope
+ end
end