Class: JWT::Claims::Issuer
- Inherits:
-
Object
- Object
- JWT::Claims::Issuer
- Defined in:
- lib/jwt/claims/issuer.rb
Overview
The Issuer class is responsible for validating the issuer claim (‘iss’) in a JWT token.
Instance Method Summary collapse
-
#initialize(issuers:) ⇒ Issuer
constructor
Initializes a new Issuer instance.
-
#verify!(context:, **_args) ⇒ nil
Verifies the issuer claim (‘iss’) in the JWT token.
Constructor Details
#initialize(issuers:) ⇒ Issuer
Initializes a new Issuer instance.
10 11 12 |
# File 'lib/jwt/claims/issuer.rb', line 10 def initialize(issuers:) @issuers = Array(issuers).map { |item| item.is_a?(Symbol) ? item.to_s : item } end |
Instance Method Details
#verify!(context:, **_args) ⇒ nil
Verifies the issuer claim (‘iss’) in the JWT token.
20 21 22 23 24 25 26 27 |
# File 'lib/jwt/claims/issuer.rb', line 20 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 |