Skip to content

Commit a029564

Browse files
committed
Move endpointurl and services to credentialprofile and not options
1 parent 66922d0 commit a029564

File tree

9 files changed

+116
-24
lines changed

9 files changed

+116
-24
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
**/Temp/
1616
**/buildlogs/
1717
**/.vs/
18+
sdk/test/UnitTests/Custom/Util/get_credentials.bat
1819

1920
**/*project.lock.json
2021
**/project.lock.json
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"core": {
3+
"changeLogMessages": [
4+
"Support Account ID based endpoints. Credential Providers will now attach the account ID to credentials if available and also read from the shared credentials file if set."
5+
],
6+
"type": "patch",
7+
"updateMinimum": true
8+
}
9+
}

sdk/src/Core/Amazon.Runtime/CredentialManagement/NetSDKCredentialsFile.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,7 @@ public class NetSDKCredentialsFile : ICredentialProfileStore
107107
{ "SourceProfile", SettingsConstants.SourceProfileField },
108108
{ "Token", SettingsConstants.SessionTokenField },
109109
{ "UserIdentity", SettingsConstants.UserIdentityField },
110-
{ "Services", SettingsConstants.Services },
111-
{ "EndpointUrl", SettingsConstants.EndpointUrl },
110+
{ "AwsAccountId", SettingsConstants.AwsAccountId },
112111
// Not implemented for NetSDKCredentials. Applicable only
113112
// for SharedCredentials
114113
{ "CredentialProcess" , SettingsConstants.CredentialProcess },

sdk/src/Core/Amazon.Runtime/CredentialManagement/SharedCredentialsFile.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ public class SharedCredentialsFile : ICredentialProfileStore
151151
{ "UserIdentity", null },
152152
{ "CredentialProcess" , "credential_process" },
153153
{ "WebIdentityTokenFile", "web_identity_token_file" },
154-
{ "Services", "services" },
155-
{ "EndpointUrl", "endpoint_url" },
156154
{ "AwsAccountId", "aws_account_id" },
157155
{ nameof(CredentialProfileOptions.SsoAccountId), SsoAccountId },
158156
{ nameof(CredentialProfileOptions.SsoRegion), SsoRegion },

sdk/src/Core/Amazon.Runtime/Internal/Settings/SettingsConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public static class SettingsConstants
5656
public const string WebIdentityTokenFile = "WebIdentityTokenFile";
5757
public const string Services = "services";
5858
public const string EndpointUrl = "endpoint_url";
59+
public const string AwsAccountId = "aws_account_id";
5960

6061
// present in endpoint definitions in SAMLEndpoints.json file
6162
public const string EndpointField = "Endpoint";

sdk/src/Services/SecurityToken/Custom/AmazonSecurityTokenServiceClient.Extension.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ AssumeRoleImmutableCredentials ICoreAmazonSTS.CredentialsFromAssumeRoleWithWebId
150150
{
151151
var response = AssumeRoleWithWebIdentity(request);
152152
return new AssumeRoleImmutableCredentials(response.Credentials.AccessKeyId, response.Credentials.SecretAccessKey,
153-
response.Credentials.SessionToken, response.Credentials.Expiration.GetValueOrDefault(), Arn.Parse(response.AssumedRoleUser.Arn).AccountId);
153+
response.Credentials.SessionToken, response.Credentials.Expiration.GetValueOrDefault(), response.AssumedRoleUser != null ? Arn.Parse(response.AssumedRoleUser.Arn).AccountId : null);
154154
}
155155
catch (Exception e)
156156
{
@@ -177,7 +177,7 @@ async Task<AssumeRoleImmutableCredentials> ICoreAmazonSTS.CredentialsFromAssumeR
177177
{
178178
var response = await AssumeRoleWithWebIdentityAsync(request).ConfigureAwait(false);
179179
return new AssumeRoleImmutableCredentials(response.Credentials.AccessKeyId, response.Credentials.SecretAccessKey,
180-
response.Credentials.SessionToken, response.Credentials.Expiration.GetValueOrDefault(), Arn.Parse(response.AssumedRoleUser.Arn).AccountId);
180+
response.Credentials.SessionToken, response.Credentials.Expiration.GetValueOrDefault(), response.AssumedRoleUser != null ? Arn.Parse(response.AssumedRoleUser.Arn).AccountId : null);
181181
}
182182
catch (Exception e)
183183
{
@@ -204,7 +204,7 @@ AssumeRoleImmutableCredentials ICoreAmazonSTS.CredentialsFromAssumeRoleAuthentic
204204

205205
var response = AssumeRole(request);
206206
return new AssumeRoleImmutableCredentials(response.Credentials.AccessKeyId, response.Credentials.SecretAccessKey,
207-
response.Credentials.SessionToken, response.Credentials.Expiration.GetValueOrDefault(), Arn.Parse(response.AssumedRoleUser.Arn).AccountId);
207+
response.Credentials.SessionToken, response.Credentials.Expiration.GetValueOrDefault(), response.AssumedRoleUser != null ? Arn.Parse(response.AssumedRoleUser.Arn).AccountId : null);
208208
}
209209
catch (Exception e)
210210
{

0 commit comments

Comments
 (0)