Class: Simple::OAuth2::Strategies::Code

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

Overview

Code strategy class. Processes request and respond with Code

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, response) ⇒ Object

Processes Code request


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

def process(request, response)
  client = authorization_verify_client!(request, response)

  authorization_code = config.access_grant_class.create_for(
    client,
    config.resource_owner_authenticator.call(request),
    response.redirect_uri,
    request.scope.join(',')
  )

  response.code = authorization_code.token
end