Class: Doorkeeper::OAuth::Authorization::Code

Inherits:
Object
  • Object
show all
Defined in:
lib/doorkeeper/oauth/authorization/code.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pre_auth, resource_owner) ⇒ Code

Returns a new instance of Code.



9
10
11
12
# File 'lib/doorkeeper/oauth/authorization/code.rb', line 9

def initialize(pre_auth, resource_owner)
  @pre_auth = pre_auth
  @resource_owner = resource_owner
end

Instance Attribute Details

#pre_authObject (readonly)

Returns the value of attribute pre_auth.



7
8
9
# File 'lib/doorkeeper/oauth/authorization/code.rb', line 7

def pre_auth
  @pre_auth
end

#resource_ownerObject (readonly)

Returns the value of attribute resource_owner.



7
8
9
# File 'lib/doorkeeper/oauth/authorization/code.rb', line 7

def resource_owner
  @resource_owner
end

#tokenObject (readonly)

Returns the value of attribute token.



7
8
9
# File 'lib/doorkeeper/oauth/authorization/code.rb', line 7

def token
  @token
end

Instance Method Details

#access_grant?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/doorkeeper/oauth/authorization/code.rb', line 24

def access_grant?
  true
end

#issue_token!Object



14
15
16
17
18
# File 'lib/doorkeeper/oauth/authorization/code.rb', line 14

def issue_token!
  return @token if defined?(@token)

  @token = Doorkeeper.config.access_grant_model.create!(access_grant_attributes)
end

#oob_redirectObject



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

def oob_redirect
  { action: :show, code: token.plaintext_token }
end