Class: SoarAuthenticationToken::TokenValidator
- Inherits:
-
Object
- Object
- SoarAuthenticationToken::TokenValidator
- Defined in:
- lib/soar_authentication_token/token_validator.rb
Constant Summary collapse
- DEFAULT_CONFIGURATION =
{ 'mode' => 'local', 'expiry' => 604800, #a day in seconds 'public_key' => '', 'url' => '' }
Instance Method Summary collapse
-
#initialize(configuration) ⇒ TokenValidator
constructor
A new instance of TokenValidator.
- #validate(authentication_token) ⇒ Object
Constructor Details
#initialize(configuration) ⇒ TokenValidator
Returns a new instance of TokenValidator.
13 14 15 16 17 18 |
# File 'lib/soar_authentication_token/token_validator.rb', line 13 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
#validate(authentication_token) ⇒ Object
20 21 22 23 |
# File 'lib/soar_authentication_token/token_validator.rb', line 20 def validate(authentication_token) return validate_locally(authentication_token) if 'local' == @configuration['mode'] return validate_remotely(authentication_token) end |