Skip to content

Commit bcb2653

Browse files
authored
Support SSO and CA Bundle parameters in credentials file (#1795)
1 parent fefa06d commit bcb2653

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"id": "6a9e3da6-a75c-41fd-9efe-f3fdf2355f48",
3+
"type": "feature",
4+
"description": "Adds support for the following settings in the `~/.aws/credentials` file: `sso_account_id`, `sso_region`, `sso_role_name`, `sso_start_url`, and `ca_bundle`.",
5+
"modules": [
6+
"config"
7+
]
8+
}

config/shared_config.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,6 @@ type LoadSharedConfigOptions struct {
463463
//
464464
// You can read more about shared config and credentials file location at
465465
// https://docs.aws.amazon.com/credref/latest/refdocs/file-location.html#file-location
466-
//
467466
func LoadSharedConfigProfile(ctx context.Context, profile string, optFns ...func(*LoadSharedConfigOptions)) (SharedConfig, error) {
468467
var option LoadSharedConfigOptions
469468
for _, fn := range optFns {
@@ -680,6 +679,11 @@ func mergeSections(dst, src ini.Sections) error {
680679
useFIPSEndpointKey,
681680
defaultsModeKey,
682681
retryModeKey,
682+
ssoAccountIDKey,
683+
ssoRegionKey,
684+
ssoRoleNameKey,
685+
ssoStartURL,
686+
caBundleKey,
683687
}
684688
for i := range stringKeys {
685689
if err := mergeStringKey(&srcSection, &dstSection, sectionName, stringKeys[i]); err != nil {

config/shared_config_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,11 @@ func TestNewSharedConfig(t *testing.T) {
591591
Profile: "merged_profiles",
592592
RoleARN: "creds_profile_arn",
593593
RoleDurationSeconds: aws.Duration(1023 * time.Second),
594+
SSOAccountID: "0123456789",
595+
SSORegion: "us-west-2",
596+
SSORoleName: "CredProfileRole",
597+
SSOStartURL: "https://my-sso-cred-profile-role.awsapps.com/start",
598+
CustomCABundle: "/path/to/bundle.b",
594599
},
595600
},
596601
"merged profiles across config files": {
@@ -601,6 +606,11 @@ func TestNewSharedConfig(t *testing.T) {
601606
Profile: "merged_profiles",
602607
RoleARN: "config_profile_arn",
603608
RoleDurationSeconds: aws.Duration(3601 * time.Second),
609+
SSOAccountID: "1234567890",
610+
SSORegion: "us-east-1",
611+
SSORoleName: "ConfigProfileRole",
612+
SSOStartURL: "https://my-sso-config-profile-role.awsapps.com/start",
613+
CustomCABundle: "/path/to/bundle.a",
604614
},
605615
},
606616
"merged profiles across credentials files": {
@@ -611,6 +621,11 @@ func TestNewSharedConfig(t *testing.T) {
611621
Profile: "merged_profiles",
612622
RoleARN: "creds_profile_arn",
613623
RoleDurationSeconds: aws.Duration(1023 * time.Second),
624+
SSOAccountID: "0123456789",
625+
SSORegion: "us-west-2",
626+
SSORoleName: "CredProfileRole",
627+
SSOStartURL: "https://my-sso-cred-profile-role.awsapps.com/start",
628+
CustomCABundle: "/path/to/bundle.b",
614629
},
615630
},
616631
}

config/testdata/shared_config

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ duration_seconds = 3601
1919
[profile merged_profiles]
2020
duration_seconds = 3601
2121
role_arn = config_profile_arn
22+
sso_start_url = https://my-sso-config-profile-role.awsapps.com/start
23+
sso_region = us-east-1
24+
sso_account_id = 1234567890
25+
sso_role_name = ConfigProfileRole
26+
ca_bundle = /path/to/bundle.a
2227

2328
[profile short_profile_name_first]
2429
region = short_profile_name_first_short

config/testdata/shared_credentials

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ region = eu-west-3
2222
[merged_profiles]
2323
duration_seconds = 1023
2424
role_arn = creds_profile_arn
25+
sso_start_url = https://my-sso-cred-profile-role.awsapps.com/start
26+
sso_region = us-west-2
27+
sso_account_id = 0123456789
28+
sso_role_name = CredProfileRole
29+
ca_bundle = /path/to/bundle.b

0 commit comments

Comments
 (0)