Class: OauthAuthorizeController

Inherits:
ApplicationController
  • Object
show all
Includes:
Oauth2::Provider::SslHelper, Oauth2::Provider::TransactionHelper
Defined in:
app/controllers/oauth_authorize_controller.rb

Overview

Copyright © 2010 ThoughtWorks Inc. (thoughtworks.com) Licenced under the MIT License (www.opensource.org/licenses/mit-license.php)

Instance Method Summary collapse

Methods included from Oauth2::Provider::TransactionHelper

included

Methods included from Oauth2::Provider::SslHelper

included

Instance Method Details

#authorizeObject



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/oauth_authorize_controller.rb', line 15

def authorize
  return unless validate_params

  unless params[:authorize] == 'Yes'
    redirect_to "#{params[:redirect_uri]}?error=access-denied"
    return
  end

  authorization = @client.create_authorization_for_user_id(current_user_id_for_oauth)
  state_param = if params[:state].blank?
    ""
  else
    "&state=#{CGI.escape(params[:state])}"
  end

  redirect_to "#{params[:redirect_uri]}?code=#{authorization.code}&expires_in=#{authorization.expires_in}#{state_param}"
end

#indexObject



11
12
13
# File 'app/controllers/oauth_authorize_controller.rb', line 11

def index
  return unless validate_params
end