@ThreadSafe public class STSAssumeRoleSessionCredentialsProvider extends Object implements AWSSessionCredentialsProvider, Closeable
close() method when the credentials provider is no longer used. You can also specify a custom ExecutorService
to refresh the credentials. See STSAssumeRoleSessionCredentialsProvider.Builder.withAsyncRefreshExecutor(java.util.concurrent.ExecutorService). Note that the custom executor service must be shut
down when it is ready to be disposed. The SDK will not close it when the credential provider is closed.| Modifier and Type | Class and Description |
|---|---|
static class |
STSAssumeRoleSessionCredentialsProvider.Builder
Provides a builder pattern to avoid combinatorial explosion of the number of parameters that
are passed to constructors.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_DURATION_SECONDS
Default duration for started sessions.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Shut down this credentials provider, shutting down the thread that performs asynchronous credential refreshing.
|
AWSSessionCredentials |
getCredentials()
Returns AWSCredentials which the caller can use to authorize an AWS request.
|
void |
refresh()
Forces this credentials provider to refresh its credentials.
|
void |
setSTSClientEndpoint(String endpoint)
Deprecated.
This method may be removed in a future major version. Create multiple providers
if you need to work with multiple STS endpoints.
|
public static final int DEFAULT_DURATION_SECONDS
@Deprecated public STSAssumeRoleSessionCredentialsProvider(String roleArn, String roleSessionName)
STSAssumeRoleSessionCredentialsProvider.Builder instead.roleArn to assume a role and then
request short lived session credentials, which will then be returned by this class's getCredentials() method.roleArn - The ARN of the Role to be assumed.roleSessionName - An identifier for the assumed role session.@Deprecated public STSAssumeRoleSessionCredentialsProvider(AWSCredentials longLivedCredentials, String roleArn, String roleSessionName)
STSAssumeRoleSessionCredentialsProvider.Builder instead.roleArn to assume a role and then request short lived session credentials,
which will then be returned by this class's getCredentials() method.longLivedCredentials - The main AWS credentials for a user's account.roleArn - The ARN of the Role to be assumed.roleSessionName - An identifier for the assumed role session.@Deprecated public STSAssumeRoleSessionCredentialsProvider(AWSCredentials longLivedCredentials, String roleArn, String roleSessionName, ClientConfiguration clientConfiguration)
STSAssumeRoleSessionCredentialsProvider.Builder instead.roleArn to assume a role and then request short lived session credentials,
which will then be returned by this class's getCredentials() method.longLivedCredentials - The main AWS credentials for a user's account.roleArn - The ARN of the Role to be assumed.roleSessionName - An identifier for the assumed role session.clientConfiguration - Client configuration connection parameters.@Deprecated public STSAssumeRoleSessionCredentialsProvider(AWSCredentialsProvider longLivedCredentialsProvider, String roleArn, String roleSessionName)
STSAssumeRoleSessionCredentialsProvider.Builder instead.roleArn to assume a role and then
request short lived session credentials, which will then be returned by this class's getCredentials() method.longLivedCredentialsProvider - Credentials provider for the main AWS credentials for a
user's account.roleArn - The ARN of the Role to be assumed.roleSessionName - An identifier for the assumed role session.@Deprecated public STSAssumeRoleSessionCredentialsProvider(AWSCredentialsProvider longLivedCredentialsProvider, String roleArn, String roleSessionName, ClientConfiguration clientConfiguration)
STSAssumeRoleSessionCredentialsProvider.Builder instead.roleArn to assume a role and then
request short lived session credentials, which will then be returned by this class's getCredentials() method.longLivedCredentialsProvider - Credentials provider for the main AWS credentials for a
user's account.roleArn - The ARN of the Role to be assumed.roleSessionName - An identifier for the assumed role session.clientConfiguration - Client configuration connection parameters.@Deprecated public void setSTSClientEndpoint(String endpoint)
public AWSSessionCredentials getCredentials()
AWSCredentialsProvidergetCredentials in interface AWSCredentialsProvidergetCredentials in interface AWSSessionCredentialsProviderpublic void refresh()
AWSCredentialsProviderrefresh in interface AWSCredentialsProviderpublic void close()
close in interface Closeableclose in interface AutoCloseable