TCognitoAWSCredentials
Class in AWS.CognitoIdentity
Cognito AWS Credentials provider.
The TCognitoAWSCredentials provider can be passed to any IAWSOptions as Credentials. Use AddLogin to add identity tokens issued by configured identity providers. To reset to unauthenticated credentials, you can use ClearLogins. If no logins are added, and the Cognito Identity Pool is configured to allow unauthenticated identities, credentials for unauthenticated access will be resolved.
Here is an example of an ITranslateClient being configured to use federated identity credentials.
var
CognitoCredentials: ICognitoAWSCredentials;
TranslateOptions: ITranslateOptions;
TranslateClient: ITranslateClient;
begin
CognitoCredentials := TCognitoAWSCredentials.Create(
'<region>:<identity pool id>',
'<region>'
);
TranslateOptions := TTranslateOptions.Create;
TranslateOptions.Credentials := CognitoCredentials;
TranslateClient := TTranslateClient.Create(TranslateOptions);
var Response := TranslateClient.TranslateText('en', 'fr', 'Hello');
end;
Ancestors
IAWSCredentialsProvider- ICognitoAWSCredentials
Properties
Logins
property Logins: TDictionary<string, string>
CredentialsDurationSeconds
property CredentialsDurationSeconds: TOptional<Integer>
Credentials
property Credentials: IAWSCredentials
IdentityId
property IdentityId: string
IsAvailable
property IsAvailable: Boolean
Constructors
Create
constructor Create(const AIdentityPoolId, ARegion: string); overload;
Constructor for TCognitoAWSCredentials.
Parameters
| Name | Description |
|---|---|
AIdentityPoolId | Specify the ID of your Cognito Identity Pool in the format. |
ARegion | Specify AWS region to perform requests against. |
constructor Create(const AAccountId, AIdentityPoolId: string; const AUnauthenticatedRoleARN, AAuthenticatedRoleARN: TARN; const ARegion: string); overload;
Constructor for TCognitoAWSCredentials.
Parameters
| Name | Description |
|---|---|
AAccountId | Specify your AWS account ID (9+ digits). |
AIdentityPoolId | Specify the ID of your Cognito Identity Pool in the format. |
AUnauthenticatedRoleARN | Specify the Amazon Resource Name (ARN) of an IAM role providing unauthenticated access. |
AAuthenticatedRoleARN | Specify the Amazon Resource Name (ARN) of an IAM role providing authenticated access. |
ARegion | Specify AWS region to perform requests against. |
constructor Create(const AAccountId, AIdentityPoolId: string; const AUnauthenticatedRoleARN, AAuthenticatedRoleARN: TARN; const ACognitoIdentityClient: ICognitoIdentityClient; const ASTSClient: ISTSClient); overload;
ICognitoIdentityClient · ISTSClient
Constructor for TCognitoAWSCredentials.
Parameters
| Name | Description |
|---|---|
AAccountId | Specify your AWS account ID (9+ digits). |
AIdentityPoolId | Specify the ID of your Cognito Identity Pool in the format. |
AUnauthenticatedRoleARN | Specify the Amazon Resource Name (ARN) of an IAM role providing unauthenticated access. |
AAuthenticatedRoleARN | Specify the Amazon Resource Name (ARN) of an IAM role providing authenticated access. |
ACognitoIdentityClient | Provide a Cognitio Identity client configured for making requests. |
ASTSClient | Provide a Simple Token Service client configured for making requests. |