class OpenToken::Token
Public Instance Methods
end_at()
click to toggle source
# File lib/opentoken/token.rb, line 24 def end_at payload_date('not-on-or-after') end
expired?()
click to toggle source
# File lib/opentoken/token.rb, line 18 def expired? !valid? end
start_at()
click to toggle source
# File lib/opentoken/token.rb, line 21 def start_at payload_date('not-before') end
valid?()
click to toggle source
verify that the current time is between the not-before and not-on-or-after values
# File lib/opentoken/token.rb, line 15 def valid? (start_at - CLOCK_SKEW_TOLERANCE).past? && (end_at + CLOCK_SKEW_TOLERANCE).future? end
valid_until()
click to toggle source
# File lib/opentoken/token.rb, line 27 def valid_until payload_date('renew-until') end
validate!()
click to toggle source
# File lib/opentoken/token.rb, line 11 def validate! raise OpenToken::TokenExpiredError.new("#{Time.now.utc} is not within token duration: #{self.start_at} - #{self.end_at}") if self.expired? end
Private Instance Methods
payload_date(key)
click to toggle source
# File lib/opentoken/token.rb, line 32 def payload_date(key) Time.iso8601(self[key]) end