Class: Doorkeeper::OAuth::ClientCredentialsRequest::Issuer

Inherits:
Object
  • Object
show all
Defined in:
lib/doorkeeper/oauth/client_credentials/issuer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server, validation) ⇒ Issuer

Returns a new instance of Issuer.


9
10
11
# File 'lib/doorkeeper/oauth/client_credentials/issuer.rb', line 9

def initialize(server, validation)
  @server, @validation = server, validation
end

Instance Attribute Details

#errorObject

Returns the value of attribute error


7
8
9
# File 'lib/doorkeeper/oauth/client_credentials/issuer.rb', line 7

def error
  @error
end

#tokenObject

Returns the value of attribute token


7
8
9
# File 'lib/doorkeeper/oauth/client_credentials/issuer.rb', line 7

def token
  @token
end

#validationObject

Returns the value of attribute validation


7
8
9
# File 'lib/doorkeeper/oauth/client_credentials/issuer.rb', line 7

def validation
  @validation
end

Instance Method Details

#create(client, scopes, creator = Creator.new) ⇒ Object


13
14
15
16
17
18
19
20
21
22
# File 'lib/doorkeeper/oauth/client_credentials/issuer.rb', line 13

def create(client, scopes, creator = Creator.new)
  if validation.valid?
    @token = create_token(client, scopes, creator)
    @error = :server_error unless @token
  else
    @token = false
    @error = validation.error
  end
  @token
end