class JWT::Claims::NotBefore

Attributes

leeway[R]

Public Class Methods

new(leeway:) click to toggle source
# File lib/jwt/claims/not_before.rb, line 6
def initialize(leeway:)
  @leeway = leeway || 0
end

Public Instance Methods

verify!(context:, **_args) click to toggle source
# File lib/jwt/claims/not_before.rb, line 10
def verify!(context:, **_args)
  return unless context.payload.is_a?(Hash)
  return unless context.payload.key?('nbf')

  raise JWT::ImmatureSignature, 'Signature nbf has not been reached' if context.payload['nbf'].to_i > (Time.now.to_i + leeway)
end