Class: Doorkeeper::DeviceAuthorizationGrant::OAuth::DeviceCodeRequest

Inherits:
OAuth::BaseRequest
  • Object
show all
Defined in:
lib/doorkeeper/device_authorization_grant/oauth/device_code_request.rb

Overview

Doorkeeper request object for handling OAuth 2.0 Device Access Token Requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server, client, device_grant) ⇒ DeviceCodeRequest

Returns a new instance of DeviceCodeRequest.

Parameters:



21
22
23
24
25
26
27
28
29
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_code_request.rb', line 21

def initialize(server, client, device_grant)
  super()

  @server = server
  @client = client
  @device_grant = device_grant

  @grant_type = Doorkeeper::DeviceAuthorizationGrant::OAuth::DEVICE_CODE
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



10
11
12
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_code_request.rb', line 10

def access_token
  @access_token
end

#clientObject

Returns the value of attribute client.



10
11
12
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_code_request.rb', line 10

def client
  @client
end

#device_grantDeviceGrant

Returns:



13
14
15
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_code_request.rb', line 13

def device_grant
  @device_grant
end

#serverObject

Returns the value of attribute server.



10
11
12
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_code_request.rb', line 10

def server
  @server
end

Instance Method Details

#before_successful_responseObject



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_code_request.rb', line 31

def before_successful_response
  check_grant_errors!
  check_user_interaction!

  device_grant.transaction do
    device_grant.lock!
    device_grant.destroy!
    generate_access_token
  end

  super
end