Class: Google::Auth::IDTokens::StaticKeySource

Inherits:
Object
  • Object
show all
Defined in:
lib/googleauth/id_tokens/key_sources.rb

Overview

A key source that contains a static set of keys.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(keys) ⇒ StaticKeySource

Create a static key source with the given keys.

Parameters:

  • keys (Array<KeyInfo>)

    The keys



179
180
181
# File 'lib/googleauth/id_tokens/key_sources.rb', line 179

def initialize keys
  @current_keys = Array(keys)
end

Instance Attribute Details

#current_keysArray<KeyInfo> (readonly) Also known as: refresh_keys

Return the current keys. Does not perform any refresh.

Returns:



188
189
190
# File 'lib/googleauth/id_tokens/key_sources.rb', line 188

def current_keys
  @current_keys
end

Class Method Details

.from_jwk(jwk) ⇒ StaticKeySource

Create a static key source containing a single key parsed from a single JWK, which may be given as either a hash or an unparsed JSON string.

Parameters:

  • jwk (Hash, String)

    The JWK specification.

Returns:



200
201
202
# File 'lib/googleauth/id_tokens/key_sources.rb', line 200

def from_jwk jwk
  new KeyInfo.from_jwk jwk
end

.from_jwk_set(jwk_set) ⇒ StaticKeySource

Create a static key source containing multiple keys parsed from a JWK Set, which may be given as either a hash or an unparsed JSON string.

Parameters:

  • jwk_set (Hash, String)

    The JWK Set specification.

Returns:



212
213
214
# File 'lib/googleauth/id_tokens/key_sources.rb', line 212

def from_jwk_set jwk_set
  new KeyInfo.from_jwk_set jwk_set
end