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



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

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:



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

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:



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

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:



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

def from_jwk_set jwk_set
  new KeyInfo.from_jwk_set jwk_set
end