Class: Simple::OAuth2::Strategies::AuthorizationCode

Inherits:
Base
  • Object
show all
Defined in:
lib/simple_oauth2/strategies/authorization_code.rb

Overview

Authorization Code strategy class Processes request and respond with Access Token

Class Method Summary collapse

Methods inherited from Base

authenticate_access_grant, authenticate_client, authenticate_resource_owner, authorization_verify_client!, expose_to_bearer_token, token_verify_client!

Class Method Details

.process(request) ⇒ Object

Processes Authorization Code request



9
10
11
12
13
14
15
16
17
# File 'lib/simple_oauth2/strategies/authorization_code.rb', line 9

def process(request)
  client = token_verify_client!(request)

  code = authenticate_access_grant(request) || request.invalid_grant!
  code.redirect_uri == request.redirect_uri || request.invalid_grant!

  token = config.access_token_class.create_for(client, code.resource_owner, code.scopes)
  expose_to_bearer_token(token)
end