Table of Contents

Interface IRefreshableCredentialsProvider

Namespace
DynaSharp.Credentials
Assembly
DynaSharp.dll

A credentials provider that can let go of credentials the service has rejected, so that the next GetCredentialsAsync(CancellationToken) gets other ones. An optional capability: a provider that does not implement it keeps working, and the client passes the rejection on to the caller.

public interface IRefreshableCredentialsProvider : ICredentialsProvider
Inherited Members

Remarks

DynamoDB can consider credentials expired while Expiration says that they are valid, for example when the local clock is behind, when a session was revoked, or when the source renews them late. If a response says so (ExpiredTokenException), a client calls TryInvalidate(AwsCredentials) with the credentials of that request. If it returns true, the client sends the request once more, looking up the credentials again, so a failing lookup surfaces as its own exception. See MaxAttempts for how that resend counts.

Implementations must be thread-safe and must not do any input or output here: the fetch belongs in GetCredentialsAsync(CancellationToken), where the concurrent requests can share it and where the caller's cancellation and the attempt timeout apply. Many requests in flight fail with the same credentials, one after the other, so compare rejected with what is held by reference and do nothing if it differs: those credentials were already replaced, and dropping the newer ones would fetch again for nothing.

Methods

TryInvalidate(AwsCredentials)

Drops the given credentials if the provider still holds them, so that the next lookup does not return them.

bool TryInvalidate(AwsCredentials rejected)

Parameters

rejected AwsCredentials

The instance the rejected request was signed with, which GetCredentialsAsync(CancellationToken) returned.

Returns

bool

true if the next lookup can return other credentials, which includes that it already does. false if this provider has nothing else to offer, so that sending the request again is pointless.

Exceptions

ArgumentNullException

rejected is null.