Class: Devise::Oauth::AuthorizationsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Helpers
Defined in:
app/controllers/devise/oauth/authorizations_controller.rb

Instance Method Summary collapse

Methods included from Helpers

#access_blocked?, #client_blocked?, #normalize_scope

Instance Method Details

#createObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/devise/oauth/authorizations_controller.rb', line 18

def create
  @client.granted!

  # section 4.1.1 - authorization code flow
  if params[:response_type] == "code"
    @authorization = Devise::Oauth::Authorization.create(client: @client, resource_owner: @resource_owner, scope: @scope)
    redirect_to authorization_redirect_uri(@client, @authorization, params[:state])
  end

  # section 4.2.1 - implicit grant flow
  if params[:response_type] == "token"
    @token = Devise::Oauth::AccessToken.create(client: @client, resource_owner: @resource_owner, scope: scope)
    redirect_to implicit_redirect_uri(@client, @token, params[:state])
  end
end

#destroyObject



34
35
36
37
# File 'app/controllers/devise/oauth/authorizations_controller.rb', line 34

def destroy
  @client.revoked!
  redirect_to deny_redirect_uri(params[:response_type], params[:state])
end

#showObject

before_filter :token_blocked?, only: :show # check for an existing token before_filter :refresh_token, only: :show # create a new token



15
16
# File 'app/controllers/devise/oauth/authorizations_controller.rb', line 15

def show
end