Class: SoarAuthenticationToken::TokenGenerator

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

Constant Summary collapse

DEFAULT_CONFIGURATION =
{
  'mode' => 'remote',
  'url' => ''
}

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ TokenGenerator

Returns a new instance of TokenGenerator.



12
13
14
15
16
# File 'lib/soar_authentication_token/token_generator.rb', line 12

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:) ⇒ Object



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

def generate(authenticated_identifier:)
  encode(payload(authenticated_identifier))
end