Class: Doorkeeper::OAuth::ClientCredentialsRequest

Inherits:
BaseRequest
  • Object
show all
Defined in:
lib/doorkeeper/oauth/client_credentials_request.rb

Instance Attribute Summary collapse

Attributes inherited from BaseRequest

#grant_type, #server

Attributes included from Validations

#error

Instance Method Summary collapse

Methods inherited from BaseRequest

#after_successful_response, #authorize, #before_successful_response, #find_or_create_access_token, #scopes

Methods included from Validations

#validate

Constructor Details

#initialize(server, client, parameters = {}) ⇒ ClientCredentialsRequest

Returns a new instance of ClientCredentialsRequest.



12
13
14
15
16
17
# File 'lib/doorkeeper/oauth/client_credentials_request.rb', line 12

def initialize(server, client, parameters = {})
  @client = client
  @server = server
  @response = nil
  @original_scopes = parameters[:scope]
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/doorkeeper/oauth/client_credentials_request.rb', line 6

def client
  @client
end

#original_scopesObject (readonly)

Returns the value of attribute original_scopes.



6
7
8
# File 'lib/doorkeeper/oauth/client_credentials_request.rb', line 6

def original_scopes
  @original_scopes
end

#responseObject (readonly) Also known as: error_response

Returns the value of attribute response.



6
7
8
# File 'lib/doorkeeper/oauth/client_credentials_request.rb', line 6

def response
  @response
end

Instance Method Details

#access_tokenObject



19
20
21
# File 'lib/doorkeeper/oauth/client_credentials_request.rb', line 19

def access_token
  issuer.token
end

#issuerObject



23
24
25
26
27
28
# File 'lib/doorkeeper/oauth/client_credentials_request.rb', line 23

def issuer
  @issuer ||= ClientCredentials::Issuer.new(
    server,
    ClientCredentials::Validator.new(server, self),
  )
end