Class StaticCredentialsProvider
- Namespace
- DynaSharp.Credentials
- Assembly
- DynaSharp.dll
Always supplies the same credentials. Use for long-term keys, tests and DynamoDB Local.
public sealed class StaticCredentialsProvider : ICredentialsProvider
- Inheritance
-
StaticCredentialsProvider
- Implements
- Inherited Members
Constructors
StaticCredentialsProvider(AwsCredentials)
Always supplies the same credentials. Use for long-term keys, tests and DynamoDB Local.
public StaticCredentialsProvider(AwsCredentials credentials)
Parameters
credentialsAwsCredentialsThe credentials to supply.
StaticCredentialsProvider(string, string, string?)
Initializes a new instance of the StaticCredentialsProvider class from the parts of the credentials, for the common case of a key pair that is not temporary or whose token comes from a configuration source.
public StaticCredentialsProvider(string accessKeyId, string secretAccessKey, string? sessionToken = null)
Parameters
accessKeyIdstringThe access key id, for example
AKIAIOSFODNN7EXAMPLE.secretAccessKeystringThe secret access key.
sessionTokenstringThe session token of temporary credentials, or null for long-term keys. This provider never refreshes: temporary credentials stop working when they expire.
Exceptions
- ArgumentException
accessKeyIdorsecretAccessKeyis null or empty.
Methods
GetCredentialsAsync(CancellationToken)
Gets the current credentials.
public ValueTask<AwsCredentials> GetCredentialsAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenCancels a pending credential lookup.
Returns
- ValueTask<AwsCredentials>
The credentials.
Exceptions
- CredentialsUnavailableException
No credentials can be found.