Class: Authn::TokenField::Finders::BaseEncrypted

Inherits:
Object
  • Object
show all
Defined in:
lib/authn/token_field/finders/base_encrypted.rb

Direct Known Subclasses

BaseEncryptedPartitioned

Instance Method Summary collapse

Constructor Details

#initialize(strategy, token, unscoped) ⇒ BaseEncrypted

Returns a new instance of BaseEncrypted.



7
8
9
10
11
12
13
14
15
16
# File 'lib/authn/token_field/finders/base_encrypted.rb', line 7

def initialize(strategy, token, unscoped)
  unless strategy.is_a?(::Authn::TokenField::Encrypted)
    raise ArgumentError,
      'Please provide an encrypted strategy.'
  end

  @strategy = strategy
  @token = token
  @unscoped = unscoped
end

Instance Method Details

#executeObject



18
19
20
# File 'lib/authn/token_field/finders/base_encrypted.rb', line 18

def execute
  base_scope.find_by(encrypted_field => tokens) # rubocop:disable CodeReuse/ActiveRecord -- have to use find_by
end