Class: Aws::SSOTokenProvider

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

Constant Summary collapse

SSO_REQUIRED_OPTS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

[:sso_region, :sso_session].freeze
SSO_LOGIN_GUIDANCE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

'The SSO session associated with this profile has '\
'expired or is otherwise invalid. To refresh this SSO session run '\
'aws sso login with the corresponding profile.'.freeze

Instance Attribute Summary collapse

Attributes included from TokenProvider

#token

Instance Method Summary collapse

Methods included from RefreshingToken

#expiration, #refresh!, #token

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 '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 'lib/aws-sdk-core/sso_token_provider.rb', line 49

def client
  @client
end