LoginCredentialsProvider
CredentialsProvider that uses AWS Login to source credentials.
The provider does not initiate or perform the AWS Login flow. It is expected that you have already performed the login flow using the AWS CLI (aws login). The provider expects a valid non-expired access token for the AWS Login session in ~/.aws/login/cache or the directory specified by the AWS_LOGIN_CACHE_DIRECTORY environment variable. If a cached token is not found, is expired, or the file is malformed an exception will be thrown.
Instantiating AWS Login provider directly
You can programmatically construct the AWS Login provider in your application, and provide the necessary information to load and retrieve temporary credentials using an access token from ~/.aws/login/cache or the directory specified by the AWS_LOGIN_CACHE_DIRECTORY environment variable.
// Wrap the provider with a caching provider to cache the credentials until their expiration time
val loginProvider = LoginCredentialsProvider(
loginSession = "my-login-session"
).cached()It is important that you wrap the provider with CachedCredentialsProvider if you are programmatically constructing the provider directly. This prevents your application from accessing the cached access token and requesting new credentials each time the provider is used to source credentials.
Parameters
The Login Session from the profile
The AWS region used to call the log in service.
The HttpClientEngine instance to use to make requests. NOTE: This engine's resources and lifetime are NOT managed by the provider. Caller is responsible for closing.
The platform provider
The source of time for the provider