@ThreadSafe public class STSSessionCredentialsProvider extends Object implements AWSSessionCredentialsProvider, Closeable
close()
method when the credentials provider is no longer used.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_DURATION_SECONDS
Default duration for started sessions
|
Constructor and Description |
---|
STSSessionCredentialsProvider(AWSCredentials longLivedCredentials)
Constructs a new STSSessionCredentialsProvider, which will use the specified long lived AWS
credentials to make a request to the AWS Security Token Service (STS) to request short lived
session credentials, which will then be returned by this class's
getCredentials()
method. |
STSSessionCredentialsProvider(AWSCredentials longLivedCredentials,
ClientConfiguration clientConfiguration)
Constructs a new STSSessionCredentialsProvider, which will use the specified long lived AWS
credentials to make a request to the AWS Security Token Service (STS) to request short lived
session credentials, which will then be returned by this class's
getCredentials()
method. |
STSSessionCredentialsProvider(AWSCredentialsProvider longLivedCredentialsProvider)
Constructs a new STSSessionCredentialsProvider, which will use the specified credentials
provider (which vends long lived AWS credentials) to make a request to the AWS Security Token
Service (STS) to request short lived session credentials, which will then be returned by this
class's
getCredentials() method. |
STSSessionCredentialsProvider(AWSCredentialsProvider longLivedCredentialsProvider,
ClientConfiguration clientConfiguration)
Constructs a new STSSessionCredentialsProvider, which will use the specified credentials
provider (which vends long lived AWS credentials) to make a request to the AWS Security Token
Service (STS) to request short lived session credentials, which will then be returned by this
class's
getCredentials() method. |
STSSessionCredentialsProvider(AWSSecurityTokenService sts)
Constructs a new STSSessionCredentialsProvider with the alredy configured STS client.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Shut down this credentials provider, shutting down the thread that performs asynchronous credential refreshing.
|
AWSSessionCredentials |
getCredentials()
Method will return valid session credentials or throw an AmazonClientException due to STS
service time-out or thread interruption.
|
void |
refresh()
Force refresh of session 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
public STSSessionCredentialsProvider(AWSCredentials longLivedCredentials)
getCredentials()
method.longLivedCredentials
- The main AWS credentials for a user's account.public STSSessionCredentialsProvider(AWSCredentials longLivedCredentials, ClientConfiguration clientConfiguration)
getCredentials()
method.longLivedCredentials
- The main AWS credentials for a user's account.clientConfiguration
- Client configuration connection parameters.public STSSessionCredentialsProvider(AWSCredentialsProvider longLivedCredentialsProvider)
getCredentials()
method.longLivedCredentialsProvider
- Credentials provider for the main AWS credentials for a
user's account.public STSSessionCredentialsProvider(AWSCredentialsProvider longLivedCredentialsProvider, ClientConfiguration clientConfiguration)
getCredentials()
method.longLivedCredentialsProvider
- Credentials provider for the main AWS credentials for a
user's account.clientConfiguration
- Client configuration connection parameters.public STSSessionCredentialsProvider(AWSSecurityTokenService sts)
sts
- Preconfigured STS client to use for this provider@Deprecated public void setSTSClientEndpoint(String endpoint)
The default AWS Security Token Service (STS) endpoint ("sts.amazonaws.com") works for all accounts that are not for China (Beijing) region or GovCloud. You only need to change the endpoint to "sts.cn-north-1.amazonaws.com.cn" when you are requesting session credentials for services in China(Beijing) region or "sts.us-gov-west-1.amazonaws.com" for GovCloud.
Setting this invalidates existing session credentials. Calling this method will temporarily cause getCredentials() to block until a new session is fetched from the STS service.
public AWSSessionCredentials getCredentials()
getCredentials
in interface AWSCredentialsProvider
getCredentials
in interface AWSSessionCredentialsProvider
public void refresh()
refresh
in interface AWSCredentialsProvider
public void close()
close
in interface Closeable
close
in interface AutoCloseable
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.