Example usage for com.amazonaws.services.securitytoken.model AssumeRoleRequest getDurationSeconds

List of usage examples for com.amazonaws.services.securitytoken.model AssumeRoleRequest getDurationSeconds

Introduction

In this page you can find the example usage for com.amazonaws.services.securitytoken.model AssumeRoleRequest getDurationSeconds.

Prototype


public Integer getDurationSeconds() 

Source Link

Document

The duration, in seconds, of the role session.

Usage

From source file:org.finra.dm.dao.impl.MockStsOperationsImpl.java

License:Apache License

@Override
public AssumeRoleResult assumeRole(AWSSecurityTokenServiceClient awsSecurityTokenServiceClient,
        AssumeRoleRequest assumeRoleRequest) {
    assertNotNull(assumeRoleRequest);// w  w w  .j a v  a 2 s  .com

    if (assumeRoleRequest.getPolicy() != null
            && assumeRoleRequest.getPolicy().equals(MockAwsOperationsHelper.AMAZON_THROTTLING_EXCEPTION)) {
        AmazonServiceException throttlingException = new AmazonServiceException("test throttling exception");
        throttlingException.setErrorCode("ThrottlingException");

        throw throttlingException;
    }

    AssumeRoleResult assumeRoleResult = new AssumeRoleResult();

    assumeRoleResult.setCredentials(new Credentials(MOCK_AWS_ASSUMED_ROLE_ACCESS_KEY,
            MOCK_AWS_ASSUMED_ROLE_SECRET_KEY, MOCK_AWS_ASSUMED_ROLE_SESSION_TOKEN,
            new Date(System.currentTimeMillis() + 1000 * assumeRoleRequest.getDurationSeconds())));

    return assumeRoleResult;
}