Class: Idsimple::Rack::AccessTokenValidator
- Inherits:
-
Object
- Object
- Idsimple::Rack::AccessTokenValidator
- Defined in:
- lib/idsimple/rack/access_token_validator.rb
Class Method Summary collapse
- .validate_unused_token_custom_claims(decoded_token, req) ⇒ Object
- .validate_used_token_custom_claims(decoded_token, req) ⇒ Object
Class Method Details
.validate_unused_token_custom_claims(decoded_token, req) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/idsimple/rack/access_token_validator.rb', line 17 def self.validate_unused_token_custom_claims(decoded_token, req) token_payload = decoded_token[0] use_by = token_payload["idsimple.use_by"] used_at = token_payload["idsimple.used_at"] result = AccessTokenValidationResult.new if use_by && Time.now.to_i > use_by result.add_error("Token must be used prior to before claim") end result.add_error("Token already used") if used_at result end |
.validate_used_token_custom_claims(decoded_token, req) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/idsimple/rack/access_token_validator.rb', line 6 def self.validate_used_token_custom_claims(decoded_token, req) token_payload = decoded_token[0] used_at = token_payload["idsimple.used_at"] result = AccessTokenValidationResult.new result.add_error("Missing used_at timestamp") if !used_at result.add_error("Invalid used_at timestamp") if used_at && used_at > Time.now.to_i result end |