Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
5d58fc40
Commit
5d58fc40
authored
Mar 15, 2022
by
Andy Soiron
Committed by
Luke Duncalfe
Mar 20, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename namespace Oauth::Jira to Oauth::JiraDvcs
To point out that it's only used for DVCS
parent
81f5f80f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+13
-13
.rubocop_todo/rspec/any_instance_of.yml
.rubocop_todo/rspec/any_instance_of.yml
+1
-1
.rubocop_todo/rspec/verified_doubles.yml
.rubocop_todo/rspec/verified_doubles.yml
+1
-1
app/controllers/oauth/jira_dvcs/authorizations_controller.rb
app/controllers/oauth/jira_dvcs/authorizations_controller.rb
+3
-3
config/routes.rb
config/routes.rb
+1
-1
spec/controllers/oauth/jira_dvcs/authorizations_controller_spec.rb
...rollers/oauth/jira_dvcs/authorizations_controller_spec.rb
+3
-3
spec/features/jira_oauth_provider_authorize_spec.rb
spec/features/jira_oauth_provider_authorize_spec.rb
+3
-3
spec/requests/jira_authorizations_spec.rb
spec/requests/jira_authorizations_spec.rb
+1
-1
No files found.
.rubocop_todo/rspec/any_instance_of.yml
View file @
5d58fc40
...
...
@@ -141,7 +141,7 @@ RSpec/AnyInstanceOf:
-
spec/controllers/groups/settings/ci_cd_controller_spec.rb
-
spec/controllers/groups_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/projects/artifacts_controller_spec.rb
-
spec/controllers/projects/branches_controller_spec.rb
...
...
.rubocop_todo/rspec/verified_doubles.yml
View file @
5d58fc40
...
...
@@ -295,7 +295,7 @@ RSpec/VerifiedDoubles:
-
spec/controllers/import/gitea_controller_spec.rb
-
spec/controllers/import/github_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/profiles/two_factor_auths_controller_spec.rb
-
spec/controllers/projects/blob_controller_spec.rb
...
...
app/controllers/oauth/jira/authorizations_controller.rb
→
app/controllers/oauth/jira
_dvcs
/authorizations_controller.rb
View file @
5d58fc40
...
...
@@ -4,7 +4,7 @@
# flow routes for Jira DVCS integration.
# See https://gitlab.com/gitlab-org/gitlab/issues/2381
#
class
Oauth::Jira::AuthorizationsController
<
ApplicationController
class
Oauth::Jira
Dvcs
::AuthorizationsController
<
ApplicationController
skip_before_action
:authenticate_user!
skip_before_action
:verify_authenticity_token
...
...
@@ -17,7 +17,7 @@ class Oauth::Jira::AuthorizationsController < ApplicationController
redirect_to
oauth_authorization_path
(
client_id:
params
[
'client_id'
],
response_type:
'code'
,
scope:
normalize_scope
(
params
[
'scope'
]),
redirect_uri:
oauth_jira_callback_url
)
redirect_uri:
oauth_jira_
dvcs_
callback_url
)
end
# 2. Handle the callback call as we were a Github Enterprise instance client.
...
...
@@ -33,7 +33,7 @@ class Oauth::Jira::AuthorizationsController < ApplicationController
# 3. Rewire and adjust access_token request accordingly.
def
access_token
# 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'
)
response
=
strategy
.
authorize
...
...
config/routes.rb
View file @
5d58fc40
...
...
@@ -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
# 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
:callback
post
:access_token
...
...
spec/controllers/oauth/jira/authorizations_controller_spec.rb
→
spec/controllers/oauth/jira
_dvcs
/authorizations_controller_spec.rb
View file @
5d58fc40
...
...
@@ -2,7 +2,7 @@
require
'spec_helper'
RSpec
.
describe
Oauth
::
Jira
::
AuthorizationsController
do
RSpec
.
describe
Oauth
::
Jira
Dvcs
::
AuthorizationsController
do
describe
'GET new'
do
it
'redirects to OAuth authorization with correct params'
do
get
:new
,
params:
{
client_id:
'client-123'
,
scope:
'foo'
,
redirect_uri:
'http://example.com/'
}
...
...
@@ -10,7 +10,7 @@ RSpec.describe Oauth::Jira::AuthorizationsController do
expect
(
response
).
to
redirect_to
(
oauth_authorization_url
(
client_id:
'client-123'
,
response_type:
'code'
,
scope:
'foo'
,
redirect_uri:
oauth_jira_callback_url
))
redirect_uri:
oauth_jira_
dvcs_
callback_url
))
end
it
'replaces the GitHub "repo" scope with "api"'
do
...
...
@@ -19,7 +19,7 @@ RSpec.describe Oauth::Jira::AuthorizationsController do
expect
(
response
).
to
redirect_to
(
oauth_authorization_url
(
client_id:
'client-123'
,
response_type:
'code'
,
scope:
'api'
,
redirect_uri:
oauth_jira_callback_url
))
redirect_uri:
oauth_jira_
dvcs_
callback_url
))
end
end
...
...
spec/features/jira_oauth_provider_authorize_spec.rb
View file @
5d58fc40
...
...
@@ -4,13 +4,13 @@ require 'spec_helper'
RSpec
.
describe
'JIRA OAuth Provider'
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
sign_in
(
user
)
visit
oauth_jira_authorize_path
(
client_id:
application
.
uid
,
redirect_uri:
oauth_jira_callback_url
,
visit
oauth_jira_
dvcs_
authorize_path
(
client_id:
application
.
uid
,
redirect_uri:
oauth_jira_
dvcs_
callback_url
,
response_type:
'code'
,
state:
'my_state'
,
scope:
'read_user'
)
...
...
spec/requests/jira_authorizations_spec.rb
View file @
5d58fc40
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
'Jira authorization requests'
do
let
(
:user
)
{
create
:user
}
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
create
:oauth_access_grant
,
application:
application
,
resource_owner_id:
user
.
id
,
redirect_uri:
redirect_uri
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment