Class: JWT::Claims::Issuer

Inherits:
Object
  • Object
show all
Defined in:
lib/jwt/claims/issuer.rb

Instance Method Summary collapse

Constructor Details

#initialize(issuers:) ⇒ Issuer

Returns a new instance of Issuer.



6
7
8
# File 'lib/jwt/claims/issuer.rb', line 6

def initialize(issuers:)
  @issuers = Array(issuers).map { |item| item.is_a?(Symbol) ? item.to_s : item }
end

Instance Method Details

#verify!(context:, **_args) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/jwt/claims/issuer.rb', line 10

def verify!(context:, **_args)
  case (iss = context.payload['iss'])
  when *issuers
    nil
  else
    raise JWT::InvalidIssuerError, "Invalid issuer. Expected #{issuers}, received #{iss || '<none>'}"
  end
end