Skip to content

Commit 9b94aef

Browse files
Fix region configuration for LoginCredential's Signin client (#3319)
1 parent c01f80e commit 9b94aef

File tree

5 files changed

+19
-7
lines changed

5 files changed

+19
-7
lines changed

gems/aws-sdk-core/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Unreleased Changes
22
------------------
33

4+
* Issue - Fix region configuration for LoginCredential's Signin client.
5+
46
3.238.0 (2025-11-19)
57
------------------
68

gems/aws-sdk-core/lib/aws-sdk-core/credential_provider_chain.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ def static_profile_login_credentials(options)
110110
return unless Aws.shared_config.config_enabled? && options[:config]&.profile
111111

112112
with_metrics('CREDENTIALS_CODE') do
113-
creds = Aws.shared_config.login_credentials_from_config(profile: options[:config].profile)
113+
creds = Aws.shared_config.login_credentials_from_config(
114+
profile: options[:config].profile,
115+
region: options[:config].region
116+
)
114117
return unless creds
115118

116119
creds.metrics << 'CREDENTIALS_CODE'
@@ -170,7 +173,7 @@ def login_credentials(options)
170173
return unless Aws.shared_config.config_enabled?
171174

172175
profile_name = determine_profile_name(options)
173-
Aws.shared_config.login_credentials_from_config(profile: profile_name)
176+
Aws.shared_config.login_credentials_from_config(profile: profile_name, region: options[:config].region)
174177
rescue Errors::NoSuchProfileError
175178
nil
176179
end

gems/aws-sdk-core/lib/aws-sdk-core/shared_config.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ def sso_token_from_config(opts = {})
176176
# file, if present.
177177
def login_credentials_from_config(opts = {})
178178
p = opts[:profile] || @profile_name
179-
credentials = login_credentials_from_profile(@parsed_credentials, p)
180-
credentials ||= login_credentials_from_profile(@parsed_config, p) if @parsed_config
179+
credentials = login_credentials_from_profile(@parsed_credentials, p, opts[:region])
180+
credentials ||= login_credentials_from_profile(@parsed_config, p, opts[:region]) if @parsed_config
181181
credentials
182182
end
183183

@@ -479,10 +479,12 @@ def sso_token_from_profile(cfg, profile)
479479
end
480480
end
481481

482-
def login_credentials_from_profile(cfg, profile)
482+
def login_credentials_from_profile(cfg, profile, region)
483483
return unless @parsed_config && (prof_config = cfg[profile]) && prof_config['login_session']
484484

485-
creds = LoginCredentials.new(login_session: prof_config['login_session'])
485+
cfg = { login_session: prof_config['login_session'] }
486+
cfg[:region] = region if region
487+
creds = LoginCredentials.new(cfg)
486488
creds.metrics << 'CREDENTIALS_PROFILE_LOGIN'
487489
creds
488490
end

gems/aws-sdk-core/spec/aws/login_credentials_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ module Aws
186186
}
187187
end
188188

189+
before do
190+
allow_any_instance_of(LoginCredentials).to receive(:warn).with(/WARNING: OpenSSL 3.6.x/)
191+
end
192+
189193
it 'refreshes the token' do
190194
mock_token_file(login_session, cached_token)
191195
client.stub_responses(:create_o_auth_2_token, signin_resp)

services.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1220,7 +1220,8 @@
12201220
"models": "signer/2017-08-25"
12211221
},
12221222
"Signin": {
1223-
"models": "signin/2023-01-01"
1223+
"models": "signin/2023-01-01",
1224+
"gemName": "aws-sdk-core"
12241225
},
12251226
"SimSpaceWeaver": {
12261227
"models": "simspaceweaver/2022-10-28"

0 commit comments

Comments
 (0)