Commit d9831c2
committed
fix(amplify-provider-awscloudformation): mfa role assumption fails with cached credentials (aws-amplify#14626)
Fixes three related bugs in credential caching for MFA-based role
assumption introduced in commit 04f7bcf (PR aws-amplify#14315).
Bug 1 - MFA prompt never appears: getCachedRoleCredentials() always
returned { credentials: {} } even with no valid cache, so the STS
AssumeRole call was never executed.
Fix: return undefined when no valid cached credentials exist.
Bug 2 - Cache validation always fails: credentials were cached in
nested format { credentials: { accessKeyId, ... } } but
validateCachedCredentials() expected flat format.
Fix: cache the flat credentials object (roleCredentials.credentials).
Bug 3 - expiration.getTime error: cached Date is deserialized as a
string, but the AWS SDK calls expiration.getTime(). The fix in
PR aws-amplify#14315 only addressed this in getConfiguredAWSClientConfig(), not
in getProfiledAwsConfig().
Fix: convert expiration to Date when returning cached credentials.1 parent bea564a commit d9831c2
1 file changed
Lines changed: 6 additions & 1 deletion
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
186 | 186 | | |
187 | 187 | | |
188 | 188 | | |
189 | | - | |
| 189 | + | |
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
248 | 251 | | |
249 | 252 | | |
250 | 253 | | |
| 254 | + | |
| 255 | + | |
251 | 256 | | |
252 | 257 | | |
253 | 258 | | |
| |||
0 commit comments