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
18
# 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]
  @parameters = parameters.except(: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

#parametersObject (readonly)

Returns the value of attribute parameters.



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

def parameters
  @parameters
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



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

def access_token
  issuer.token
end

#issuerObject



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

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