Skip to main content

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

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

NameDescription
AIdentityPoolIdSpecify the ID of your Cognito Identity Pool in the format.
ARegionSpecify AWS region to perform requests against.

constructor Create(const AAccountId, AIdentityPoolId: string; const AUnauthenticatedRoleARN, AAuthenticatedRoleARN: TARN; const ARegion: string); overload;

Constructor for TCognitoAWSCredentials.

Parameters

NameDescription
AAccountIdSpecify your AWS account ID (9+ digits).
AIdentityPoolIdSpecify the ID of your Cognito Identity Pool in the format.
AUnauthenticatedRoleARNSpecify the Amazon Resource Name (ARN) of an IAM role providing unauthenticated access.
AAuthenticatedRoleARNSpecify the Amazon Resource Name (ARN) of an IAM role providing authenticated access.
ARegionSpecify 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

NameDescription
AAccountIdSpecify your AWS account ID (9+ digits).
AIdentityPoolIdSpecify the ID of your Cognito Identity Pool in the format.
AUnauthenticatedRoleARNSpecify the Amazon Resource Name (ARN) of an IAM role providing unauthenticated access.
AAuthenticatedRoleARNSpecify the Amazon Resource Name (ARN) of an IAM role providing authenticated access.
ACognitoIdentityClientProvide a Cognitio Identity client configured for making requests.
ASTSClientProvide a Simple Token Service client configured for making requests.