Skip to content

Commit

Permalink
Correct AssumedRoleUser location
Browse files Browse the repository at this point in the history
  • Loading branch information
omus committed Mar 29, 2021
1 parent 651fd55 commit f1558ea
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/AWSCredentials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,13 @@ function credentials_from_webtoken()
)

role_creds = resp["AssumeRoleWithWebIdentityResult"]["Credentials"]
assumed_role_user = resp["AssumeRoleWithWebIdentityResult"]["AssumedRoleUser"]

return AWSCredentials(
role_creds["AccessKeyId"],
role_creds["SecretAccessKey"],
role_creds["SessionToken"],
role_creds["AssumedRoleUser"]["Arn"];
assumed_role_user["Arn"];
expiry=DateTime(rstrip(role_creds["Expiration"], 'Z')),
renew=credentials_from_webtoken
)
Expand Down
10 changes: 8 additions & 2 deletions test/patch.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,16 @@ _web_identity_patch = function (;
"SecretAccessKey" => secret_key,
"SessionToken" => session_token,
"Expiration" => string(now(UTC)),
"AssumedRoleUser" => Dict("Arn" => role_arn * "/" * params["RoleSessionName"]),
)

result = Dict("AssumeRoleWithWebIdentityResult" => Dict("Credentials" => creds))
result = Dict(
"AssumeRoleWithWebIdentityResult" => Dict(
"Credentials" => creds,
"AssumedRoleUser" => Dict(
"Arn" => role_arn * "/" * params["RoleSessionName"],
),
),
)

return HTTP.Response(200, ["Content-Type" => "text/json", "charset" => "utf-8"], body=json(result))
end
Expand Down

0 comments on commit f1558ea

Please sign in to comment.