Class: SoarAuthenticationToken::RemoteTokenValidator

Inherits:
Object
  • Object
show all
Defined in:
lib/soar_authentication_token/providers/remote_token_validator.rb

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ RemoteTokenValidator

Returns a new instance of RemoteTokenValidator.



5
6
7
8
9
# File 'lib/soar_authentication_token/providers/remote_token_validator.rb', line 5

def initialize(configuration)
  @configuration = configuration
  set_configuration_defaults
  validate_configuration
end

Instance Method Details

#inject_store_provider(store_provider) ⇒ Object



11
12
13
# File 'lib/soar_authentication_token/providers/remote_token_validator.rb', line 11

def inject_store_provider(store_provider)
  #ignore the store provider since this validator does not use a store
end

#validate(authentication_token:, request_information:, flow_identifier:) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/soar_authentication_token/providers/remote_token_validator.rb', line 15

def validate(authentication_token:, request_information:, flow_identifier:)
  attempt = 0
  begin
    Timeout::timeout(@configuration['timeout']) do
      response = send_request(authentication_token,request_information,flow_identifier)
      validate_and_extract_information_from_response(response)
    end
  rescue Timeout::Error
    attempt += 1
    retry if attempt < @configuration['attempts']
    raise
  end
end