Module: Setsuzoku::AuthStrategy
- Extended by:
- Forwardable, T::Helpers, T::Sig
- 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.
Instance Method Summary collapse
- #auth_credential_valid? ⇒ Boolean
-
#final ⇒ AuthStrategy
Initialize the auth_strategy and provide reference to service.
- #initialize(service:, **args) ⇒ Object
- #new_credential!(**args) ⇒ Object
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.
16 17 18 |
# File 'lib/setsuzoku/auth_strategy.rb', line 16 def service @service end |
Instance Method Details
#auth_credential_valid? ⇒ Boolean
63 |
# File 'lib/setsuzoku/auth_strategy.rb', line 63 def auth_credential_valid?; end |
#final ⇒ AuthStrategy
Initialize the auth_strategy and provide reference to service.
25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/setsuzoku/auth_strategy.rb', line 25 sig(:final) do params( service: T.any( Setsuzoku::Service::WebService::Service, T.untyped ), args: T.untyped ).returns(T.any( Setsuzoku::Service::WebService::AuthStrategies::BasicAuthStrategy, Setsuzoku::Service::WebService::AuthStrategies::OAuthStrategy, T.untyped )) end |
#initialize(service:, **args) ⇒ Object
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/setsuzoku/auth_strategy.rb', line 39 def initialize(service:, **args) self.service = service credential = args[:credential] self.credential = if self.plugin.registered_instance credential else self.class.credential_class.stub_credential end self end |
#new_credential!(**args) ⇒ Object
70 |
# File 'lib/setsuzoku/auth_strategy.rb', line 70 def new_credential!(**args); end |