Class: Doorkeeper::AuthorizationsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/doorkeeper/authorizations_controller.rb

Instance Method Summary collapse

Methods included from Helpers::Controller

#authenticate_admin!, #authenticate_resource_owner!, #current_resource_owner, #get_error_response_from_exception, #handle_token_exception, included, #resource_owner_from_credentials, #server, #skip_authorization?

Instance Method Details

#createObject

TODO: Handle raise invalid authorization



23
24
25
26
27
28
29
30
31
# File 'app/controllers/doorkeeper/authorizations_controller.rb', line 23

def create
  auth = authorization.authorize

  if auth.redirectable?
    redirect_to auth.redirect_uri
  else
    render :json => auth.body, :status => auth.status
  end
end

#destroyObject



33
34
35
36
37
38
39
40
41
# File 'app/controllers/doorkeeper/authorizations_controller.rb', line 33

def destroy
  auth = authorization.deny

  if auth.redirectable?
    redirect_to auth.redirect_uri
  else
    render :json => auth.body, :status => auth.status
  end
end

#newObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/controllers/doorkeeper/authorizations_controller.rb', line 5

def new
  if pre_auth.authorizable?
    #p pre_auth
    if Doorkeeper::AccessToken.matching_token_for(pre_auth.client, current_resource_owner.id, pre_auth.scopes) || skip_authorization?
      auth = authorization.authorize
      redirect_to auth.redirect_uri
    else
      render :new
    end
  else
    render :error
  end
end

#showObject



19
20
# File 'app/controllers/doorkeeper/authorizations_controller.rb', line 19

def show
end