diff options
author | Markus Koller <markus-koller@gmx.ch> | 2016-12-09 18:37:18 +0100 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-03-07 14:54:36 +0100 |
commit | 6bf7037ecdf33de9b1d3962bda547b1097cdd59c (patch) | |
tree | 0aff17a45f62b4bafaa43ec8b9a3f8ce3d66a643 /app/controllers/oauth | |
parent | c4982890489d254da2fe998aab30bf257767ed5e (diff) | |
download | gitlab-ce-6bf7037ecdf33de9b1d3962bda547b1097cdd59c.tar.gz |
Remove duplicated code in Oauth::AuthorizationsController
Diffstat (limited to 'app/controllers/oauth')
-rw-r--r-- | app/controllers/oauth/authorizations_controller.rb | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/app/controllers/oauth/authorizations_controller.rb b/app/controllers/oauth/authorizations_controller.rb index c721dca58d9..05190103767 100644 --- a/app/controllers/oauth/authorizations_controller.rb +++ b/app/controllers/oauth/authorizations_controller.rb @@ -1,8 +1,8 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController - before_action :authenticate_resource_owner! - layout 'profile' + # Overriden from Doorkeeper::AuthorizationsController to + # include the call to session.delete def new if pre_auth.authorizable? if skip_authorization? || matching_token? @@ -16,44 +16,4 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController render "doorkeeper/authorizations/error" 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 |