Skip to content

Commit

Permalink
z
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc committed Jul 3, 2023
1 parent 383b87b commit 5238195
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/aws/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ impl Loader {
Some(region) => region,
None => return Ok(Some(cred)),
};
let endpoint = self.sts_endpoint()?;
let endpoint = self.sts_endpoint(true)?;

let signer = Signer::new("sts", region);
// let signer = Signer::new("sts", DEFAULT_STS_REGION);
Expand Down Expand Up @@ -333,7 +333,7 @@ impl Loader {
let token = fs::read_to_string(token_file)?;
let role_session_name = &self.config.role_session_name;

let endpoint = self.sts_endpoint()?;
let endpoint = self.sts_endpoint(self.config.sts_regional_endpoints == "regional")?;

// Construct request to AWS STS Service.
let url = format!("https://{endpoint}/?Action=AssumeRoleWithWebIdentity&RoleArn={role_arn}&WebIdentityToken={token}&Version=2011-06-15&RoleSessionName={role_session_name}");
Expand Down Expand Up @@ -371,9 +371,9 @@ impl Loader {
/// We can check them by region name.
///
/// ref: https://github.com/awslabs/aws-sdk-rust/blob/31cfae2cf23be0c68a47357070dea1aee9227e3a/sdk/sts/src/aws_endpoint.rs
fn sts_endpoint(&self) -> Result<String> {
fn sts_endpoint(&self, regional: bool) -> Result<String> {
// use regional sts if sts_regional_endpoints has been set.
if self.config.sts_regional_endpoints == "regional" {
if regional {
let region = self.config.region.clone().ok_or_else(|| {
anyhow!("sts_regional_endpoints set to reginal, but region is not set")
})?;
Expand Down

1 comment on commit 5238195

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for reqsign ready!

✅ Preview
https://reqsign-6n0miq1s3-xuanwo.vercel.app

Built with commit 5238195.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.