Class: Doorkeeper::DeviceAuthorizationGrant::Config

Inherits:
Object
  • Object
show all
Extended by:
Config::Option
Defined in:
lib/doorkeeper/device_authorization_grant/config.rb

Overview

Configuration model for Doorkeeper DeviceAuthorizationGrant

Defined Under Namespace

Classes: Builder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#device_code_expires_inInteger (readonly)

Device code expiration time, in seconds.

Returns:

  • (Integer)


50
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 50

option :device_code_expires_in, default: 300

#device_code_polling_intervalInteger (readonly)

Minimum device code polling interval expected from the client, expressed in seconds.

Returns:

  • (Integer)


45
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 45

option :device_code_polling_interval, default: 5

#device_grant_classString (readonly)

Customizable reference to the DeviceGrant model.

Returns:

  • (String)


55
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 55

option :device_grant_class, default: 'Doorkeeper::DeviceAuthorizationGrant::DeviceGrant'

#user_code_generatorString (readonly)

Reference to a model (or class) for user code generation.

It must implement a ‘.generate` method, which can be invoked without arguments, to obtain a String user code value.

Returns:

  • (String)


63
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 63

option :user_code_generator, default: 'Doorkeeper::DeviceAuthorizationGrant::OAuth::Helpers::UserCode'

#verification_uriProc (readonly)

A Proc returning the end-user verification URI on the authorization server.

Returns:

  • (Proc)


68
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 68

option :verification_uri, default: ->(host_name) { "#{host_name}/oauth/device" }

#verification_uri_completeProc (readonly)

A Proc returning the verification URI that includes the “user_code” (or other information with the same function as the “user_code”), which is designed for non-textual transmission. This is optional, so the Proc can also return ‘nil`.

Returns:

  • (Proc)


76
77
78
79
80
81
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 76

option(
  :verification_uri_complete,
  default: lambda do |verification_uri, _host_name, device_grant|
    "#{verification_uri}?user_code=#{CGI.escape(device_grant.user_code)}"
  end
)

Class Method Details

.builder_classObject



36
37
38
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 36

def self.builder_class
  Config::Builder
end

Instance Method Details

#device_grant_modelClass

Returns:

  • (Class)


84
85
86
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 84

def device_grant_model
  @device_grant_model ||= device_grant_class.constantize
end

#user_code_generator_classClass, Module

Returns:

  • (Class, Module)


89
90
91
# File 'lib/doorkeeper/device_authorization_grant/config.rb', line 89

def user_code_generator_class
  @user_code_generator_class ||= user_code_generator.constantize
end