Class: SoarAuthenticationToken::RemoteTokenGenerator
- Inherits:
-
Object
- Object
- SoarAuthenticationToken::RemoteTokenGenerator
- Defined in:
- lib/soar_authentication_token/providers/remote_token_generator.rb
Instance Method Summary collapse
- #generate(authenticated_identifier:, flow_identifier: nil) ⇒ Object
-
#initialize(configuration) ⇒ RemoteTokenGenerator
constructor
A new instance of RemoteTokenGenerator.
- #inject_store_provider(store_provider) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ RemoteTokenGenerator
Returns a new instance of RemoteTokenGenerator.
6 7 8 9 10 |
# File 'lib/soar_authentication_token/providers/remote_token_generator.rb', line 6 def initialize(configuration) @configuration = configuration set_configuration_defaults validate_configuration end |
Instance Method Details
#generate(authenticated_identifier:, flow_identifier: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/soar_authentication_token/providers/remote_token_generator.rb', line 16 def generate(authenticated_identifier:, flow_identifier: nil) attempt = 0 begin Timeout::timeout(@configuration['timeout']) do client = authenticated_client(authenticated_identifier,flow_identifier) validate_and_extract_token_from_response(client.request) end rescue Timeout::Error attempt += 1 retry if attempt < @configuration['attempts'] raise end end |
#inject_store_provider(store_provider) ⇒ Object
12 13 14 |
# File 'lib/soar_authentication_token/providers/remote_token_generator.rb', line 12 def inject_store_provider(store_provider) #ignore the store provider since this generator does not use a store end |