Commit 1e23069c authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch 'andysoiron/rename-oauth-jira-namespace' into 'master'

Rename namespace `Oauth::Jira` to `Oauth::JiraDvcs`

See merge request gitlab-org/gitlab!82903
parents 4b9497ad 5d58fc40
...@@ -141,7 +141,7 @@ RSpec/AnyInstanceOf: ...@@ -141,7 +141,7 @@ RSpec/AnyInstanceOf:
- spec/controllers/groups/settings/ci_cd_controller_spec.rb - spec/controllers/groups/settings/ci_cd_controller_spec.rb
- spec/controllers/groups_controller_spec.rb - spec/controllers/groups_controller_spec.rb
- spec/controllers/import/bitbucket_controller_spec.rb - spec/controllers/import/bitbucket_controller_spec.rb
- spec/controllers/oauth/jira/authorizations_controller_spec.rb - spec/controllers/oauth/jira_dvcs/authorizations_controller_spec.rb
- spec/controllers/omniauth_callbacks_controller_spec.rb - spec/controllers/omniauth_callbacks_controller_spec.rb
- spec/controllers/projects/artifacts_controller_spec.rb - spec/controllers/projects/artifacts_controller_spec.rb
- spec/controllers/projects/branches_controller_spec.rb - spec/controllers/projects/branches_controller_spec.rb
......
...@@ -295,7 +295,7 @@ RSpec/VerifiedDoubles: ...@@ -295,7 +295,7 @@ RSpec/VerifiedDoubles:
- spec/controllers/import/gitea_controller_spec.rb - spec/controllers/import/gitea_controller_spec.rb
- spec/controllers/import/github_controller_spec.rb - spec/controllers/import/github_controller_spec.rb
- spec/controllers/import/gitlab_controller_spec.rb - spec/controllers/import/gitlab_controller_spec.rb
- spec/controllers/oauth/jira/authorizations_controller_spec.rb - spec/controllers/oauth/jira_dvcs/authorizations_controller_spec.rb
- spec/controllers/omniauth_callbacks_controller_spec.rb - spec/controllers/omniauth_callbacks_controller_spec.rb
- spec/controllers/profiles/two_factor_auths_controller_spec.rb - spec/controllers/profiles/two_factor_auths_controller_spec.rb
- spec/controllers/projects/blob_controller_spec.rb - spec/controllers/projects/blob_controller_spec.rb
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# flow routes for Jira DVCS integration. # flow routes for Jira DVCS integration.
# See https://gitlab.com/gitlab-org/gitlab/issues/2381 # See https://gitlab.com/gitlab-org/gitlab/issues/2381
# #
class Oauth::Jira::AuthorizationsController < ApplicationController class Oauth::JiraDvcs::AuthorizationsController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
...@@ -17,7 +17,7 @@ class Oauth::Jira::AuthorizationsController < ApplicationController ...@@ -17,7 +17,7 @@ class Oauth::Jira::AuthorizationsController < ApplicationController
redirect_to oauth_authorization_path(client_id: params['client_id'], redirect_to oauth_authorization_path(client_id: params['client_id'],
response_type: 'code', response_type: 'code',
scope: normalize_scope(params['scope']), scope: normalize_scope(params['scope']),
redirect_uri: oauth_jira_callback_url) redirect_uri: oauth_jira_dvcs_callback_url)
end end
# 2. Handle the callback call as we were a Github Enterprise instance client. # 2. Handle the callback call as we were a Github Enterprise instance client.
...@@ -33,7 +33,7 @@ class Oauth::Jira::AuthorizationsController < ApplicationController ...@@ -33,7 +33,7 @@ class Oauth::Jira::AuthorizationsController < ApplicationController
# 3. Rewire and adjust access_token request accordingly. # 3. Rewire and adjust access_token request accordingly.
def access_token def access_token
# We have to modify request.parameters because Doorkeeper::Server reads params from there # We have to modify request.parameters because Doorkeeper::Server reads params from there
request.parameters[:redirect_uri] = oauth_jira_callback_url request.parameters[:redirect_uri] = oauth_jira_dvcs_callback_url
strategy = Doorkeeper::Server.new(self).token_request('authorization_code') strategy = Doorkeeper::Server.new(self).token_request('authorization_code')
response = strategy.authorize response = strategy.authorize
......
...@@ -32,7 +32,7 @@ Rails.application.routes.draw do ...@@ -32,7 +32,7 @@ Rails.application.routes.draw do
# This prefixless path is required because Jira gets confused if we set it up with a path # This prefixless path is required because Jira gets confused if we set it up with a path
# More information: https://gitlab.com/gitlab-org/gitlab/issues/6752 # More information: https://gitlab.com/gitlab-org/gitlab/issues/6752
scope path: '/login/oauth', controller: 'oauth/jira/authorizations', as: :oauth_jira do scope path: '/login/oauth', controller: 'oauth/jira_dvcs/authorizations', as: :oauth_jira_dvcs do
get :authorize, action: :new get :authorize, action: :new
get :callback get :callback
post :access_token post :access_token
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe Oauth::Jira::AuthorizationsController do RSpec.describe Oauth::JiraDvcs::AuthorizationsController do
describe 'GET new' do describe 'GET new' do
it 'redirects to OAuth authorization with correct params' do it 'redirects to OAuth authorization with correct params' do
get :new, params: { client_id: 'client-123', scope: 'foo', redirect_uri: 'http://example.com/' } get :new, params: { client_id: 'client-123', scope: 'foo', redirect_uri: 'http://example.com/' }
...@@ -10,7 +10,7 @@ RSpec.describe Oauth::Jira::AuthorizationsController do ...@@ -10,7 +10,7 @@ RSpec.describe Oauth::Jira::AuthorizationsController do
expect(response).to redirect_to(oauth_authorization_url(client_id: 'client-123', expect(response).to redirect_to(oauth_authorization_url(client_id: 'client-123',
response_type: 'code', response_type: 'code',
scope: 'foo', scope: 'foo',
redirect_uri: oauth_jira_callback_url)) redirect_uri: oauth_jira_dvcs_callback_url))
end end
it 'replaces the GitHub "repo" scope with "api"' do it 'replaces the GitHub "repo" scope with "api"' do
...@@ -19,7 +19,7 @@ RSpec.describe Oauth::Jira::AuthorizationsController do ...@@ -19,7 +19,7 @@ RSpec.describe Oauth::Jira::AuthorizationsController do
expect(response).to redirect_to(oauth_authorization_url(client_id: 'client-123', expect(response).to redirect_to(oauth_authorization_url(client_id: 'client-123',
response_type: 'code', response_type: 'code',
scope: 'api', scope: 'api',
redirect_uri: oauth_jira_callback_url)) redirect_uri: oauth_jira_dvcs_callback_url))
end end
end end
......
...@@ -4,13 +4,13 @@ require 'spec_helper' ...@@ -4,13 +4,13 @@ require 'spec_helper'
RSpec.describe 'JIRA OAuth Provider' do RSpec.describe 'JIRA OAuth Provider' do
describe 'JIRA DVCS OAuth Authorization' do describe 'JIRA DVCS OAuth Authorization' do
let(:application) { create(:oauth_application, redirect_uri: oauth_jira_callback_url, scopes: 'read_user') } let(:application) { create(:oauth_application, redirect_uri: oauth_jira_dvcs_callback_url, scopes: 'read_user') }
before do before do
sign_in(user) sign_in(user)
visit oauth_jira_authorize_path(client_id: application.uid, visit oauth_jira_dvcs_authorize_path(client_id: application.uid,
redirect_uri: oauth_jira_callback_url, redirect_uri: oauth_jira_dvcs_callback_url,
response_type: 'code', response_type: 'code',
state: 'my_state', state: 'my_state',
scope: 'read_user') scope: 'read_user')
......
...@@ -5,7 +5,7 @@ require 'spec_helper' ...@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec.describe 'Jira authorization requests' do RSpec.describe 'Jira authorization requests' do
let(:user) { create :user } let(:user) { create :user }
let(:application) { create :oauth_application, scopes: 'api' } let(:application) { create :oauth_application, scopes: 'api' }
let(:redirect_uri) { oauth_jira_callback_url(host: "http://www.example.com") } let(:redirect_uri) { oauth_jira_dvcs_callback_url(host: "http://www.example.com") }
def generate_access_grant def generate_access_grant
create :oauth_access_grant, application: application, resource_owner_id: user.id, redirect_uri: redirect_uri create :oauth_access_grant, application: application, resource_owner_id: user.id, redirect_uri: redirect_uri
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment