public virtual async Task RemoveClaimsAsync()

in src/Amazon.AspNetCore.Identity.Cognito/CognitoUserStore/CognitoUserStore.IUserClaimStore.cs [121:156]


        public virtual async Task RemoveClaimsAsync(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));
            }

            var userClaims = await GetClaimsAsync(user, cancellationToken).ConfigureAwait(false);

            // Only removes the claims that the user actually have.
            var matchedClaims = userClaims?.Select(claim => new { claim.Type, claim.Value })
                                            .Intersect(claims.Select(claim => new { claim.Type, claim.Value }));

            if (matchedClaims != null && matchedClaims.Any())
            {
                try
                {
                    await _cognitoClient.AdminDeleteUserAttributesAsync(new AdminDeleteUserAttributesRequest
                    {
                        UserAttributeNames = matchedClaims.Select(claim => claim.Type).ToList(),
                        Username = user.Username,
                        UserPoolId = _pool.PoolID
                    }, cancellationToken).ConfigureAwait(false);
                }
                catch (AmazonCognitoIdentityProviderException e)
                {
                    throw new CognitoServiceException("Failed to remove a claim from the Cognito User", e);
                }
            }
        }