Class: Doorkeeper::DeviceAuthorizationGrant::OAuth::DeviceAuthorizationRequest
- Inherits:
-
OAuth::BaseRequest
- Object
- OAuth::BaseRequest
- Doorkeeper::DeviceAuthorizationGrant::OAuth::DeviceAuthorizationRequest
- Defined in:
- lib/doorkeeper/device_authorization_grant/oauth/device_authorization_request.rb
Overview
Doorkeeper request object for handling OAuth 2.0 Device Authorization Requests.
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
- #host_name ⇒ String
-
#server ⇒ Object
Returns the value of attribute server.
Instance Method Summary collapse
- #authorize ⇒ DeviceAuthorizationResponse, Doorkeeper::OAuth::ErrorResponse
-
#initialize(server, client, host_name, parameters = {}) ⇒ DeviceAuthorizationRequest
constructor
A new instance of DeviceAuthorizationRequest.
Constructor Details
#initialize(server, client, host_name, parameters = {}) ⇒ DeviceAuthorizationRequest
Returns a new instance of DeviceAuthorizationRequest.
21 22 23 24 25 26 27 |
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_authorization_request.rb', line 21 def initialize(server, client, host_name, parameters = {}) # rubocop:disable Style/OptionHash super() @server = server @client = client @host_name = host_name @original_scopes = parameters[:scope] end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
10 11 12 |
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_authorization_request.rb', line 10 def client @client end |
#host_name ⇒ String
13 14 15 |
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_authorization_request.rb', line 13 def host_name @host_name end |
#server ⇒ Object
Returns the value of attribute server.
10 11 12 |
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_authorization_request.rb', line 10 def server @server end |
Instance Method Details
#authorize ⇒ DeviceAuthorizationResponse, Doorkeeper::OAuth::ErrorResponse
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/doorkeeper/device_authorization_grant/oauth/device_authorization_request.rb', line 30 def validate @response = if valid? destroy_expired_device_grants! create_successful_response else Doorkeeper::OAuth::ErrorResponse.from_request(self) end end |