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
6bf7037e
Commit
6bf7037e
authored
Dec 09, 2016
by
Markus Koller
Committed by
Alexis Reigel
Mar 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove duplicated code in Oauth::AuthorizationsController
parent
c4982890
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
42 deletions
+2
-42
app/controllers/oauth/authorizations_controller.rb
app/controllers/oauth/authorizations_controller.rb
+2
-42
No files found.
app/controllers/oauth/authorizations_controller.rb
View file @
6bf7037e
class
Oauth::AuthorizationsController
<
Doorkeeper
::
AuthorizationsController
class
Oauth::AuthorizationsController
<
Doorkeeper
::
AuthorizationsController
before_action
:authenticate_resource_owner!
layout
'profile'
layout
'profile'
# Overriden from Doorkeeper::AuthorizationsController to
# include the call to session.delete
def
new
def
new
if
pre_auth
.
authorizable?
if
pre_auth
.
authorizable?
if
skip_authorization?
||
matching_token?
if
skip_authorization?
||
matching_token?
...
@@ -16,44 +16,4 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
...
@@ -16,44 +16,4 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
render
"doorkeeper/authorizations/error"
render
"doorkeeper/authorizations/error"
end
end
end
end
# TODO: Handle raise invalid authorization
def
create
redirect_or_render
authorization
.
authorize
end
def
destroy
redirect_or_render
authorization
.
deny
end
private
def
matching_token?
Doorkeeper
::
AccessToken
.
matching_token_for
(
pre_auth
.
client
,
current_resource_owner
.
id
,
pre_auth
.
scopes
)
end
def
redirect_or_render
(
auth
)
if
auth
.
redirectable?
redirect_to
auth
.
redirect_uri
else
render
json:
auth
.
body
,
status:
auth
.
status
end
end
def
pre_auth
@pre_auth
||=
Doorkeeper
::
OAuth
::
PreAuthorization
.
new
(
Doorkeeper
.
configuration
,
server
.
client_via_uid
,
params
)
end
def
authorization
@authorization
||=
strategy
.
request
end
def
strategy
@strategy
||=
server
.
authorization_request
(
pre_auth
.
response_type
)
end
end
end
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