aws-sdk-core 3.226.2 → 3.228.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ff2de592e80a44bf7dc7d79b6d10dfbda7fbe4b747b197ba62b448aa7740f829
4
- data.tar.gz: 23b3577fd71b333470307184eba75cc98ce0d5e632e969858d84d5b7c7bb35ae
3
+ metadata.gz: 74bec0d09ff2bedd45445747dde2ceda3fa8ade2ebee3d231d877e7052ded31c
4
+ data.tar.gz: 2f546bd093fd1e6d85cd524ab0f585e33518813d8acebbbf0fd9282cc9abcb49
5
5
  SHA512:
6
- metadata.gz: 878a8d0aedb4e05adbef96853e46a74c43725157ac1db162f6a897d3a14c9a52194ee3e7c1c56f2a0f78ae396f07fdec75227cf728715a29ce6b3c6f28111afb
7
- data.tar.gz: d86248a04930fbe1f67981e0798bfd78ca72ff4179b709511b055b0a1510043d323bce1bfa7c73f3698ba17d53fd0ac57cfabc48842499e6f34c49e26590cac0
6
+ metadata.gz: 404f3218a7f8f2c1bc8c1db1de2b526f203927352705c2bdd2ab900e282e1327d02f2c34342d16f6ca9b505f7c04483625b2fc8550913504f219a09c4f9bfe70
7
+ data.tar.gz: 1e0a4453fb5e31a6012167442766d3b114f245b04401f85db28495a9065ac488bb0b34324a6323a90b36c927bf7b8d106db6dee7332594b54683f2f5384c1347
data/CHANGELOG.md CHANGED
@@ -1,6 +1,31 @@
1
1
  Unreleased Changes
2
2
  ------------------
3
3
 
4
+ 3.228.0 (2025-07-31)
5
+ ------------------
6
+
7
+ * Feature - Add `bigdecimal` as a dependency. For systems that are not able to build native extension gems, prefer the locally installed `bigdecimal` with `bundle install --prefer-local`.
8
+
9
+ 3.227.0 (2025-07-21)
10
+ ------------------
11
+
12
+ * Feature - Updated Aws::STS::Client with the latest API changes.
13
+
14
+ * Feature - Updated Aws::SSOOIDC::Client with the latest API changes.
15
+
16
+ * Feature - Updated Aws::SSO::Client with the latest API changes.
17
+
18
+ * Feature - Support an auth scheme signing preference list using `ENV['AWS_AUTH_SCHEME_PREFERENCE']` or `auth_scheme_preference` in shared configuration.
19
+
20
+ * Feature - Support metric tracking for Bedrock Bearer tokens.
21
+
22
+ 3.226.3 (2025-07-17)
23
+ ------------------
24
+
25
+ * Issue - Skip `Aws::InstanceProfileCredentials` instantiation when `ENV['AWS_EC2_METADATA_DISABLED']` is set to `true` in the credential resolution chain.
26
+
27
+ * Issue - Refactor `InstanceProfileCredentials` to improve code clarity and documentation.
28
+
4
29
  3.226.2 (2025-07-01)
5
30
  ------------------
6
31
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.226.2
1
+ 3.228.0
@@ -191,7 +191,7 @@ module Aws
191
191
  if ENV['AWS_CONTAINER_CREDENTIALS_RELATIVE_URI'] ||
192
192
  ENV['AWS_CONTAINER_CREDENTIALS_FULL_URI']
193
193
  ECSCredentials.new(options)
194
- else
194
+ elsif !(ENV.fetch('AWS_EC2_METADATA_DISABLED', 'false').downcase == 'true')
195
195
  InstanceProfileCredentials.new(options.merge(profile: profile_name))
196
196
  end
197
197
  end
@@ -19,19 +19,28 @@ require 'aws-sigv4'
19
19
  module Aws
20
20
  # @api private
21
21
  module Endpoints
22
- SUPPORTED_AUTH_TRAITS = %w[
23
- aws.auth#sigv4
24
- aws.auth#sigv4a
25
- smithy.api#httpBearerAuth
26
- smithy.api#noAuth
27
- ].freeze
22
+ # Maps config auth scheme preferences to endpoint auth scheme names.
23
+ ENDPOINT_AUTH_PREFERENCE_MAP = {
24
+ 'sigv4' => %w[sigv4 sigv4-s3express],
25
+ 'sigv4a' => ['sigv4a'],
26
+ 'httpBearerAuth' => ['bearer'],
27
+ 'noAuth' => ['none']
28
+ }.freeze
29
+ SUPPORTED_ENDPOINT_AUTH = ENDPOINT_AUTH_PREFERENCE_MAP.values.flatten.freeze
30
+
31
+ # Maps configured auth scheme preferences to modeled auth traits.
32
+ MODELED_AUTH_PREFERENCE_MAP = {
33
+ 'sigv4' => 'aws.auth#sigv4',
34
+ 'sigv4a' => 'aws.auth#sigv4a',
35
+ 'httpBearerAuth' => 'smithy.api#httpBearerAuth',
36
+ 'noAuth' => 'smithy.api#noAuth'
37
+ }.freeze
38
+ SUPPORTED_MODELED_AUTH = MODELED_AUTH_PREFERENCE_MAP.values.freeze
28
39
 
29
40
  class << self
30
41
  def resolve_auth_scheme(context, endpoint)
31
42
  if endpoint && (auth_schemes = endpoint.properties['authSchemes'])
32
- auth_scheme = auth_schemes.find do |scheme|
33
- Aws::Plugins::Sign::SUPPORTED_AUTH_TYPES.include?(scheme['name'])
34
- end
43
+ auth_scheme = endpoint_auth_scheme_preference(auth_schemes, context.config.auth_scheme_preference)
35
44
  raise 'No supported auth scheme for this endpoint.' unless auth_scheme
36
45
 
37
46
  merge_signing_defaults(auth_scheme, context.config)
@@ -42,6 +51,16 @@ module Aws
42
51
 
43
52
  private
44
53
 
54
+ def endpoint_auth_scheme_preference(auth_schemes, preferred_auth)
55
+ ordered_auth = preferred_auth.each_with_object([]) do |pref, list|
56
+ next unless ENDPOINT_AUTH_PREFERENCE_MAP.key?(pref)
57
+
58
+ ENDPOINT_AUTH_PREFERENCE_MAP[pref].each { |name| list << { 'name' => name } }
59
+ end
60
+ ordered_auth += auth_schemes
61
+ ordered_auth.find { |auth| SUPPORTED_ENDPOINT_AUTH.include?(auth['name']) }
62
+ end
63
+
45
64
  def merge_signing_defaults(auth_scheme, config)
46
65
  if %w[sigv4 sigv4a sigv4-s3express].include?(auth_scheme['name'])
47
66
  auth_scheme['signingName'] ||= sigv4_name(config)
@@ -64,13 +83,12 @@ module Aws
64
83
  end
65
84
 
66
85
  def sigv4_name(config)
67
- config.api.metadata['signingName'] ||
68
- config.api.metadata['endpointPrefix']
86
+ config.api.metadata['signingName'] || config.api.metadata['endpointPrefix']
69
87
  end
70
88
 
71
89
  def default_auth_scheme(context)
72
- if (auth_list = default_api_auth(context))
73
- auth = auth_list.find { |a| SUPPORTED_AUTH_TRAITS.include?(a) }
90
+ if (modeled_auth = default_api_auth(context))
91
+ auth = modeled_auth_scheme_preference(modeled_auth, context.config.auth_scheme_preference)
74
92
  case auth
75
93
  when 'aws.auth#sigv4', 'aws.auth#sigv4a'
76
94
  auth_scheme = { 'name' => auth.split('#').last }
@@ -93,6 +111,12 @@ module Aws
93
111
  end
94
112
  end
95
113
 
114
+ def modeled_auth_scheme_preference(modeled_auth, preferred_auth)
115
+ ordered_auth = preferred_auth.map { |pref| MODELED_AUTH_PREFERENCE_MAP[pref] }.compact
116
+ ordered_auth += modeled_auth
117
+ ordered_auth.find { |auth| SUPPORTED_MODELED_AUTH.include?(auth) }
118
+ end
119
+
96
120
  def default_api_auth(context)
97
121
  context.config.api.operation(context.operation_name)['auth'] ||
98
122
  context.config.api.metadata['auth']
@@ -4,11 +4,23 @@ require 'time'
4
4
  require 'net/http'
5
5
 
6
6
  module Aws
7
- # An auto-refreshing credential provider that loads credentials from
8
- # EC2 instances.
7
+ # An auto-refreshing credential provider that loads credentials from EC2 instances.
9
8
  #
10
9
  # instance_credentials = Aws::InstanceProfileCredentials.new
11
10
  # ec2 = Aws::EC2::Client.new(credentials: instance_credentials)
11
+ #
12
+ # ## Retries
13
+ # When initialized from the default credential chain, this provider defaults to `0` retries.
14
+ # Breakdown of retries is as follows:
15
+ #
16
+ # * **Configurable retries** (defaults to `1`): these retries handle errors when communicating
17
+ # with the IMDS endpoint. There are two separate retry mechanisms within the provider:
18
+ # * Entire token fetch and credential retrieval process
19
+ # * Token fetching
20
+ # * **JSON parsing retries**: Fixed at 3 attempts to handle cases when IMDS returns malformed JSON
21
+ # responses. These retries are separate from configurable retries.
22
+ #
23
+ # @see https://docs.aws.amazon.com/sdkref/latest/guide/feature-imds-credentials.html IMDS Credential Provider
12
24
  class InstanceProfileCredentials
13
25
  include CredentialProvider
14
26
  include RefreshingCredentials
@@ -22,10 +34,8 @@ module Aws
22
34
  # @api private
23
35
  class TokenExpiredError < RuntimeError; end
24
36
 
25
- # These are the errors we trap when attempting to talk to the
26
- # instance metadata service. Any of these imply the service
27
- # is not present, no responding or some other non-recoverable
28
- # error.
37
+ # These are the errors we trap when attempting to talk to the instance metadata service.
38
+ # Any of these imply the service is not present, no responding or some other non-recoverable error.
29
39
  # @api private
30
40
  NETWORK_ERRORS = [
31
41
  Errno::EHOSTUNREACH,
@@ -46,100 +56,113 @@ module Aws
46
56
  METADATA_TOKEN_PATH = '/latest/api/token'.freeze
47
57
 
48
58
  # @param [Hash] options
49
- # @option options [Integer] :retries (1) Number of times to retry
50
- # when retrieving credentials.
51
- # @option options [String] :endpoint ('http://169.254.169.254') The IMDS
52
- # endpoint. This option has precedence over the :endpoint_mode.
53
- # @option options [String] :endpoint_mode ('IPv4') The endpoint mode for
54
- # the instance metadata service. This is either 'IPv4' ('169.254.169.254')
55
- # or 'IPv6' ('[fd00:ec2::254]').
56
- # @option options [Boolean] :disable_imds_v1 (false) Disable the use of the
57
- # legacy EC2 Metadata Service v1.
58
- # @option options [String] :ip_address ('169.254.169.254') Deprecated. Use
59
- # :endpoint instead. The IP address for the endpoint.
59
+ # @option options [Integer] :retries (1) Number of times to retry when retrieving credentials.
60
+ # @option options [String] :endpoint ('http://169.254.169.254') The IMDS endpoint. This option has precedence
61
+ # over the `:endpoint_mode`.
62
+ # @option options [String] :endpoint_mode ('IPv4') The endpoint mode for the instance metadata service. This is
63
+ # either 'IPv4' (`169.254.169.254`) or IPv6' (`[fd00:ec2::254]`).
64
+ # @option options [Boolean] :disable_imds_v1 (false) Disable the use of the legacy EC2 Metadata Service v1.
65
+ # @option options [String] :ip_address ('169.254.169.254') Deprecated. Use `:endpoint` instead.
66
+ # The IP address for the endpoint.
60
67
  # @option options [Integer] :port (80)
61
68
  # @option options [Float] :http_open_timeout (1)
62
69
  # @option options [Float] :http_read_timeout (1)
63
- # @option options [Numeric, Proc] :delay By default, failures are retried
64
- # with exponential back-off, i.e. `sleep(1.2 ** num_failures)`. You can
65
- # pass a number of seconds to sleep between failed attempts, or
66
- # a Proc that accepts the number of failures.
67
- # @option options [IO] :http_debug_output (nil) HTTP wire
68
- # traces are sent to this object. You can specify something
69
- # like $stdout.
70
- # @option options [Integer] :token_ttl Time-to-Live in seconds for EC2
71
- # Metadata Token used for fetching Metadata Profile Credentials, defaults
72
- # to 21600 seconds
73
- # @option options [Callable] before_refresh Proc called before
74
- # credentials are refreshed. `before_refresh` is called
75
- # with an instance of this object when
76
- # AWS credentials are required and need to be refreshed.
70
+ # @option options [Numeric, Proc] :delay By default, failures are retried with exponential back-off, i.e.
71
+ # `sleep(1.2 ** num_failures)`. You can pass a number of seconds to sleep between failed attempts, or a Proc
72
+ # that accepts the number of failures.
73
+ # @option options [IO] :http_debug_output (nil) HTTP wire traces are sent to this object.
74
+ # You can specify something like `$stdout`.
75
+ # @option options [Integer] :token_ttl Time-to-Live in seconds for EC2 Metadata Token used for fetching
76
+ # Metadata Profile Credentials, defaults to 21600 seconds.
77
+ # @option options [Callable] :before_refresh Proc called before credentials are refreshed. `before_refresh`
78
+ # is called with an instance of this object when AWS credentials are required and need to be refreshed.
77
79
  def initialize(options = {})
78
- @retries = options[:retries] || 1
79
- endpoint_mode = resolve_endpoint_mode(options)
80
- @endpoint = resolve_endpoint(options, endpoint_mode)
81
- @port = options[:port] || 80
80
+ @backoff = resolve_backoff(options[:backoff])
82
81
  @disable_imds_v1 = resolve_disable_v1(options)
83
- # Flag for if v2 flow fails, skip future attempts
84
- @imds_v1_fallback = false
82
+ @endpoint = resolve_endpoint(options)
85
83
  @http_open_timeout = options[:http_open_timeout] || 1
86
84
  @http_read_timeout = options[:http_read_timeout] || 1
87
85
  @http_debug_output = options[:http_debug_output]
88
- @backoff = backoff(options[:backoff])
86
+ @port = options[:port] || 80
87
+ @retries = options[:retries] || 1
89
88
  @token_ttl = options[:token_ttl] || 21_600
90
- @token = nil
91
- @no_refresh_until = nil
89
+
92
90
  @async_refresh = false
91
+ @imds_v1_fallback = false
92
+ @no_refresh_until = nil
93
+ @token = nil
93
94
  @metrics = ['CREDENTIALS_IMDS']
94
95
  super
95
96
  end
96
97
 
97
- # @return [Integer] Number of times to retry when retrieving credentials
98
- # from the instance metadata service. Defaults to 0 when resolving from
99
- # the default credential chain ({Aws::CredentialProviderChain}).
98
+ # @return [Boolean0
99
+ attr_reader :disable_imds_v1
100
+
101
+ # @return [Integer]
102
+ attr_reader :token_ttl
103
+
104
+ # @return [Integer]
100
105
  attr_reader :retries
101
106
 
107
+ # @return [Proc]
108
+ attr_reader :backoff
109
+
110
+ # @return [String]
111
+ attr_reader :endpoint
112
+
113
+ # @return [Integer]
114
+ attr_reader :port
115
+
116
+ # @return [Integer]
117
+ attr_reader :http_open_timeout
118
+
119
+ # @return [Integer]
120
+ attr_reader :http_read_timeout
121
+
122
+ # @return [IO, nil]
123
+ attr_reader :http_debug_output
124
+
102
125
  private
103
126
 
104
127
  def resolve_endpoint_mode(options)
105
- value = options[:endpoint_mode]
106
- value ||= ENV['AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE']
107
- value ||= Aws.shared_config.ec2_metadata_service_endpoint_mode(
108
- profile: options[:profile]
109
- )
110
- value || 'IPv4'
128
+ options[:endpoint_mode] ||
129
+ ENV['AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE'] ||
130
+ Aws.shared_config.ec2_metadata_service_endpoint_mode(profile: options[:profile]) ||
131
+ 'IPv4'
111
132
  end
112
133
 
113
- def resolve_endpoint(options, endpoint_mode)
114
- value = options[:endpoint] || options[:ip_address]
115
- value ||= ENV['AWS_EC2_METADATA_SERVICE_ENDPOINT']
116
- value ||= Aws.shared_config.ec2_metadata_service_endpoint(
117
- profile: options[:profile]
118
- )
134
+ def resolve_endpoint(options)
135
+ if (value = options[:ip_address])
136
+ warn('The `:ip_address` option is deprecated. Use `:endpoint` instead.')
137
+ return value
138
+ end
119
139
 
140
+ value =
141
+ options[:endpoint] ||
142
+ ENV['AWS_EC2_METADATA_SERVICE_ENDPOINT'] ||
143
+ Aws.shared_config.ec2_metadata_service_endpoint(profile: options[:profile]) ||
144
+ nil
120
145
  return value if value
121
146
 
147
+ endpoint_mode = resolve_endpoint_mode(options)
122
148
  case endpoint_mode.downcase
123
149
  when 'ipv4' then 'http://169.254.169.254'
124
150
  when 'ipv6' then 'http://[fd00:ec2::254]'
125
151
  else
126
- raise ArgumentError,
127
- ':endpoint_mode is not valid, expected IPv4 or IPv6, '\
128
- "got: #{endpoint_mode}"
152
+ raise ArgumentError, ":endpoint_mode is not valid, expected IPv4 or IPv6, got: #{endpoint_mode}"
129
153
  end
130
154
  end
131
155
 
132
156
  def resolve_disable_v1(options)
133
- value = options[:disable_imds_v1]
134
- value ||= ENV['AWS_EC2_METADATA_V1_DISABLED']
135
- value ||= Aws.shared_config.ec2_metadata_v1_disabled(
136
- profile: options[:profile]
137
- )
138
- value = value.to_s.downcase if value
139
- Aws::Util.str_2_bool(value) || false
157
+ value =
158
+ options[:disable_imds_v1] ||
159
+ ENV['AWS_EC2_METADATA_V1_DISABLED'] ||
160
+ Aws.shared_config.ec2_metadata_v1_disabled(profile: options[:profile]) ||
161
+ 'false'
162
+ Aws::Util.str_2_bool(value.to_s.downcase)
140
163
  end
141
164
 
142
- def backoff(backoff)
165
+ def resolve_backoff(backoff)
143
166
  case backoff
144
167
  when Proc then backoff
145
168
  when Numeric then ->(_) { sleep(backoff) }
@@ -153,98 +176,74 @@ module Aws
153
176
  return
154
177
  end
155
178
 
156
- # Retry loading credentials up to 3 times is the instance metadata
157
- # service is responding but is returning invalid JSON documents
158
- # in response to the GET profile credentials call.
159
- begin
160
- retry_errors([Aws::Json::ParseError], max_retries: 3) do
161
- c = Aws::Json.load(get_credentials.to_s)
162
- if empty_credentials?(@credentials)
163
- @credentials = Credentials.new(
164
- c['AccessKeyId'],
165
- c['SecretAccessKey'],
166
- c['Token']
167
- )
168
- @expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
169
- if @expiration && @expiration < Time.now
170
- @no_refresh_until = Time.now + refresh_offset
171
- warn_expired_credentials
172
- end
173
- else
174
- # credentials are already set, update them only if the new ones are not empty
175
- if !c['AccessKeyId'] || c['AccessKeyId'].empty?
176
- # error getting new credentials
177
- @no_refresh_until = Time.now + refresh_offset
178
- warn_expired_credentials
179
- else
180
- @credentials = Credentials.new(
181
- c['AccessKeyId'],
182
- c['SecretAccessKey'],
183
- c['Token']
184
- )
185
- @expiration = c['Expiration'] ? Time.iso8601(c['Expiration']) : nil
186
- if @expiration && @expiration < Time.now
187
- @no_refresh_until = Time.now + refresh_offset
188
- warn_expired_credentials
189
- end
190
- end
179
+ new_creds =
180
+ begin
181
+ # Retry loading credentials up to 3 times is the instance metadata
182
+ # service is responding but is returning invalid JSON documents
183
+ # in response to the GET profile credentials call.
184
+ retry_errors([Aws::Json::ParseError], max_retries: 3) do
185
+ Aws::Json.load(retrieve_credentials.to_s)
191
186
  end
187
+ rescue Aws::Json::ParseError
188
+ raise Aws::Errors::MetadataParserError
192
189
  end
193
- rescue Aws::Json::ParseError
194
- raise Aws::Errors::MetadataParserError
190
+
191
+ if @credentials&.set? && empty_credentials?(new_creds)
192
+ # credentials are already set, but there was an error getting new credentials
193
+ # so don't update the credentials and use stale ones (static stability)
194
+ @no_refresh_until = Time.now + rand(300..360)
195
+ warn_expired_credentials
196
+ else
197
+ # credentials are empty or successfully retrieved, update them
198
+ update_credentials(new_creds)
195
199
  end
196
200
  end
197
201
 
198
- def get_credentials
202
+ def retrieve_credentials
199
203
  # Retry loading credentials a configurable number of times if
200
204
  # the instance metadata service is not responding.
201
- if _metadata_disabled?
202
- '{}'
203
- else
204
- begin
205
- retry_errors(NETWORK_ERRORS, max_retries: @retries) do
206
- open_connection do |conn|
207
- # attempt to fetch token to start secure flow first
208
- # and rescue to failover
209
- fetch_token(conn) unless @imds_v1_fallback
210
- token = @token.value if token_set?
211
-
212
- # disable insecure flow if we couldn't get token
213
- # and imds v1 is disabled
214
- raise TokenRetrivalError if token.nil? && @disable_imds_v1
215
-
216
- _get_credentials(conn, token)
217
- end
205
+ begin
206
+ retry_errors(NETWORK_ERRORS, max_retries: @retries) do
207
+ open_connection do |conn|
208
+ # attempt to fetch token to start secure flow first
209
+ # and rescue to failover
210
+ fetch_token(conn) unless @imds_v1_fallback || (@token && !@token.expired?)
211
+
212
+ # disable insecure flow if we couldn't get token and imds v1 is disabled
213
+ raise TokenRetrivalError if @token.nil? && @disable_imds_v1
214
+
215
+ fetch_credentials(conn)
218
216
  end
219
- rescue => e
220
- warn("Error retrieving instance profile credentials: #{e}")
221
- '{}'
222
217
  end
218
+ rescue StandardError => e
219
+ warn("Error retrieving instance profile credentials: #{e}")
220
+ '{}'
223
221
  end
224
222
  end
225
223
 
224
+ def update_credentials(creds)
225
+ @credentials = Credentials.new(creds['AccessKeyId'], creds['SecretAccessKey'], creds['Token'])
226
+ @expiration = creds['Expiration'] ? Time.iso8601(creds['Expiration']) : nil
227
+ return unless @expiration && @expiration < Time.now
228
+
229
+ @no_refresh_until = Time.now + rand(300..360)
230
+ warn_expired_credentials
231
+ end
232
+
226
233
  def fetch_token(conn)
227
- retry_errors(NETWORK_ERRORS, max_retries: @retries) do
228
- unless token_set?
229
- created_time = Time.now
230
- token_value, ttl = http_put(
231
- conn, METADATA_TOKEN_PATH, @token_ttl
232
- )
233
- @token = Token.new(token_value, ttl, created_time) if token_value && ttl
234
- end
235
- end
234
+ created_time = Time.now
235
+ token_value, ttl = http_put(conn)
236
+ @token = Token.new(token_value, ttl, created_time) if token_value && ttl
236
237
  rescue *NETWORK_ERRORS
237
238
  # token attempt failed, reset token
238
239
  # fallback to non-token mode
239
- @token = nil
240
240
  @imds_v1_fallback = true
241
241
  end
242
242
 
243
- # token is optional - if nil, uses v1 (insecure) flow
244
- def _get_credentials(conn, token)
245
- metadata = http_get(conn, METADATA_PATH_BASE, token)
243
+ def fetch_credentials(conn)
244
+ metadata = http_get(conn, METADATA_PATH_BASE)
246
245
  profile_name = metadata.lines.first.strip
247
- http_get(conn, METADATA_PATH_BASE + profile_name, token)
246
+ http_get(conn, METADATA_PATH_BASE + profile_name)
248
247
  rescue TokenExpiredError
249
248
  # Token has expired, reset it
250
249
  # The next retry should fetch it
@@ -257,10 +256,6 @@ module Aws
257
256
  @token && !@token.expired?
258
257
  end
259
258
 
260
- def _metadata_disabled?
261
- ENV.fetch('AWS_EC2_METADATA_DISABLED', 'false').downcase == 'true'
262
- end
263
-
264
259
  def open_connection
265
260
  uri = URI.parse(@endpoint)
266
261
  http = Net::HTTP.new(uri.hostname || @endpoint, uri.port || @port)
@@ -272,9 +267,9 @@ module Aws
272
267
  end
273
268
 
274
269
  # GET request fetch profile and credentials
275
- def http_get(connection, path, token = nil)
270
+ def http_get(connection, path)
276
271
  headers = { 'User-Agent' => "aws-sdk-ruby3/#{CORE_GEM_VERSION}" }
277
- headers['x-aws-ec2-metadata-token'] = token if token
272
+ headers['x-aws-ec2-metadata-token'] = @token.value if @token
278
273
  response = connection.request(Net::HTTP::Get.new(path, headers))
279
274
 
280
275
  case response.code.to_i
@@ -288,12 +283,12 @@ module Aws
288
283
  end
289
284
 
290
285
  # PUT request fetch token with ttl
291
- def http_put(connection, path, ttl)
286
+ def http_put(connection)
292
287
  headers = {
293
288
  'User-Agent' => "aws-sdk-ruby3/#{CORE_GEM_VERSION}",
294
- 'x-aws-ec2-metadata-token-ttl-seconds' => ttl.to_s
289
+ 'x-aws-ec2-metadata-token-ttl-seconds' => @token_ttl.to_s
295
290
  }
296
- response = connection.request(Net::HTTP::Put.new(path, headers))
291
+ response = connection.request(Net::HTTP::Put.new(METADATA_TOKEN_PATH, headers))
297
292
  case response.code.to_i
298
293
  when 200
299
294
  [
@@ -322,18 +317,12 @@ module Aws
322
317
  end
323
318
 
324
319
  def warn_expired_credentials
325
- warn("Attempting credential expiration extension due to a credential "\
326
- "service availability issue. A refresh of these credentials "\
327
- "will be attempted again in 5 minutes.")
328
- end
329
-
330
- def empty_credentials?(creds)
331
- !creds || !creds.access_key_id || creds.access_key_id.empty?
320
+ warn('Attempting credential expiration extension due to a credential service availability issue. '\
321
+ 'A refresh of these credentials will be attempted again in 5 minutes.')
332
322
  end
333
323
 
334
- # Compute an offset for refresh with jitter
335
- def refresh_offset
336
- 300 + rand(0..60)
324
+ def empty_credentials?(creds_hash)
325
+ !creds_hash['AccessKeyId'] || creds_hash['AccessKeyId'].empty?
337
326
  end
338
327
 
339
328
  # @api private
@@ -17,61 +17,66 @@ module Aws
17
17
  option(:profile,
18
18
  doc_default: 'default',
19
19
  doc_type: String,
20
- docstring: <<-DOCS)
21
- Used when loading credentials from the shared credentials file
22
- at HOME/.aws/credentials. When not specified, 'default' is used.
20
+ docstring: <<~DOCS)
21
+ Used when loading credentials from the shared credentials file at `HOME/.aws/credentials`.
22
+ When not specified, 'default' is used.
23
23
  DOCS
24
24
 
25
25
  option(:credentials,
26
26
  required: true,
27
27
  doc_type: 'Aws::CredentialProvider',
28
28
  rbs_type: 'untyped',
29
- docstring: <<-DOCS
30
- Your AWS credentials. This can be an instance of any one of the
31
- following classes:
32
-
33
- * `Aws::Credentials` - Used for configuring static, non-refreshing
34
- credentials.
35
-
36
- * `Aws::SharedCredentials` - Used for loading static credentials from a
37
- shared file, such as `~/.aws/config`.
38
-
39
- * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
40
-
41
- * `Aws::AssumeRoleWebIdentityCredentials` - Used when you need to
42
- assume a role after providing credentials via the web.
43
-
44
- * `Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an
45
- access token generated from `aws login`.
46
-
47
- * `Aws::ProcessCredentials` - Used for loading credentials from a
48
- process that outputs to stdout.
49
-
50
- * `Aws::InstanceProfileCredentials` - Used for loading credentials
51
- from an EC2 IMDS on an EC2 instance.
52
-
53
- * `Aws::ECSCredentials` - Used for loading credentials from
54
- instances running in ECS.
55
-
56
- * `Aws::CognitoIdentityCredentials` - Used for loading credentials
57
- from the Cognito Identity service.
58
-
59
- When `:credentials` are not configured directly, the following
60
- locations will be searched for credentials:
61
-
62
- * `Aws.config[:credentials]`
63
- * The `:access_key_id`, `:secret_access_key`, `:session_token`, and
64
- `:account_id` options.
65
- * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'],
66
- ENV['AWS_SESSION_TOKEN'], and ENV['AWS_ACCOUNT_ID']
67
- * `~/.aws/credentials`
68
- * `~/.aws/config`
69
- * EC2/ECS IMDS instance profile - When used by default, the timeouts
70
- are very aggressive. Construct and pass an instance of
71
- `Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
72
- enable retries and extended timeouts. Instance profile credential
73
- fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
74
- to true.
29
+ docstring: <<~DOCS
30
+ Your AWS credentials used for authentication. This can be an instance of any one of the
31
+ following classes:
32
+
33
+ * `Aws::Credentials` - Used for configuring static, non-refreshing
34
+ credentials.
35
+
36
+ * `Aws::SharedCredentials` - Used for loading static credentials from a
37
+ shared file, such as `~/.aws/config`.
38
+
39
+ * `Aws::AssumeRoleCredentials` - Used when you need to assume a role.
40
+
41
+ * `Aws::AssumeRoleWebIdentityCredentials` - Used when you need to
42
+ assume a role after providing credentials via the web.
43
+
44
+ * `Aws::SSOCredentials` - Used for loading credentials from AWS SSO using an
45
+ access token generated from `aws login`.
46
+
47
+ * `Aws::ProcessCredentials` - Used for loading credentials from a
48
+ process that outputs to stdout.
49
+
50
+ * `Aws::InstanceProfileCredentials` - Used for loading credentials
51
+ from an EC2 IMDS on an EC2 instance.
52
+
53
+ * `Aws::ECSCredentials` - Used for loading credentials from
54
+ instances running in ECS.
55
+
56
+ * `Aws::CognitoIdentityCredentials` - Used for loading credentials
57
+ from the Cognito Identity service.
58
+
59
+ When `:credentials` are not configured directly, the following
60
+ locations will be searched for credentials:
61
+
62
+ * `Aws.config[:credentials]`
63
+
64
+ * The `:access_key_id`, `:secret_access_key`, `:session_token`, and
65
+ `:account_id` options.
66
+
67
+ * `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`,
68
+ `ENV['AWS_SESSION_TOKEN']`, and `ENV['AWS_ACCOUNT_ID']`.
69
+
70
+ * `~/.aws/credentials`
71
+
72
+ * `~/.aws/config`
73
+
74
+ * EC2/ECS IMDS instance profile - When used by default, the timeouts
75
+ are very aggressive. Construct and pass an instance of
76
+ `Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
77
+ enable retries and extended timeouts. Instance profile credential
78
+ fetching can be disabled by setting `ENV['AWS_EC2_METADATA_DISABLED']`
79
+ to `true`.
75
80
  DOCS
76
81
  ) do |config|
77
82
  CredentialProviderChain.new(config).resolve
@@ -82,30 +87,40 @@ locations will be searched for credentials:
82
87
  option(:instance_profile_credentials_timeout, 1)
83
88
 
84
89
  option(:token_provider,
85
- required: false,
86
- doc_type: 'Aws::TokenProvider',
87
- rbs_type: 'untyped',
88
- docstring: <<-DOCS
89
- A Bearer Token Provider. This can be an instance of any one of the
90
- following classes:
91
-
92
- * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
93
- tokens.
94
-
95
- * `Aws::SSOTokenProvider` - Used for loading tokens from AWS SSO using an
96
- access token generated from `aws login`.
97
-
98
- When `:token_provider` is not configured directly, the `Aws::TokenProviderChain`
99
- will be used to search for tokens configured for your profile in shared configuration files.
100
- DOCS
90
+ doc_type: 'Aws::TokenProvider',
91
+ rbs_type: 'untyped',
92
+ docstring: <<~DOCS
93
+ Your Bearer token used for authentication. This can be an instance of any one of the
94
+ following classes:
95
+
96
+ * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
97
+ tokens.
98
+
99
+ * `Aws::SSOTokenProvider` - Used for loading tokens from AWS SSO using an
100
+ access token generated from `aws login`.
101
+
102
+ When `:token_provider` is not configured directly, the `Aws::TokenProviderChain`
103
+ will be used to search for tokens configured for your profile in shared configuration files.
104
+ DOCS
101
105
  ) do |config|
102
- if config.stub_responses
103
- StaticTokenProvider.new('token')
104
- else
105
- TokenProviderChain.new(config).resolve
106
- end
106
+ TokenProviderChain.new(config).resolve
107
107
  end
108
108
 
109
+ option(:auth_scheme_preference,
110
+ doc_type: 'Array<String>',
111
+ rbs_type: 'Array[String]',
112
+ docstring: <<~DOCS
113
+ A list of preferred authentication schemes to use when making a request. Supported values are:
114
+ `sigv4`, `sigv4a`, `httpBearerAuth`, and `noAuth`. When set using `ENV['AWS_AUTH_SCHEME_PREFERENCE']` or in
115
+ shared config as `auth_scheme_preference`, the value should be a comma-separated list.
116
+ DOCS
117
+ ) do |config|
118
+ value =
119
+ ENV['AWS_AUTH_SCHEME_PREFERENCE'] ||
120
+ Aws.shared_config.auth_scheme_preference(profile: config.profile) ||
121
+ ''
122
+ value.gsub(' ', '').gsub("\t", '').split(',')
123
+ end
109
124
  end
110
125
  end
111
126
  end
@@ -13,9 +13,6 @@ module Aws
13
13
  option(:sigv4_region)
14
14
  option(:unsigned_operations, default: [])
15
15
 
16
- supported_auth_types = %w[sigv4 bearer sigv4-s3express sigv4a none]
17
- SUPPORTED_AUTH_TYPES = supported_auth_types.freeze
18
-
19
16
  def add_handlers(handlers, cfg)
20
17
  operations = cfg.api.operation_names - cfg.unsigned_operations
21
18
  handlers.add(Handler, step: :sign, operations: operations)
@@ -32,7 +29,7 @@ module Aws
32
29
  }
33
30
  SignatureV4.new(auth_scheme, config, sigv4_overrides)
34
31
  when 'bearer'
35
- Bearer.new
32
+ Bearer.new(config)
36
33
  else
37
34
  NullSigner.new
38
35
  end
@@ -41,7 +38,6 @@ module Aws
41
38
  class Handler < Seahorse::Client::Handler
42
39
  def call(context)
43
40
  # Skip signing if using sigv2 signing from s3_signer in S3
44
- credentials = nil
45
41
  unless v2_signing?(context.config)
46
42
  signer = Sign.signer_for(
47
43
  context[:auth_scheme],
@@ -49,18 +45,22 @@ module Aws
49
45
  context[:sigv4_region],
50
46
  context[:sigv4_credentials]
51
47
  )
52
- credentials = signer.credentials if signer.is_a?(SignatureV4)
53
48
  signer.sign(context)
54
49
  end
55
- with_metrics(credentials) { @handler.call(context) }
50
+ with_metrics(signer) { @handler.call(context) }
56
51
  end
57
52
 
58
53
  private
59
54
 
60
- def with_metrics(credentials, &block)
61
- return block.call unless credentials&.respond_to?(:metrics)
62
-
63
- Aws::Plugins::UserAgent.metric(*credentials.metrics, &block)
55
+ def with_metrics(signer, &block)
56
+ case signer
57
+ when SignatureV4
58
+ Aws::Plugins::UserAgent.metric(*signer.credentials.metrics, &block)
59
+ when Bearer
60
+ Aws::Plugins::UserAgent.metric(*signer.token_provider.metrics, &block)
61
+ else
62
+ block.call
63
+ end
64
64
  end
65
65
 
66
66
  def v2_signing?(config)
@@ -72,21 +72,19 @@ module Aws
72
72
 
73
73
  # @api private
74
74
  class Bearer
75
- def initialize
75
+ def initialize(config)
76
+ @token_provider = config.token_provider
76
77
  end
77
78
 
79
+ attr_reader :token_provider
80
+
78
81
  def sign(context)
79
82
  if context.http_request.endpoint.scheme != 'https'
80
- raise ArgumentError,
81
- 'Unable to use bearer authorization on non https endpoint.'
83
+ raise ArgumentError, 'Unable to use bearer authorization on non https endpoint.'
82
84
  end
85
+ raise Errors::MissingBearerTokenError unless @token_provider && @token_provider.set?
83
86
 
84
- token_provider = context.config.token_provider
85
-
86
- raise Errors::MissingBearerTokenError unless token_provider&.set?
87
-
88
- context.http_request.headers['Authorization'] =
89
- "Bearer #{token_provider.token.token}"
87
+ context.http_request.headers['Authorization'] = "Bearer #{@token_provider.token.token}"
90
88
  end
91
89
 
92
90
  def presign_url(*args)
@@ -100,16 +98,11 @@ module Aws
100
98
 
101
99
  # @api private
102
100
  class SignatureV4
103
- attr_reader :signer
104
-
105
101
  def initialize(auth_scheme, config, sigv4_overrides = {})
106
102
  scheme_name = auth_scheme['name']
107
-
108
103
  unless %w[sigv4 sigv4a sigv4-s3express].include?(scheme_name)
109
- raise ArgumentError,
110
- "Expected sigv4, sigv4a, or sigv4-s3express auth scheme, got #{scheme_name}"
104
+ raise ArgumentError, "Expected sigv4, sigv4a, or sigv4-s3express auth scheme, got #{scheme_name}"
111
105
  end
112
-
113
106
  region = if scheme_name == 'sigv4a'
114
107
  auth_scheme['signingRegionSet'].join(',')
115
108
  else
@@ -121,8 +114,8 @@ module Aws
121
114
  region: sigv4_overrides[:region] || config.sigv4_region || region,
122
115
  credentials_provider: sigv4_overrides[:credentials] || config.credentials,
123
116
  signing_algorithm: scheme_name.to_sym,
124
- uri_escape_path: !!!auth_scheme['disableDoubleEncoding'],
125
- normalize_path: !!!auth_scheme['disableNormalizePath'],
117
+ uri_escape_path: !auth_scheme['disableDoubleEncoding'],
118
+ normalize_path: !auth_scheme['disableNormalizePath'],
126
119
  unsigned_headers: %w[content-length user-agent x-amzn-trace-id expect transfer-encoding connection]
127
120
  )
128
121
  rescue Aws::Sigv4::Errors::MissingCredentialsError
@@ -130,6 +123,8 @@ module Aws
130
123
  end
131
124
  end
132
125
 
126
+ attr_reader :signer
127
+
133
128
  def sign(context)
134
129
  req = context.http_request
135
130
 
@@ -29,6 +29,12 @@ requests are made, and retries are disabled.
29
29
  end
30
30
  end
31
31
 
32
+ option(:token_provider) do |config|
33
+ if config.stub_responses
34
+ StaticTokenProvider.new('stubbed-token')
35
+ end
36
+ end
37
+
32
38
  option(:stubs) { {} }
33
39
  option(:stubs_mutex) { Mutex.new }
34
40
  option(:api_requests) { [] }
@@ -54,7 +54,8 @@ module Aws
54
54
  "CREDENTIALS_HTTP" : "z",
55
55
  "CREDENTIALS_IMDS" : "0",
56
56
  "SSO_LOGIN_DEVICE" : "1",
57
- "SSO_LOGIN_AUTH" : "2"
57
+ "SSO_LOGIN_AUTH" : "2",
58
+ "BEARER_SERVICE_ENV_VARS": "3"
58
59
  }
59
60
  METRICS
60
61
 
@@ -203,6 +203,7 @@ module Aws
203
203
  config_reader(
204
204
  :region,
205
205
  :account_id_endpoint_mode,
206
+ :auth_scheme_preference,
206
207
  :sigv4a_signing_region_set,
207
208
  :ca_bundle,
208
209
  :credential_process,
@@ -2,12 +2,11 @@
2
2
 
3
3
  module Aws
4
4
  class StaticTokenProvider
5
-
6
5
  include TokenProvider
7
6
 
8
7
  # @param [String] token
9
8
  # @param [Time] expiration
10
- def initialize(token, expiration=nil)
9
+ def initialize(token, expiration = nil)
11
10
  @token = Token.new(token, expiration)
12
11
  end
13
12
  end
@@ -3,9 +3,9 @@
3
3
  module Aws
4
4
  class Token
5
5
 
6
- # @param [String] token
7
- # @param [Time] expiration
8
- def initialize(token, expiration=nil)
6
+ # @param [String, nil] token
7
+ # @param [Time, nil] expiration
8
+ def initialize(token, expiration = nil)
9
9
  @token = token
10
10
  @expiration = expiration
11
11
  end
@@ -6,6 +6,10 @@ module Aws
6
6
  # @return [Token]
7
7
  attr_reader :token
8
8
 
9
+ # @api private
10
+ # Returns UserAgent metrics for tokens.
11
+ attr_accessor :metrics
12
+
9
13
  # @return [Boolean]
10
14
  def set?
11
15
  !!token && token.set?
@@ -27,17 +27,13 @@ module Aws
27
27
 
28
28
  def static_profile_sso_token(options)
29
29
  if Aws.shared_config.config_enabled? && options[:config] && options[:config].profile
30
- Aws.shared_config.sso_token_from_config(
31
- profile: options[:config].profile
32
- )
30
+ Aws.shared_config.sso_token_from_config(profile: options[:config].profile)
33
31
  end
34
32
  end
35
33
 
36
-
37
34
  def sso_token(options)
38
- profile_name = determine_profile_name(options)
39
35
  if Aws.shared_config.config_enabled?
40
- Aws.shared_config.sso_token_from_config(profile: profile_name)
36
+ Aws.shared_config.sso_token_from_config(profile: determine_profile_name(options))
41
37
  end
42
38
  rescue Errors::NoSuchProfileError
43
39
  nil
@@ -95,7 +95,7 @@ module Aws::SSO
95
95
  # class name or an instance of a plugin class.
96
96
  #
97
97
  # @option options [required, Aws::CredentialProvider] :credentials
98
- # Your AWS credentials. This can be an instance of any one of the
98
+ # Your AWS credentials used for authentication. This can be an instance of any one of the
99
99
  # following classes:
100
100
  #
101
101
  # * `Aws::Credentials` - Used for configuring static, non-refreshing
@@ -128,18 +128,23 @@ module Aws::SSO
128
128
  # locations will be searched for credentials:
129
129
  #
130
130
  # * `Aws.config[:credentials]`
131
+ #
131
132
  # * The `:access_key_id`, `:secret_access_key`, `:session_token`, and
132
133
  # `:account_id` options.
133
- # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'],
134
- # ENV['AWS_SESSION_TOKEN'], and ENV['AWS_ACCOUNT_ID']
134
+ #
135
+ # * `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`,
136
+ # `ENV['AWS_SESSION_TOKEN']`, and `ENV['AWS_ACCOUNT_ID']`.
137
+ #
135
138
  # * `~/.aws/credentials`
139
+ #
136
140
  # * `~/.aws/config`
141
+ #
137
142
  # * EC2/ECS IMDS instance profile - When used by default, the timeouts
138
143
  # are very aggressive. Construct and pass an instance of
139
144
  # `Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
140
145
  # enable retries and extended timeouts. Instance profile credential
141
- # fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
142
- # to true.
146
+ # fetching can be disabled by setting `ENV['AWS_EC2_METADATA_DISABLED']`
147
+ # to `true`.
143
148
  #
144
149
  # @option options [required, String] :region
145
150
  # The AWS region to connect to. The configured `:region` is
@@ -167,6 +172,11 @@ module Aws::SSO
167
172
  # When false, the request will raise a `RetryCapacityNotAvailableError` and will
168
173
  # not retry instead of sleeping.
169
174
  #
175
+ # @option options [Array<String>] :auth_scheme_preference
176
+ # A list of preferred authentication schemes to use when making a request. Supported values are:
177
+ # `sigv4`, `sigv4a`, `httpBearerAuth`, and `noAuth`. When set using `ENV['AWS_AUTH_SCHEME_PREFERENCE']` or in
178
+ # shared config as `auth_scheme_preference`, the value should be a comma-separated list.
179
+ #
170
180
  # @option options [Boolean] :client_side_monitoring (false)
171
181
  # When `true`, client-side metrics will be collected for all API requests from
172
182
  # this client.
@@ -253,8 +263,8 @@ module Aws::SSO
253
263
  # 4 times. Used in `standard` and `adaptive` retry modes.
254
264
  #
255
265
  # @option options [String] :profile ("default")
256
- # Used when loading credentials from the shared credentials file
257
- # at HOME/.aws/credentials. When not specified, 'default' is used.
266
+ # Used when loading credentials from the shared credentials file at `HOME/.aws/credentials`.
267
+ # When not specified, 'default' is used.
258
268
  #
259
269
  # @option options [String] :request_checksum_calculation ("when_supported")
260
270
  # Determines when a checksum will be calculated for request payloads. Values are:
@@ -367,7 +377,7 @@ module Aws::SSO
367
377
  # `Aws::Telemetry::OTelProvider` for telemetry provider.
368
378
  #
369
379
  # @option options [Aws::TokenProvider] :token_provider
370
- # A Bearer Token Provider. This can be an instance of any one of the
380
+ # Your Bearer token used for authentication. This can be an instance of any one of the
371
381
  # following classes:
372
382
  #
373
383
  # * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
@@ -691,7 +701,7 @@ module Aws::SSO
691
701
  tracer: tracer
692
702
  )
693
703
  context[:gem_name] = 'aws-sdk-core'
694
- context[:gem_version] = '3.226.2'
704
+ context[:gem_version] = '3.228.0'
695
705
  Seahorse::Client::Request.new(handlers, context)
696
706
  end
697
707
 
data/lib/aws-sdk-sso.rb CHANGED
@@ -56,7 +56,7 @@ module Aws::SSO
56
56
  autoload :EndpointProvider, 'aws-sdk-sso/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-sso/endpoints'
58
58
 
59
- GEM_VERSION = '3.226.2'
59
+ GEM_VERSION = '3.228.0'
60
60
 
61
61
  end
62
62
 
@@ -95,7 +95,7 @@ module Aws::SSOOIDC
95
95
  # class name or an instance of a plugin class.
96
96
  #
97
97
  # @option options [required, Aws::CredentialProvider] :credentials
98
- # Your AWS credentials. This can be an instance of any one of the
98
+ # Your AWS credentials used for authentication. This can be an instance of any one of the
99
99
  # following classes:
100
100
  #
101
101
  # * `Aws::Credentials` - Used for configuring static, non-refreshing
@@ -128,18 +128,23 @@ module Aws::SSOOIDC
128
128
  # locations will be searched for credentials:
129
129
  #
130
130
  # * `Aws.config[:credentials]`
131
+ #
131
132
  # * The `:access_key_id`, `:secret_access_key`, `:session_token`, and
132
133
  # `:account_id` options.
133
- # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'],
134
- # ENV['AWS_SESSION_TOKEN'], and ENV['AWS_ACCOUNT_ID']
134
+ #
135
+ # * `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`,
136
+ # `ENV['AWS_SESSION_TOKEN']`, and `ENV['AWS_ACCOUNT_ID']`.
137
+ #
135
138
  # * `~/.aws/credentials`
139
+ #
136
140
  # * `~/.aws/config`
141
+ #
137
142
  # * EC2/ECS IMDS instance profile - When used by default, the timeouts
138
143
  # are very aggressive. Construct and pass an instance of
139
144
  # `Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
140
145
  # enable retries and extended timeouts. Instance profile credential
141
- # fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
142
- # to true.
146
+ # fetching can be disabled by setting `ENV['AWS_EC2_METADATA_DISABLED']`
147
+ # to `true`.
143
148
  #
144
149
  # @option options [required, String] :region
145
150
  # The AWS region to connect to. The configured `:region` is
@@ -167,6 +172,11 @@ module Aws::SSOOIDC
167
172
  # When false, the request will raise a `RetryCapacityNotAvailableError` and will
168
173
  # not retry instead of sleeping.
169
174
  #
175
+ # @option options [Array<String>] :auth_scheme_preference
176
+ # A list of preferred authentication schemes to use when making a request. Supported values are:
177
+ # `sigv4`, `sigv4a`, `httpBearerAuth`, and `noAuth`. When set using `ENV['AWS_AUTH_SCHEME_PREFERENCE']` or in
178
+ # shared config as `auth_scheme_preference`, the value should be a comma-separated list.
179
+ #
170
180
  # @option options [Boolean] :client_side_monitoring (false)
171
181
  # When `true`, client-side metrics will be collected for all API requests from
172
182
  # this client.
@@ -253,8 +263,8 @@ module Aws::SSOOIDC
253
263
  # 4 times. Used in `standard` and `adaptive` retry modes.
254
264
  #
255
265
  # @option options [String] :profile ("default")
256
- # Used when loading credentials from the shared credentials file
257
- # at HOME/.aws/credentials. When not specified, 'default' is used.
266
+ # Used when loading credentials from the shared credentials file at `HOME/.aws/credentials`.
267
+ # When not specified, 'default' is used.
258
268
  #
259
269
  # @option options [String] :request_checksum_calculation ("when_supported")
260
270
  # Determines when a checksum will be calculated for request payloads. Values are:
@@ -367,7 +377,7 @@ module Aws::SSOOIDC
367
377
  # `Aws::Telemetry::OTelProvider` for telemetry provider.
368
378
  #
369
379
  # @option options [Aws::TokenProvider] :token_provider
370
- # A Bearer Token Provider. This can be an instance of any one of the
380
+ # Your Bearer token used for authentication. This can be an instance of any one of the
371
381
  # following classes:
372
382
  #
373
383
  # * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
@@ -1061,7 +1071,7 @@ module Aws::SSOOIDC
1061
1071
  tracer: tracer
1062
1072
  )
1063
1073
  context[:gem_name] = 'aws-sdk-core'
1064
- context[:gem_version] = '3.226.2'
1074
+ context[:gem_version] = '3.228.0'
1065
1075
  Seahorse::Client::Request.new(handlers, context)
1066
1076
  end
1067
1077
 
@@ -56,7 +56,7 @@ module Aws::SSOOIDC
56
56
  autoload :EndpointProvider, 'aws-sdk-ssooidc/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-ssooidc/endpoints'
58
58
 
59
- GEM_VERSION = '3.226.2'
59
+ GEM_VERSION = '3.228.0'
60
60
 
61
61
  end
62
62
 
@@ -97,7 +97,7 @@ module Aws::STS
97
97
  # class name or an instance of a plugin class.
98
98
  #
99
99
  # @option options [required, Aws::CredentialProvider] :credentials
100
- # Your AWS credentials. This can be an instance of any one of the
100
+ # Your AWS credentials used for authentication. This can be an instance of any one of the
101
101
  # following classes:
102
102
  #
103
103
  # * `Aws::Credentials` - Used for configuring static, non-refreshing
@@ -130,18 +130,23 @@ module Aws::STS
130
130
  # locations will be searched for credentials:
131
131
  #
132
132
  # * `Aws.config[:credentials]`
133
+ #
133
134
  # * The `:access_key_id`, `:secret_access_key`, `:session_token`, and
134
135
  # `:account_id` options.
135
- # * ENV['AWS_ACCESS_KEY_ID'], ENV['AWS_SECRET_ACCESS_KEY'],
136
- # ENV['AWS_SESSION_TOKEN'], and ENV['AWS_ACCOUNT_ID']
136
+ #
137
+ # * `ENV['AWS_ACCESS_KEY_ID']`, `ENV['AWS_SECRET_ACCESS_KEY']`,
138
+ # `ENV['AWS_SESSION_TOKEN']`, and `ENV['AWS_ACCOUNT_ID']`.
139
+ #
137
140
  # * `~/.aws/credentials`
141
+ #
138
142
  # * `~/.aws/config`
143
+ #
139
144
  # * EC2/ECS IMDS instance profile - When used by default, the timeouts
140
145
  # are very aggressive. Construct and pass an instance of
141
146
  # `Aws::InstanceProfileCredentials` or `Aws::ECSCredentials` to
142
147
  # enable retries and extended timeouts. Instance profile credential
143
- # fetching can be disabled by setting ENV['AWS_EC2_METADATA_DISABLED']
144
- # to true.
148
+ # fetching can be disabled by setting `ENV['AWS_EC2_METADATA_DISABLED']`
149
+ # to `true`.
145
150
  #
146
151
  # @option options [required, String] :region
147
152
  # The AWS region to connect to. The configured `:region` is
@@ -169,6 +174,11 @@ module Aws::STS
169
174
  # When false, the request will raise a `RetryCapacityNotAvailableError` and will
170
175
  # not retry instead of sleeping.
171
176
  #
177
+ # @option options [Array<String>] :auth_scheme_preference
178
+ # A list of preferred authentication schemes to use when making a request. Supported values are:
179
+ # `sigv4`, `sigv4a`, `httpBearerAuth`, and `noAuth`. When set using `ENV['AWS_AUTH_SCHEME_PREFERENCE']` or in
180
+ # shared config as `auth_scheme_preference`, the value should be a comma-separated list.
181
+ #
172
182
  # @option options [Boolean] :client_side_monitoring (false)
173
183
  # When `true`, client-side metrics will be collected for all API requests from
174
184
  # this client.
@@ -255,8 +265,8 @@ module Aws::STS
255
265
  # 4 times. Used in `standard` and `adaptive` retry modes.
256
266
  #
257
267
  # @option options [String] :profile ("default")
258
- # Used when loading credentials from the shared credentials file
259
- # at HOME/.aws/credentials. When not specified, 'default' is used.
268
+ # Used when loading credentials from the shared credentials file at `HOME/.aws/credentials`.
269
+ # When not specified, 'default' is used.
260
270
  #
261
271
  # @option options [String] :request_checksum_calculation ("when_supported")
262
272
  # Determines when a checksum will be calculated for request payloads. Values are:
@@ -374,7 +384,7 @@ module Aws::STS
374
384
  # `Aws::Telemetry::OTelProvider` for telemetry provider.
375
385
  #
376
386
  # @option options [Aws::TokenProvider] :token_provider
377
- # A Bearer Token Provider. This can be an instance of any one of the
387
+ # Your Bearer token used for authentication. This can be an instance of any one of the
378
388
  # following classes:
379
389
  #
380
390
  # * `Aws::StaticTokenProvider` - Used for configuring static, non-refreshing
@@ -2594,7 +2604,7 @@ module Aws::STS
2594
2604
  tracer: tracer
2595
2605
  )
2596
2606
  context[:gem_name] = 'aws-sdk-core'
2597
- context[:gem_version] = '3.226.2'
2607
+ context[:gem_version] = '3.228.0'
2598
2608
  Seahorse::Client::Request.new(handlers, context)
2599
2609
  end
2600
2610
 
@@ -53,13 +53,9 @@ module Aws
53
53
  use_fips: context.config.use_fips_endpoint,
54
54
  use_global_endpoint: context.config.sts_regional_endpoints == 'legacy'
55
55
  )
56
- endpoint = context.config.endpoint_provider
57
- .resolve_endpoint(endpoint_params)
56
+ endpoint = context.config.endpoint_provider.resolve_endpoint(endpoint_params)
58
57
  auth_scheme = Aws::Endpoints.resolve_auth_scheme(context, endpoint)
59
-
60
- signer = Aws::Plugins::Sign.signer_for(
61
- auth_scheme, context.config
62
- )
58
+ signer = Aws::Plugins::Sign.signer_for(auth_scheme, context.config)
63
59
 
64
60
  signer.presign_url(
65
61
  http_method: 'GET',
data/lib/aws-sdk-sts.rb CHANGED
@@ -56,7 +56,7 @@ module Aws::STS
56
56
  autoload :EndpointProvider, 'aws-sdk-sts/endpoint_provider'
57
57
  autoload :Endpoints, 'aws-sdk-sts/endpoints'
58
58
 
59
- GEM_VERSION = '3.226.2'
59
+ GEM_VERSION = '3.228.0'
60
60
 
61
61
  end
62
62
 
@@ -5,7 +5,7 @@ require 'stringio'
5
5
  module Seahorse
6
6
  module Client
7
7
  class RequestContext
8
-
8
+ # @param [Hash] options
9
9
  # @option options [required,Symbol] :operation_name (nil)
10
10
  # @option options [required,Model::Operation] :operation (nil)
11
11
  # @option options [Model::Authorizer] :authorizer (nil)
@@ -16,7 +16,7 @@ module Seahorse
16
16
  # @option options [Http::Response] :http_response (Http::Response.new)
17
17
  # @option options [Integer] :retries (0)
18
18
  # @option options [Aws::Telemetry::TracerBase] :tracer (Aws::Telemetry::NoOpTracer.new)
19
- # @options options [Hash] :metadata ({})
19
+ # @option options [Hash] :metadata ({})
20
20
  def initialize(options = {})
21
21
  @operation_name = options[:operation_name]
22
22
  @operation = options[:operation]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-sdk-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.226.2
4
+ version: 3.228.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Amazon Web Services
@@ -77,6 +77,20 @@ dependencies:
77
77
  - - ">="
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0'
80
+ - !ruby/object:Gem::Dependency
81
+ name: bigdecimal
82
+ requirement: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
87
+ type: :runtime
88
+ prerelease: false
89
+ version_requirements: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
80
94
  - !ruby/object:Gem::Dependency
81
95
  name: jmespath
82
96
  requirement: !ruby/object:Gem::Requirement