Module: Doorkeeper::DeviceAuthorizationGrant::DeviceGrantMixin

Extended by:
ActiveSupport::Concern
Includes:
Models::Expirable
Included in:
DeviceGrant
Defined in:
lib/doorkeeper/device_authorization_grant/orm/active_record/device_grant_mixin.rb

Overview

Module mixin for Device Grant models.

This is similar to Doorkeeper ‘AccessGrantMixin`, but specific for handling OAuth 2.0 Device Authorization Grant.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#plaintext_device_codeObject

We keep a volatile copy of the raw device code for initial communication.

Some strategies allow restoring stored secrets (e.g. symmetric encryption) while hashing strategies do not, so you cannot rely on this value returning a present value for persisted device codes.



114
115
116
117
118
119
120
# File 'lib/doorkeeper/device_authorization_grant/orm/active_record/device_grant_mixin.rb', line 114

def plaintext_device_code
  if secret_strategy.allows_restoring_secrets?
    secret_strategy.restore_secret(self, :device_code)
  else
    @raw_device_code
  end
end