in src/Amazon.AspNetCore.Identity.Cognito/CognitoUserStore/CognitoUserStore.IUserClaimStore.cs [70:99]
public virtual async Task AddClaimsAsync(TUser user, IEnumerable<Claim> claims, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
if (user == null)
{
throw new ArgumentNullException(nameof(user));
}
if (claims == null)
{
throw new ArgumentNullException(nameof(claims));
}
if (claims.Any())
{
try
{
await _cognitoClient.AdminUpdateUserAttributesAsync(new AdminUpdateUserAttributesRequest
{
UserAttributes = CreateAttributeList(claims.ToDictionary(claim => claim.Type, claim => claim.Value)),
Username = user.Username,
UserPoolId = _pool.PoolID
}, cancellationToken).ConfigureAwait(false);
}
catch (AmazonCognitoIdentityProviderException e)
{
throw new CognitoServiceException("Failed to add a claim to the Cognito User", e);
}
}
}