Sha256: a6890ce39255f86e6b45e412b50921b3f85bd0d86bad93a0d88214e5d12219d9

Contents?: true

Size: 525 Bytes

Versions: 4

Compression:

Stored size: 525 Bytes

Contents

# frozen_string_literal: true

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

      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

      private

      attr_reader :issuers
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
jwt-2.9.3 lib/jwt/claims/issuer.rb
jwt-2.9.2 lib/jwt/claims/issuer.rb
jwt-2.9.1 lib/jwt/claims/issuer.rb
jwt-2.9.0 lib/jwt/claims/issuer.rb