class Google::Auth::IDTokens::X509CertHttpKeySource

A key source that downloads X509 certificates. Used by the legacy OAuth V1 public certs endpoint.

Public Class Methods

new(uri, algorithm: "RS256", retry_interval: nil) click to toggle source

Create a key source that downloads X509 certificates.

@param uri [String,URI] The URI from which to download keys. @param algorithm [String] The algorithm to use for signature

verification. Defaults to "`RS256`".

@param retry_interval [Integer,nil] Override the retry interval in

seconds. This is the minimum time between retries of failed key
downloads.
# File lib/googleauth/id_tokens/key_sources.rb, line 317
def initialize uri, algorithm: "RS256", retry_interval: nil
  super uri, retry_interval: retry_interval
  @algorithm = algorithm
end

Protected Instance Methods

interpret_json(data) click to toggle source
# File lib/googleauth/id_tokens/key_sources.rb, line 324
def interpret_json data
  data.map do |id, cert_str|
    key = OpenSSL::X509::Certificate.new(cert_str).public_key
    KeyInfo.new id: id, key: key, algorithm: @algorithm
  end
rescue OpenSSL::X509::CertificateError
  raise KeySourceError, "Unable to parse X509 certificates"
end