Example usage for com.amazonaws.auth STSAssumeRoleSessionCredentialsProvider STSAssumeRoleSessionCredentialsProvider

List of usage examples for com.amazonaws.auth STSAssumeRoleSessionCredentialsProvider STSAssumeRoleSessionCredentialsProvider

Introduction

In this page you can find the example usage for com.amazonaws.auth STSAssumeRoleSessionCredentialsProvider STSAssumeRoleSessionCredentialsProvider.

Prototype

@Deprecated
public STSAssumeRoleSessionCredentialsProvider(AWSCredentialsProvider longLivedCredentialsProvider,
        String roleArn, String roleSessionName, ClientConfiguration clientConfiguration) 

Source Link

Document

Constructs a new STSAssumeRoleSessionCredentialsProvider, which will use the specified credentials provider (which vends long lived AWS credentials) to make a request to the AWS Security Token Service (STS), uses the provided #roleArn to assume a role and then request short lived session credentials, which will then be returned by this class's #getCredentials() method.

Usage

From source file:lumbermill.internal.aws.KinesisClientFactory.java

License:Apache License

private AWSCredentialsProvider getAwsCredentialsProvider(MapWrap configuration, ClientConfiguration awsConfig) {
    AWSCredentialsProvider credentials = new DefaultAWSCredentialsProviderChain();
    Optional<String> roleArn = configuration.exists("role_arn")
            ? Optional.of(configuration.asString("role_arn"))
            : Optional.empty();//w ww. j a  v a 2  s. c o  m
    if (roleArn.isPresent()) {
        credentials = new STSAssumeRoleSessionCredentialsProvider(credentials, roleArn.get(), "lumbermill",
                awsConfig);
    }
    return credentials;
}

From source file:lumbermill.internal.aws.S3ClientImpl.java

License:Apache License

public void init() {
    ClientConfiguration awsConfig = new ClientConfiguration();
    if (System.getenv("https_proxy") != null) {
        URI proxy = URI.create(System.getenv("https_proxy"));
        awsConfig.setProxyHost(proxy.getHost());
        awsConfig.setProxyPort(proxy.getPort());
    }//w  ww  .j  a  v a 2s.c o  m

    //awsConfig.setConnectionTimeout(2000);
    //awsConfig.setRequestTimeout(2000);
    //awsConfig.setSocketTimeout(2000);
    //awsConfig.setClientExecutionTimeout(2000);

    AWSCredentialsProvider credentials = new DefaultAWSCredentialsProviderChain();
    if (roleArn.isPresent()) {
        credentials = new STSAssumeRoleSessionCredentialsProvider(credentials, roleArn.get(), "lumbermills3",
                awsConfig);
    }
    s3Client = new AmazonS3Client(credentials, awsConfig);

}