Sha256: de3520b9ab78f3ee5a560a1407940f5bb5d759054f9717429f60d68cb33ae089

Contents?: true

Size: 421 Bytes

Versions: 8

Compression:

Stored size: 421 Bytes

Contents

module Keratin::AuthN
  class RemoteSignatureVerifier
    attr_reader :keychain

    def initialize(keychain)
      @keychain = keychain
    end

    def verify(jwt)
      jwt.verify!(key(jwt['iss'], jwt.kid))
    rescue JSON::JWT::VerificationFailed, JSON::JWT::UnexpectedAlgorithm
      false
    end

    private def key(issuer, kid)
      keychain.getset(kid){ Issuer.new(issuer).signing_key(kid) }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
keratin-authn-0.6.1 lib/keratin/authn/remote_signature_verifier.rb
keratin-authn-0.6.0 lib/keratin/authn/remote_signature_verifier.rb
keratin-authn-0.5.1 lib/keratin/authn/remote_signature_verifier.rb
keratin-authn-0.5.0 lib/keratin/authn/remote_signature_verifier.rb
keratin-authn-0.4.1 lib/keratin/authn/remote_signature_verifier.rb
keratin-authn-0.4.0 lib/keratin/authn/remote_signature_verifier.rb
keratin-authn-0.3.2 lib/keratin/authn/remote_signature_verifier.rb
keratin-authn-0.3.1 lib/keratin/authn/remote_signature_verifier.rb