private async Task SetAttributeValueAsync()

in src/Amazon.AspNetCore.Identity.Cognito/CognitoUserStore/CognitoUserStore.cs [535:552]


        private async Task SetAttributeValueAsync(TUser user, string attributeName, string attributeValue, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            if (user.Attributes == null)
            {
                throw new ArgumentException("user.Attributes must be initialized.");
            }

            var clientConfig = await _pool.GetUserPoolClientConfiguration().ConfigureAwait(false);

            if (!clientConfig.WriteAttributes?.Contains(attributeName) ?? true)
            {
                throw new NotAuthorizedException(string.Format("Writing to attribute {0} is not allowed by the user pool client configuration.", attributeName));
            }

            user.Attributes[attributeName] = attributeValue;
        }