Class: SoarAuthenticationToken::TokenGenerator

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

Constant Summary collapse

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

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ TokenGenerator

Returns a new instance of TokenGenerator.



15
16
17
18
19
# File 'lib/soar_authentication_token/token_generator.rb', line 15

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

Instance Method Details

#generate(authenticated_identifier:, flow_identifier: nil) ⇒ Object



25
26
27
28
# File 'lib/soar_authentication_token/token_generator.rb', line 25

def generate(authenticated_identifier:, flow_identifier: nil)
  return generate_locally(authenticated_identifier) if 'local' == @configuration['mode']
  return generate_remotely(authenticated_identifier,flow_identifier)
end

#inject_store_provider(store_provider) ⇒ Object



21
22
23
# File 'lib/soar_authentication_token/token_generator.rb', line 21

def inject_store_provider(store_provider)
  @store_provider = store_provider
end