Sha256: 7b52039a1fac9d30bc4b4320787fcd50241efa95aebe6377e1b3c360e034d15b
Contents?: true
Size: 1.59 KB
Versions: 3
Compression:
Stored size: 1.59 KB
Contents
require_relative "includes" require_relative "../../types" class AwsAssumeRole::Credentials::Providers::SharedKeyringCredentials < ::Aws::SharedCredentials include AwsAssumeRole::Logging attr_reader :region, :role_arn def initialize(options = {}) logger.debug "SharedKeyringCredentials initiated with #{options}" @path = options[:path] @path ||= AwsAssumeRole.shared_config.credentials_path @profile_name = options[:profile_name] ||= options[:profile] @profile_name ||= ENV["AWS_PROFILE"] @profile_name ||= AwsAssumeRole.shared_config.profile_name logger.debug "SharedKeyringCredentials resolved profile name #{@profile_name}" config = determine_config(@path, @profile_name) @role_arn = config.profile_hash(@profile_name) @region = config.profile_region(@profile_name) @role_arn = config.profile_role(@profile_name) attempted_credential = config.credentials(options) return unless attempted_credential && attempted_credential.set? @credentials = attempted_credential end private def determine_config(path, profile_name) if path && path == AwsAssumeRole.shared_config.credentials_path logger.debug "SharedKeyringCredentials found shared credential path" AwsAssumeRole.shared_config else logger.debug "SharedKeyringCredentials found custom credential path" AwsAssumeRole::Store::SharedConfigWithKeyring.new( credentials_path: path, profile_name: profile_name, ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems