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(String roleArn, String roleSessionName) 

Source Link

Document

Constructs a new STSAssumeRoleSessionCredentialsProvider, which makes 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:com.netflix.genie.web.configs.aws.AwsS3Config.java

License:Apache License

/**
 * Assume role credentials provider which will be used to fetch session credentials.
 *
 * @param roleArn Arn of the IAM role//from  ww w .j a  v a 2  s .c  om
 * @return Credentials provider to ask the credentials from
 */
@Bean
@ConditionalOnProperty(value = "genie.aws.credentials.role")
public STSAssumeRoleSessionCredentialsProvider awsCredentialsProvider(
        @Value("${genie.aws.credentials.role}") final String roleArn) {
    log.info("Creating STS Assume Role Session Credentials provider bean");
    return new STSAssumeRoleSessionCredentialsProvider(roleArn, "Genie");
}

From source file:org.zalando.stups.fullstop.aws.CachingClientProvider.java

License:Apache License

@PostConstruct
public void init() {

    // TODO//from  ww w  .j  a v  a 2s  .  c o  m
    // this parameters have to be configurable
    cache = CacheBuilder.newBuilder().maximumSize(500).expireAfterWrite(50, TimeUnit.MINUTES)
            .build(new CacheLoader<Key<?>, Object>() {
                private final Logger logger = LoggerFactory.getLogger(CacheLoader.class);

                @Override
                public Object load(final Key<?> key) throws Exception {
                    logger.debug("CacheLoader active for Key : {}", key);

                    Object client = key.region.createClient(key.type,
                            new STSAssumeRoleSessionCredentialsProvider(buildRoleArn(key.accountId),
                                    ROLE_SESSION_NAME),
                            null);
                    return client;
                }
            });
}