AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

.NET Framework 3.5
 
Temporary, short-lived session credentials that are automatically retrieved from Amazon Cognito Identity Service and AWS Security Token Service. Depending on configured Logins, credentials may be authenticated or unauthenticated.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AWSCredentials
    Amazon.Runtime.RefreshingAWSCredentials
      Amazon.CognitoIdentity.CognitoAWSCredentials

Namespace: Amazon.CognitoIdentity
Assembly: AWSSDK.dll
Version: (assembly version)

Syntax

C#
public class CognitoAWSCredentials : RefreshingAWSCredentials

The CognitoAWSCredentials type exposes the following members

Constructors

NameDescription
Public Method CognitoAWSCredentials(string, RegionEndpoint) Constructs a new CognitoAWSCredentials instance, which will use the specified Amazon Cognito identity pool to get short lived session credentials.
Public Method CognitoAWSCredentials(string, string, string, string, RegionEndpoint) Constructs a new CognitoAWSCredentials instance, which will use the specified Amazon Cognito identity pool to make a requests to the AWS Security Token Service (STS) to request short lived session credentials.
Public Method CognitoAWSCredentials(string, string, string, string, IAmazonCognitoIdentity, IAmazonSecurityTokenService) Constructs a new CognitoAWSCredentials instance, which will use the specified Amazon Cognito identity pool to make a requests to the AWS Security Token Service (STS) to request short lived session credentials.

Properties

NameTypeDescription
Public Property AccountId System.String The AWS accountId for the account with Amazon Cognito
Public Property AuthRoleArn System.String The ARN of the IAM Role that will be assumed when authenticated
Public Property CurrentLoginProviders System.String[] The list of current providers that are used for authenticated credentials.
Public Property IdentityPoolId System.String The Amazon Cogntio identity pool to use
Public Property PreemptExpiryTime System.TimeSpan Inherited from Amazon.Runtime.RefreshingAWSCredentials.
Public Property UnAuthRoleArn System.String The ARN of the IAM Role that will be assumed when unauthenticated

Methods

NameDescription
Public Method AddLogin(string, string) Adds a login to be used for authenticated requests.
Public Method CacheIdentityId(string) Caches the identity id retrieved from Cognito.

For the Windows Phone and Windows Store version of the SDK the identity id is stored in the Windows.Storage.ApplicationData.Current.LocalSettings or Windows.Storage.ApplicationData.Current.RoamingSettings depending on the IdentityIdCacheMode property.

For the base .NET 3.5 and .NET 4.5 version of the SDK the identity id is not cached. To support caching the CacheIdentityId, GetCachedIdentityId and ClearIdentityCache methods need to be overridden.

Public Method Clear() Clears current credentials state. This will reset the IdentityId.
Public Method ClearIdentityCache() Clears the currently identity id from the cache.

For the base .NET 3.5 and .NET 4.5 version of the SDK the identity id is not cached. To support caching the CacheIdentityId, GetCachedIdentityId and ClearIdentityCache methods need to be overridden.

Public Method GetCachedIdentityId() Gets the previously cached the identity id retrieved from Cognito.

For the Windows Phone and Windows Store version of the SDK the identity id is stored in the Windows.Storage.ApplicationData.Current.LocalSettings or Windows.Storage.ApplicationData.Current.RoamingSettings depending on the IdentityIdCacheMode property. By default IdentityIdCacheMode will be set LocalSettings.

For the base .NET 3.5 and .NET 4.5 version of the SDK the identity id is not cached. To support caching the CacheIdentityId, GetCachedIdentityId and ClearIdentityCache methods need to be overridden.

Public Method GetCredentials() Inherited from Amazon.Runtime.RefreshingAWSCredentials.
Public Method GetIdentityId() Gets the Identity Id corresponding to the credentials retrieved from Cognito. Note: this setting may change during execution. To be notified of its new value, attach a listener to IdentityChangedEvent
Public Method RemoveLogin(string) Removes a provider from the collection of logins.

Events

NameDescription
Event IdentityChangedEvent Event for identity change notifications. This event will fire whenever the Identity Id changes.

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8

.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8