Class: Simple::OAuth2::Strategies::Token

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

Overview

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

Processes Token request



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

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

  access_token = config.access_token_class.create_for(
    client,
    config.resource_owner_authenticator.call(request),
    request.scope.join(',')
  )

  response.access_token = expose_to_bearer_token(access_token)
end