Class: Doorkeeper::OAuth::ClientCredentials::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, validator) ⇒ Issuer

Returns a new instance of Issuer.



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

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

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



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

def error
  @error
end

#tokenObject (readonly)

Returns the value of attribute token.



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

def token
  @token
end

#validatorObject (readonly)

Returns the value of attribute validator.



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

def validator
  @validator
end

Instance Method Details

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



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

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

  @token
end