Class: SoarAuthenticationToken::TokenValidator

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

Constant Summary collapse

DEFAULT_CONFIGURATION =
{
  'expiry'        => 604800 #a days worth of seconds
}

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ TokenValidator

Returns a new instance of TokenValidator.



10
11
12
13
14
15
# File 'lib/soar_authentication_token/token_validator.rb', line 10

def initialize(configuration)
  @configuration = merge_with_default_configuration(configuration)
  validate_configuration
  @public_key = OpenSSL::PKey::EC.new(@configuration['public_key'])
  @public_key.private_key = nil
end

Instance Method Details

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



17
18
19
20
# File 'lib/soar_authentication_token/token_validator.rb', line 17

def validate(authentication_token:,flow_identifier: nil)
  return validate_locally(authentication_token) if 'local' == @configuration['mode']
  return validate_remotely(authentication_token,flow_identifier)
end