internal static string GetAuthenticatorProfile(IAuthenticatorEnrollment authenticatorEnrollment) { if (authenticatorEnrollment.Key == AuthenticatorType.Phone.ToIdxKeyString()) { return(authenticatorEnrollment.Profile?.GetProperty <string>("phoneNumber")); } else if (authenticatorEnrollment.Key == AuthenticatorType.Email.ToIdxKeyString()) { return(authenticatorEnrollment.Profile?.GetProperty <string>("email")); } return(string.Empty); }
internal static IAuthenticator ConvertToAuthenticator(IList <IAuthenticatorValue> authenticators, IAuthenticatorEnrollment authenticatorEnrollment) => new Authenticator { Id = authenticators?.FirstOrDefault(x => x.Key == authenticatorEnrollment.Key)?.Id, Name = authenticatorEnrollment.DisplayName, MethodTypes = authenticatorEnrollment.Methods?.Select(x => x.Type).ToList(), EnrollmentId = authenticatorEnrollment.Id, Profile = GetAuthenticatorProfile(authenticatorEnrollment), };