Skip to content

Commit

Permalink
Merge pull request #131 from kangaechu/respect-sts-regional-endpoints
Browse files Browse the repository at this point in the history
RUN-2824: Respect the AWS_STS_REGIONAL_ENDPOINTS parameter
  • Loading branch information
gschueler authored Oct 22, 2024
2 parents 9e89b50 + 52ca6cd commit 2116eb9
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

import com.amazonaws.auth.*;
import com.amazonaws.ClientConfiguration;
import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClient;
import com.amazonaws.services.securitytoken.AWSSecurityTokenService;
import com.amazonaws.services.securitytoken.AWSSecurityTokenServiceClientBuilder;
import com.amazonaws.services.securitytoken.model.*;
import com.dtolabs.rundeck.core.common.*;
import com.dtolabs.rundeck.core.plugins.configuration.ConfigurationException;
Expand Down Expand Up @@ -248,14 +249,18 @@ private void initialize() {
}

private AWSCredentials createAwsCredentials(AWSCredentialsProvider provider, String assumeRoleArn, String externalId) {
AWSSecurityTokenServiceClient sts_client;
AWSSecurityTokenService sts_client;

if (provider != null) {
sts_client = new AWSSecurityTokenServiceClient(provider, clientConfiguration);
sts_client = AWSSecurityTokenServiceClientBuilder.standard()
.withCredentials(provider)
.withClientConfiguration(clientConfiguration)
.build();
} else {
sts_client = new AWSSecurityTokenServiceClient(clientConfiguration);
sts_client = AWSSecurityTokenServiceClientBuilder.standard()
.withClientConfiguration(clientConfiguration)
.build();
}
// sts_client.setEndpoint("sts-endpoint.amazonaws.com");
AssumeRoleRequest assumeRoleRequest = new AssumeRoleRequest();
assumeRoleRequest.setRoleArn(assumeRoleArn);
if(externalId!=null){
Expand Down

0 comments on commit 2116eb9

Please sign in to comment.