Class: SoarAuthenticationToken::TokenValidator
- Inherits:
-
Object
- Object
- SoarAuthenticationToken::TokenValidator
- Defined in:
- lib/soar_authentication_token/token_validator.rb
Constant Summary collapse
- DEFAULT_CONFIGURATION =
{ 'expiry' => 604800 #a days worth of seconds }
Instance Method Summary collapse
-
#initialize(configuration) ⇒ TokenValidator
constructor
A new instance of TokenValidator.
- #inject_store_provider(store_provider) ⇒ Object
- #validate(authentication_token:, flow_identifier: nil) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ TokenValidator
11 12 13 14 15 16 |
# File 'lib/soar_authentication_token/token_validator.rb', line 11 def initialize(configuration) @configuration = merge_with_default_configuration(configuration) validate_configuration @public_key = OpenSSL::PKey::EC.new(@configuration['public_key']) @public_key.private_key = nil end |
Instance Method Details
#inject_store_provider(store_provider) ⇒ Object
18 19 20 |
# File 'lib/soar_authentication_token/token_validator.rb', line 18 def inject_store_provider(store_provider) @store_provider = store_provider end |
#validate(authentication_token:, flow_identifier: nil) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/soar_authentication_token/token_validator.rb', line 22 def validate(authentication_token:,flow_identifier: nil) return validate_locally(authentication_token) if 'local' == @configuration['mode'] return validate_statically(authentication_token) if 'static' == @configuration['mode'] return validate_remotely(authentication_token,flow_identifier) if 'remote' == @configuration['mode'] raise 'invalid validation mode configured' end |