Class: Foobara::CommandConnector::Authenticator
- Inherits:
-
Value::Transformer
- Object
- Value::Processor
- Value::Transformer
- Foobara::CommandConnector::Authenticator
- Defined in:
- foobara-0.0.130/projects/command_connectors/src/authenticator.rb
Overview
TODO: should switch to a processor and give errors if the authenticator header is malformed
Direct Known Subclasses
AuthHttp::ApiKeyAuthenticator, AuthHttp::BearerAuthenticator, AuthenticatorSelector
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Attributes inherited from Value::Processor
#created_in_namespace, #declaration_data, #parent_declaration_data
Instance Method Summary collapse
- #authenticate(request) ⇒ Object
- #explanation ⇒ Object
-
#initialize(symbol: nil, explanation: nil, &block) ⇒ Authenticator
constructor
A new instance of Authenticator.
- #relevant_entity_classes(_request) ⇒ Object
- #symbol ⇒ Object
- #to_proc ⇒ Object
- #transform(request) ⇒ Object
Methods inherited from Value::Transformer
create, error_classes, foobara_manifest, #process_value, subclass
Methods inherited from Value::Processor
#always_applicable?, #applicable?, #attribute_name, #build_error, default_declaration_data, #dup_processor, error_class, error_classes, #error_context, #error_message, #error_path, foobara_manifest, #foobara_manifest, #inspect, instance, #method_missing, #name, new_with_agnostic_args, #possible_errors, #priority, #process_outcome, #process_outcome!, #process_value, #process_value!, processor_name, requires_declaration_data?, requires_parent_declaration_data?, #respond_to_missing?, #runner, symbol
Methods included from IsManifestable
#foobara_domain, #foobara_manifest, #foobara_organization, #scoped_clear_caches
Methods included from Foobara::Concern
foobara_class_methods_module_for, foobara_concern?, included
Constructor Details
#initialize(symbol: nil, explanation: nil, &block) ⇒ Authenticator
Returns a new instance of Authenticator.
7 8 9 10 11 12 13 14 |
# File 'foobara-0.0.130/projects/command_connectors/src/authenticator.rb', line 7 def initialize(symbol: nil, explanation: nil, &block) symbol ||= Util.non_full_name_underscore(self.class).to_sym explanation ||= symbol super(symbol:, explanation:) @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::Value::Processor
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
5 6 7 |
# File 'foobara-0.0.130/projects/command_connectors/src/authenticator.rb', line 5 def block @block end |
Instance Method Details
#authenticate(request) ⇒ Object
32 33 34 35 36 |
# File 'foobara-0.0.130/projects/command_connectors/src/authenticator.rb', line 32 def authenticate(request) if applicable?(request) process_value!(request) end end |
#explanation ⇒ Object
24 25 26 |
# File 'foobara-0.0.130/projects/command_connectors/src/authenticator.rb', line 24 def explanation declaration_data[:explanation] end |
#relevant_entity_classes(_request) ⇒ Object
16 17 18 |
# File 'foobara-0.0.130/projects/command_connectors/src/authenticator.rb', line 16 def relevant_entity_classes(_request) nil end |
#symbol ⇒ Object
20 21 22 |
# File 'foobara-0.0.130/projects/command_connectors/src/authenticator.rb', line 20 def symbol declaration_data[:symbol] end |
#to_proc ⇒ Object
38 39 40 |
# File 'foobara-0.0.130/projects/command_connectors/src/authenticator.rb', line 38 def to_proc block end |
#transform(request) ⇒ Object
28 29 30 |
# File 'foobara-0.0.130/projects/command_connectors/src/authenticator.rb', line 28 def transform(request) request.instance_exec(&to_proc) end |