Beispiel #1
0
        internal async Task <DeleteUsersResult> DeleteUsersAsync(
            IReadOnlyList <string> uids, CancellationToken cancellationToken = default(CancellationToken))
        {
            if (uids.Count > MaxDeleteAccountsBatchSize)
            {
                throw new ArgumentException(
                          "`uids` parameter must have <= " + MaxDeleteAccountsBatchSize
                          + " entries.");
            }

            foreach (string uid in uids)
            {
                UserRecordArgs.CheckUid(uid, required: true);
            }

            var payload = new Dictionary <string, object>()
            {
                { "localIds", uids },
                { "force", true },
            };
            var response = await this.PostAndDeserializeAsync <BatchDeleteResponse>(
                "accounts:batchDelete", payload, cancellationToken).ConfigureAwait(false);

            return(new DeleteUsersResult(uids.Count, response.Result));
        }
            internal Request(ImportUserRecordArgs args)
            {
                this.Uid         = UserRecordArgs.CheckUid(args.Uid, true);
                this.Email       = UserRecordArgs.CheckEmail(args.Email);
                this.PhotoUrl    = UserRecordArgs.CheckPhotoUrl(args.PhotoUrl);
                this.PhoneNumber = UserRecordArgs.CheckPhoneNumber(args.PhoneNumber);

                if (!string.IsNullOrEmpty(args.DisplayName))
                {
                    this.DisplayName = args.DisplayName;
                }

                if (args.UserMetadata != null)
                {
                    this.CreatedAt   = args.UserMetadata.CreationTimestamp;
                    this.LastLoginAt = args.UserMetadata.LastSignInTimestamp;
                }

                if (args.PasswordHash != null)
                {
                    this.PasswordHash = JwtUtils.UrlSafeBase64Encode(args.PasswordHash);
                }

                if (args.PasswordSalt != null)
                {
                    this.PasswordSalt = JwtUtils.UrlSafeBase64Encode(args.PasswordSalt);
                }

                if (args.UserProviders != null && args.UserProviders.Count() > 0)
                {
                    this.ProviderUserInfo = new List <UserProvider.Request>(
                        args.UserProviders.Select(userProvider => userProvider.ToRequest()));
                }

                if (args.CustomClaims != null && args.CustomClaims.Count > 0)
                {
                    var serialized = UserRecordArgs.CheckCustomClaims(args.CustomClaims);
                    this.CustomAttributes = serialized;
                }

                this.EmailVerified = args.EmailVerified;
                this.Disabled      = args.Disabled;
            }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UidIdentifier"/> class.
 /// </summary>
 /// <param name="uid">The uid.</param>
 public UidIdentifier(string uid)
 {
     this.uid = UserRecordArgs.CheckUid(uid, required: true);
 }