Class: SoarAuthenticationToken::TokenGenerator
- Inherits:
-
Object
- Object
- SoarAuthenticationToken::TokenGenerator
- 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
- #generate(authenticated_identifier:, flow_identifier: nil) ⇒ Object
-
#initialize(configuration) ⇒ TokenGenerator
constructor
A new instance of TokenGenerator.
- #inject_store_provider(store_provider) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ TokenGenerator
16 17 18 19 20 |
# File 'lib/soar_authentication_token/token_generator.rb', line 16 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
26 27 28 29 |
# File 'lib/soar_authentication_token/token_generator.rb', line 26 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
22 23 24 |
# File 'lib/soar_authentication_token/token_generator.rb', line 22 def inject_store_provider(store_provider) @store_provider = store_provider end |