in FirebaseAdmin/FirebaseAdmin/Auth/UserRecord.cs [41:89]
internal UserRecord(GetAccountInfoResponse.User user)
{
if (user == null)
{
throw new ArgumentException("User object must not be null or empty.");
}
else if (string.IsNullOrEmpty(user.UserId))
{
throw new ArgumentException("User ID must not be null or empty.");
}
this.Uid = user.UserId;
this.Email = user.Email;
this.PhoneNumber = user.PhoneNumber;
this.EmailVerified = user.EmailVerified;
this.DisplayName = user.DisplayName;
this.PhotoUrl = user.PhotoUrl;
this.Disabled = user.Disabled;
if (user.Providers == null || user.Providers.Count == 0)
{
this.ProviderData = new IUserInfo[0];
}
else
{
var count = user.Providers.Count;
this.ProviderData = new IUserInfo[count];
for (int i = 0; i < count; i++)
{
this.ProviderData[i] = new ProviderUserInfo(user.Providers[i]);
}
}
this.validSinceTimestampInSeconds = user.ValidSince;
// newtonsoft's json deserializer will convert an iso8601 format
// string to a (non-null) DateTime, returning 0001-01-01 if it's not
// present in the proto. We'll compare against the epoch and only
// use the deserialized value if it's bigger.
DateTime? lastRefreshAt = null;
if (user.LastRefreshAt > UnixEpoch)
{
lastRefreshAt = user.LastRefreshAt;
}
this.UserMetaData = new UserMetadata(user.CreatedAt, user.LastLoginAt, lastRefreshAt);
this.CustomClaims = UserRecord.ParseCustomClaims(user.CustomClaims);
this.TenantId = user.TenantId;
}