Skip to content

Commit 7b09eb1

Browse files
authored
Improve exception when IAM Identity Center auth is used (#629)
* Improve exception when IAM Identity Center auth is used * Formatting * Set project version to 1.87.1
1 parent 1688679 commit 7b09eb1

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "AWS"
22
uuid = "fbe9abb3-538b-5e4e-ba9e-bc94f4f92ebc"
33
license = "MIT"
4-
version = "1.87.0"
4+
version = "1.87.1"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"

src/AWSCredentials.jl

+11
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,17 @@ function sso_credentials(profile=nothing)
462462
settings = _aws_profile_config(ini, p)
463463
isempty(settings) && return nothing
464464

465+
# AWS IAM Identity Center authentication is not yet supported in AWS.jl
466+
sso_session = get(settings, "sso_session", nothing)
467+
if !isnothing(sso_session)
468+
error(
469+
"IAM Identity Center authentication is not yet supported by AWS.jl. " *
470+
"See https://github.com/JuliaCloud/AWS.jl/issues/628",
471+
)
472+
end
473+
474+
# Legacy SSO configuration
475+
# https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-legacy.html#sso-configure-profile-manual
465476
sso_start_url = get(settings, "sso_start_url", nothing)
466477

467478
if !isnothing(sso_start_url)

test/AWSCredentials.jl

+23
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,29 @@ end
576576
end
577577
end
578578

579+
# TODO: Additional, precedence tests should be added for IAM Identity Center
580+
# once support has been introduced.
581+
@testset "IAM Identity Center preferred over legacy SSO" begin
582+
write(
583+
config_file,
584+
"""
585+
[sso-session my-sso]
586+
sso_region = us-east-1
587+
sso_start_url = https://my-sso-portal.awsapps.com/start
588+
589+
[default]
590+
sso_session = my-sso
591+
sso_start_url = https://my-legacy-sso-portal.awsapps.com/start
592+
sso_role_name = role1
593+
""",
594+
)
595+
isfile(creds_file) && rm(creds_file)
596+
597+
apply(Patches.sso_service_patches("AKI_SSO", "SAK_SSO")) do
598+
@test_throws ErrorException AWSCredentials()
599+
end
600+
end
601+
579602
@testset "SSO preferred over credentials file" begin
580603
write(
581604
config_file,

0 commit comments

Comments
 (0)