LoginCredentialsProvider

class LoginCredentialsProvider(val loginSession: String, val region: String? = null, val httpClient: HttpClientEngine? = null, val platformProvider: PlatformProvider = PlatformProvider.System, clock: Clock = Clock.System) : CloseableCredentialsProvider

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

loginSession

The Login Session from the profile

region

The AWS region used to call the log in service.

httpClient

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.

platformProvider

The platform provider

clock

The source of time for the provider

Constructors

Link copied to clipboard
constructor(loginSession: String, region: String? = null, httpClient: HttpClientEngine? = null, platformProvider: PlatformProvider = PlatformProvider.System, clock: Clock = Clock.System)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val region: String? = null

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override fun resolve(attributes: Attributes): Credentials