Class: Setsuzoku::Service::WebService::AuthStrategies::CustomAuthStrategy

Inherits:
Setsuzoku::Service::WebService::AuthStrategy show all
Extended by:
T::Helpers, T::Sig
Includes:
StrategyCanUseTokens
Defined in:
lib/setsuzoku/service/web_service/auth_strategies/custom_auth_strategy.rb

Overview

The API Custom Authentication Interface definition. Any Plugin that implements this must implement all methods required for Custom auth.

Defines all necessary methods for the custom auth strategy.

Instance Attribute Summary

Attributes included from AuthStrategy

#credential, #service

Attributes included from HasConfigContext

#config_context

Class Method Summary collapse

Instance Method Summary collapse

Methods included from StrategyCanUseTokens

#auth_credential_valid?

Methods included from AuthStrategy

#auth_credential_valid?, #initialize, #new_credential!, #set_credential!

Methods included from HasConfigContext

#get_from_context

Class Method Details

.credential_classObject



22
23
24
# File 'lib/setsuzoku/service/web_service/auth_strategies/custom_auth_strategy.rb', line 22

def self.credential_class
  Setsuzoku::Service::WebService::Credentials::CustomAuthCredential
end

.required_instance_methodsObject



18
19
20
# File 'lib/setsuzoku/service/web_service/auth_strategies/custom_auth_strategy.rb', line 18

def self.required_instance_methods
  []
end

Instance Method Details

#auth_headersHash

Any custom auth headers required to perform authenticated requests.

Returns:

  • (Hash)

    the auth headers.



33
34
35
# File 'lib/setsuzoku/service/web_service/auth_strategies/custom_auth_strategy.rb', line 33

def auth_headers
  self.credential.auth_headers
end

#new_token!void

This method returns an undefined value.

Construct the custom token_request_body and request a token.



44
45
46
47
48
# File 'lib/setsuzoku/service/web_service/auth_strategies/custom_auth_strategy.rb', line 44

def new_token!
  action = :new_token
  body = self.credential.auth_actions[action][:body]
  get_token!(body, action)
end

#refresh_expired_token!void

This method returns an undefined value.

Construct the custom token_request_body and request a token.



57
58
59
60
61
# File 'lib/setsuzoku/service/web_service/auth_strategies/custom_auth_strategy.rb', line 57

def refresh_expired_token!
  action = :refresh_token
  body = self.credential.auth_actions[action][:body]
  get_token!(body, :refresh_token)
end