@ThreadSafe public final class StsAssumeRoleCredentialsProvider extends Object
AwsCredentialsProvider
that periodically sends an AssumeRoleRequest
to the AWS
Security Token Service to maintain short-lived sessions to use for authentication. These sessions are updated asynchronously
in the background as they get close to expiring. If the credentials are not successfully updated asynchronously in the
background, calls to resolveCredentials()
will begin to block in an attempt to update the credentials synchronously.
This provider creates a thread in the background to periodically update credentials. If this provider is no longer needed,
the background thread can be shut down using close()
.
This is created using builder()
.Modifier and Type | Class and Description |
---|---|
static class |
StsAssumeRoleCredentialsProvider.Builder
A builder (created by
builder() ) for creating a
StsAssumeRoleCredentialsProvider . |
protected static class |
StsCredentialsProvider.BaseBuilder<B extends StsCredentialsProvider.BaseBuilder<B,T>,T>
Extended by child class's builders to share configuration across credential providers.
|
Modifier and Type | Method and Description |
---|---|
static StsAssumeRoleCredentialsProvider.Builder |
builder()
Create a builder for an
StsAssumeRoleCredentialsProvider . |
void |
close() |
protected Credentials |
getUpdatedCredentials(StsClient stsClient)
Implemented by a child class to call STS and get a new set of credentials to be used by this provider.
|
Duration |
prefetchTime()
The amount of time, relative to STS token expiration, that the cached credentials are considered close to stale
and should be updated.
|
AwsCredentials |
resolveCredentials() |
Duration |
staleTime()
The amount of time, relative to STS token expiration, that the cached credentials are considered stale and
should no longer be used.
|
String |
toString() |
public static StsAssumeRoleCredentialsProvider.Builder builder()
StsAssumeRoleCredentialsProvider
.protected Credentials getUpdatedCredentials(StsClient stsClient)
public AwsCredentials resolveCredentials()
resolveCredentials
in interface AwsCredentialsProvider
public void close()
close
in interface AutoCloseable
close
in interface SdkAutoCloseable
public Duration staleTime()
public Duration prefetchTime()
Copyright © 2022. All rights reserved.