Module: JWT::Claims::Verifier

Defined in:
lib/jwt/claims/verifier.rb

Class Method Summary collapse

Class Method Details

.errors(context, *options) ⇒ Object



32
33
34
35
36
37
38
39
40
# File 'lib/jwt/claims/verifier.rb', line 32

def errors(context, *options)
  errors = []
  iterate_verifiers(*options) do |verifier, verifier_options|
    verify_one!(context, verifier, verifier_options)
  rescue ::JWT::DecodeError => e
    errors << Error.new(message: e.message)
  end
  errors
end

.iterate_verifiers(*options) ⇒ Object



43
44
45
46
47
48
49
50
51
# File 'lib/jwt/claims/verifier.rb', line 43

def iterate_verifiers(*options)
  options.each do |element|
    if element.is_a?(Hash)
      element.each_key { |key| yield(key, element) }
    else
      yield(element, {})
    end
  end
end

.verify!(context, *options) ⇒ Object



24
25
26
27
28
29
# File 'lib/jwt/claims/verifier.rb', line 24

def verify!(context, *options)
  iterate_verifiers(*options) do |verifier, verifier_options|
    verify_one!(context, verifier, verifier_options)
  end
  nil
end