Class: RooOnRails::Concerns::RequireApiKey::Authenticator
- Inherits:
-
Object
- Object
- RooOnRails::Concerns::RequireApiKey::Authenticator
- Defined in:
- lib/roo_on_rails/concerns/require_api_key.rb
Overview
This functionality pulled out into a new class for testability
Instance Method Summary collapse
-
#initialize(whitelisted_clients) ⇒ Authenticator
constructor
A new instance of Authenticator.
- #valid?(service_name, client_key) ⇒ Boolean
Constructor Details
#initialize(whitelisted_clients) ⇒ Authenticator
Returns a new instance of Authenticator.
54 55 56 |
# File 'lib/roo_on_rails/concerns/require_api_key.rb', line 54 def initialize(whitelisted_clients) @whitelisted_clients = whitelisted_clients.map(&:to_s) end |
Instance Method Details
#valid?(service_name, client_key) ⇒ Boolean
58 59 60 61 62 |
# File 'lib/roo_on_rails/concerns/require_api_key.rb', line 58 def valid?(service_name, client_key) return false unless whitelisted?(service_name) ClientApiKeys.instance.valid?(service_name, client_key) end |