Class: Oauth2Provider::AuthorizeController

Inherits:
ApplicationController show all
Defined in:
app/controllers/oauth2_provider/authorize_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#_oauth_provider_admin?

Methods included from ControllerMixin

#_oauth_provider_authenticate, #_oauth_provider_json_body, #_oauth_provider_normalize_token, #api_request, #json?, #oauth_authorized, #session_auth

Instance Method Details

#createObject



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

def create
  @client.granted!

  # section 4.1.1 - authorization code flow
  if params[:response_type] == "code"
    @authorization = Oauth2Provider::OauthAuthorization.create(client_uri: @client.uri, resource_owner_uri: user_url(current_user), scope: params[:scope])
    redirect_to authorization_redirect_uri(@client, @authorization, params[:state])
  end

  # section 4.2.1 - implicit grant flow
  if params[:response_type] == "token"
    @token = Oauth2Provider::OauthToken.create(client_uri: @client.uri, resource_owner_uri: user_url(current_user), scope: params[:scope])
    redirect_to implicit_redirect_uri(@client, @token, params[:state])
  end
end

#destroyObject



34
35
36
37
# File 'app/controllers/oauth2_provider/authorize_controller.rb', line 34

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

#showObject



14
15
16
# File 'app/controllers/oauth2_provider/authorize_controller.rb', line 14

def show
  render "shared/authorize" and return
end