Class: SoarAuthenticationToken::JwtTokenGenerator
- Inherits:
-
Object
- Object
- SoarAuthenticationToken::JwtTokenGenerator
- Defined in:
- lib/soar_authentication_token/providers/jwt_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) ⇒ JwtTokenGenerator
constructor
A new instance of JwtTokenGenerator.
- #inject_store_provider(store_provider) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ JwtTokenGenerator
Returns a new instance of JwtTokenGenerator.
14 15 16 17 18 |
# File 'lib/soar_authentication_token/providers/jwt_token_generator.rb', line 14 def initialize(configuration) @configuration = merge_with_default_configuration(configuration) validate_local_mode_configuration @private_key = OpenSSL::PKey::EC.new(@configuration['private_key']) end |
Instance Method Details
#generate(authenticated_identifier:, flow_identifier: nil) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/soar_authentication_token/providers/jwt_token_generator.rb', line 24 def generate(authenticated_identifier:, flow_identifier: nil) = (authenticated_identifier) token = encode() add_token_to_store(,flow_identifier) [token, ] end |
#inject_store_provider(store_provider) ⇒ Object
20 21 22 |
# File 'lib/soar_authentication_token/providers/jwt_token_generator.rb', line 20 def inject_store_provider(store_provider) @store_provider = store_provider end |