public class ContainerCredentialsProvider extends Object implements AWSCredentialsProvider
AWSCredentialsProvider
implementation that loads credentials from a local metadata service.
The URI path is retrieved from the environment variable "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" or
"AWS_CONTAINER_CREDENTIALS_FULL_URI" in the container's environment. Resolving to use relative or absolute path
is the role of EC2ContainerCredentialsProviderWrapper
.
Full (absolute) URI configuration
For absolute paths, only loopback hosts are allowed when using HTTP, including known endpoints for ECS and EKS. All HTTPS endpoints are allowed.
IPv6 addresses are supported when setting the "AWS_EC2_METADATA_SERVICE_ENDPOINT_MODE" environment variable.
Optionally, an authorization token can be included in the "Authorization" header of the request. There are two ways of providing the token, in order of priority:
Migrating to the AWS SDK for Java v2
The v2 equivalent of this class is ContainerCredentialsProvider
See Migration Guide for more information.
Constructor and Description |
---|
ContainerCredentialsProvider()
Deprecated.
|
ContainerCredentialsProvider(CredentialsEndpointProvider credentialsEndpointProvider) |
Modifier and Type | Method and Description |
---|---|
AWSCredentials |
getCredentials()
Returns AWSCredentials which the caller can use to authorize an AWS request.
|
Date |
getCredentialsExpiration() |
void |
refresh()
Forces this credentials provider to refresh its credentials.
|
@Deprecated public ContainerCredentialsProvider()
ContainerCredentialsProvider(CredentialsEndpointProvider)
public ContainerCredentialsProvider(CredentialsEndpointProvider credentialsEndpointProvider)
public AWSCredentials getCredentials()
AWSCredentialsProvider
getCredentials
in interface AWSCredentialsProvider
public void refresh()
AWSCredentialsProvider
refresh
in interface AWSCredentialsProvider
public Date getCredentialsExpiration()