Class: SoarAuthenticationToken::TokenGenerator

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

Constant Summary collapse

DEFAULT_CONFIGURATION =
{
}

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ TokenGenerator

Returns a new instance of TokenGenerator.



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

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



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

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