Class: Aws::SSOTokenProvider

Inherits:
Object
  • Object
show all
Includes:
TokenProvider
Defined in:
gems/aws-sdk-core/lib/aws-sdk-core/sso_token_provider.rb

Instance Attribute Summary collapse

Attributes included from TokenProvider

#token

Instance Method Summary collapse

Methods included from TokenProvider

#set?

Constructor Details

#initialize(options = {}) ⇒ SSOTokenProvider

Returns a new instance of SSOTokenProvider.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :sso_region (required, String)

    The AWS region where the SSO directory for the given sso_start_url is hosted.

  • :sso_session (required, String)

    The SSO Session used to for fetching this token.

  • :client (SSOOIDC::Client)

    Optional SSOOIDC::Client. If not provided, a client will be constructed.

  • before_refresh (Callable)

    Proc called before credentials are refreshed. before_refresh is called with an instance of this object when AWS credentials are required and need to be refreshed.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'gems/aws-sdk-core/lib/aws-sdk-core/sso_token_provider.rb', line 30

def initialize(options = {})

  missing_keys = SSO_REQUIRED_OPTS.select { |k| options[k].nil? }
  unless missing_keys.empty?
    raise ArgumentError, "Missing required keys: #{missing_keys}"
  end

  @sso_session = options.delete(:sso_session)
  @sso_region = options.delete(:sso_region)

  options[:region] = @sso_region
  options[:credentials] = nil
  options[:token_provider] = nil
  @client = options[:client] || Aws::SSOOIDC::Client.new(options)

  super
end

Instance Attribute Details

#clientSSOOIDC::Client (readonly)

Returns:



49
50
51
# File 'gems/aws-sdk-core/lib/aws-sdk-core/sso_token_provider.rb', line 49

def client
  @client
end