Module: JwtClaims::Claim::Exp

Defined in:
lib/jwt_claims/claim/exp.rb

Overview

Expiration time

Class Method Summary collapse

Class Method Details

.reject?(numeric_date, options = {}) ⇒ true, false

Returns whether to reject the claim.

Parameters:

  • numeric_date (Numeric)

    the number of seconds from 1970-01-01T00:00:00Z UTC until the specified UTC date/time; non-integer values may be used

  • options (Hash) (defaults to: {})

    (key :leeway_seconds, maximum of 180), time to allow for clock skew

Returns:

  • (true, false)

    whether to reject the claim



13
14
15
16
17
# File 'lib/jwt_claims/claim/exp.rb', line 13

def reject?(numeric_date, options = {})
  return true unless numeric_date.is_a?(Numeric)
  seconds = Util.leeway_seconds(options.fetch(:leeway_seconds, 0))
  numeric_date <= Time.now.to_i - seconds
end