public final class SsoCredentialsProvider extends Object implements AwsCredentialsProvider, SdkAutoCloseable
An implementation of AwsCredentialsProvider that is extended within this package to provide support for
periodically updating session credentials. This credential provider maintains a Supplier
for a SsoClient.getRoleCredentials(Consumer) call to retrieve the credentials needed.
While creating the GetRoleCredentialsRequest, an access token is needed to be resolved from a token file.
In default, the token is assumed unexpired, and if it's expired then an ExpiredTokenException will be thrown.
If the users want to change the behavior of this, please implement your own token resolving logic and override the
Builder#refreshRequest).
When credentials get close to expiration, this class will attempt to update them asynchronously. If the credentials end up expiring, this class will block all calls to {@link #resolveCredentials()} until the credentials can be updated.
| Modifier and Type | Class and Description |
|---|---|
static interface |
SsoCredentialsProvider.Builder
A builder for creating a custom
SsoCredentialsProvider. |
protected static class |
SsoCredentialsProvider.BuilderImpl |
| Modifier and Type | Method and Description |
|---|---|
static SsoCredentialsProvider.BuilderImpl |
builder()
Get a builder for creating a custom
SsoCredentialsProvider. |
void |
close() |
Duration |
prefetchTime()
The amount of time, relative to session 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 session token expiration, that the cached credentials are considered stale and
should no longer be used.
|
public Duration staleTime()
public Duration prefetchTime()
public static SsoCredentialsProvider.BuilderImpl builder()
SsoCredentialsProvider.public AwsCredentials resolveCredentials()
resolveCredentials in interface AwsCredentialsProviderpublic void close()
close in interface AutoCloseableclose in interface SdkAutoCloseableCopyright © 2020. All rights reserved.