Class: Setsuzoku::Service::WebService::AuthStrategies::OAuthStrategy
- Inherits:
-
Setsuzoku::Service::WebService::AuthStrategy
- Object
- Setsuzoku::Service::WebService::AuthStrategy
- Setsuzoku::Service::WebService::AuthStrategies::OAuthStrategy
- Extended by:
- T::Helpers, T::Sig
- Defined in:
- lib/setsuzoku/service/web_service/auth_strategies/o_auth_strategy.rb
Overview
The API OAuth Authentication Interface definition. Any Plugin that implements this must implement all methods required for OAuth.
Defines all necessary methods for handling authentication for any authentication strategy.
Instance Attribute Summary
Attributes included from AuthStrategy
Class Method Summary collapse
Instance Method Summary collapse
Methods included from AuthStrategy
Class Method Details
.credential_class ⇒ Object
20 21 22 |
# File 'lib/setsuzoku/service/web_service/auth_strategies/o_auth_strategy.rb', line 20 def self.credential_class Setsuzoku::Service::WebService::Credentials::OAuthCredential end |
.required_instance_methods ⇒ Object
16 17 18 |
# File 'lib/setsuzoku/service/web_service/auth_strategies/o_auth_strategy.rb', line 16 def self.required_instance_methods [] end |
.token_valid_for ⇒ Object
24 25 26 |
# File 'lib/setsuzoku/service/web_service/auth_strategies/o_auth_strategy.rb', line 24 def self.token_valid_for 24.hours end |
Instance Method Details
#auth_credential_valid? ⇒ Boolean
60 61 62 63 64 65 66 67 |
# File 'lib/setsuzoku/service/web_service/auth_strategies/o_auth_strategy.rb', line 60 def auth_credential_valid? if token_is_invalid? refresh_expired_token! !token_is_invalid? else true end end |
#auth_headers ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/setsuzoku/service/web_service/auth_strategies/o_auth_strategy.rb', line 32 def auth_headers { headers: { 'Authorization': "Bearer #{self.credential.token}" } } end |
#new_credential!(**args) ⇒ Object
47 48 49 50 51 |
# File 'lib/setsuzoku/service/web_service/auth_strategies/o_auth_strategy.rb', line 47 def new_credential!(**args) # get a token object based on the code retrieved from login get_token!(params(grant_type: 'authorization_code', code: args[:code]), :new_token) end |