Module: Setsuzoku::AuthStrategy
- Extended by:
- Forwardable, T::Helpers, T::Sig
- Includes:
- HasConfigContext
- Included in:
- Service::WebService::AuthStrategy
- Defined in:
- lib/setsuzoku/auth_strategy.rb
Overview
The API Authentication Interface definition. Any AuthStrategy that implements this interface must implement all abstract methods defined by AuthStrategy.
Defines all necessary methods for handling authentication for any authentication strategy.
Instance Attribute Summary collapse
-
#credential ⇒ Credential
The getter method for a credential should retrieve dynamically if it’s a proc.
-
#service ⇒ Object
Returns the value of attribute service.
Attributes included from HasConfigContext
Instance Method Summary collapse
- #auth_credential_valid? ⇒ Boolean
-
#initialize(service:, **args) ⇒ AuthStrategy
Initialize the auth_strategy and provide reference to service.
- #new_credential!(**args) ⇒ Object
-
#set_credential!(credential) ⇒ void
Assign the credential to the auth_strategy.
Methods included from HasConfigContext
Instance Attribute Details
#credential ⇒ Credential
The getter method for a credential should retrieve dynamically if it’s a proc. We cannot assign this at initialize time, as it may not yet exist on the instance.
54 55 56 |
# File 'lib/setsuzoku/auth_strategy.rb', line 54 def credential @credential end |
#service ⇒ Object
Returns the value of attribute service.
18 19 20 |
# File 'lib/setsuzoku/auth_strategy.rb', line 18 def service @service end |
Instance Method Details
#auth_credential_valid? ⇒ Boolean
77 |
# File 'lib/setsuzoku/auth_strategy.rb', line 77 def auth_credential_valid?; end |
#initialize(service:, **args) ⇒ AuthStrategy
Initialize the auth_strategy and provide reference to service.
43 44 45 46 47 48 |
# File 'lib/setsuzoku/auth_strategy.rb', line 43 def initialize(service:, **args) self.service = service self.set_credential!(self.class.credential_class.stub_credential) unless self.plugin.registered_instance self.config_context = args self end |
#new_credential!(**args) ⇒ Object
84 |
# File 'lib/setsuzoku/auth_strategy.rb', line 84 def new_credential!(**args); end |
#set_credential!(credential) ⇒ void
This method returns an undefined value.
Assign the credential to the auth_strategy.
65 66 67 68 69 70 |
# File 'lib/setsuzoku/auth_strategy.rb', line 65 def set_credential!(credential) if credential self.credential = credential credential.auth_strategy = self end end |