Skip to content

Commit

Permalink
Added session duration request when using getCredentials as the def…
Browse files Browse the repository at this point in the history
…ault was removed from the `createAssumeRoleRequest` method previously
  • Loading branch information
Nathan Dines committed Feb 16, 2019
1 parent 22b0a24 commit 492dc31
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class AWSCredentialsImpl extends BaseAmazonWebServicesCredentials impleme

private static final Logger LOGGER = Logger.getLogger(BaseAmazonWebServicesCredentials.class.getName());

private static final int STS_CREDENTIALS_DURATION_SECONDS = 3600;
public static final int STS_CREDENTIALS_DURATION_SECONDS = 3600;

private final String accessKey;

Expand Down Expand Up @@ -135,7 +135,8 @@ public AWSCredentials getCredentials() {
initialCredentials = (new InstanceProfileCredentialsProvider()).getCredentials();
}

AssumeRoleRequest assumeRequest = createAssumeRoleRequest(iamRoleArn);
AssumeRoleRequest assumeRequest = createAssumeRoleRequest(iamRoleArn)
.withDurationSeconds(stsTokenDuration);

AssumeRoleResult assumeResult = new AWSSecurityTokenServiceClient(initialCredentials).assumeRole(assumeRequest);

Expand Down

0 comments on commit 492dc31

Please sign in to comment.