diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-19 18:44:42 +0300 |
commit | 4555e1b21c365ed8303ffb7a3325d773c9b8bf31 (patch) | |
tree | 5423a1c7516cffe36384133ade12572cf709398d /app/controllers/oauth | |
parent | e570267f2f6b326480d284e0164a6464ba4081bc (diff) |
Add latest changes from gitlab-org/gitlab@13-12-stable-eev13.12.0-rc42
Diffstat (limited to 'app/controllers/oauth')
-rw-r--r-- | app/controllers/oauth/jira/authorizations_controller.rb | 10 |
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 |