private static string ChannelText(this DeviceApprovalChannel channel)
        {
            switch (channel)
            {
            case DeviceApprovalChannel.Email: return("email");

            case DeviceApprovalChannel.KeeperPush: return("keeper");

            case DeviceApprovalChannel.TwoFactorAuth: return("2fa");

            default: return(channel.ToString());
            }
        }
Esempio n. 2
0
        public static bool TryParseDeviceApprovalChannel(string text, out DeviceApprovalChannel channel)
        {
            foreach (var pair in DeviceApproveChannels)
            {
                if (string.Compare(pair.Value, text, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    channel = pair.Key;
                    return(true);
                }
            }

            channel = DeviceApprovalChannel.Email;
            return(false);
        }
 /// <summary>
 /// Sends verification code to the channel
 /// </summary>
 /// <param name="channel">Device approval channel</param>
 /// <param name="code">Verification code</param>
 /// <returns>Awaitable task</returns>
 public Task SendCode(DeviceApprovalChannel channel, string code)
 {
     return(OnSendCode?.Invoke(channel, code));
 }
 /// <summary>
 /// Sends push notification to the channel
 /// </summary>
 /// <param name="channel">Device approval channel</param>
 /// <returns>Awaitable task</returns>
 public Task SendPush(DeviceApprovalChannel channel)
 {
     return(OnSendPush?.Invoke(channel));
 }
Esempio n. 5
0
 public DeviceApprovalKeeperPushAction()
 {
     Channel = DeviceApprovalChannel.KeeperPush;
 }
Esempio n. 6
0
 public DeviceApprovalEmailResend()
 {
     Channel = DeviceApprovalChannel.Email;
     Resend  = false;
 }
Esempio n. 7
0
 public static string DeviceApprovalChannelText(this DeviceApprovalChannel channel)
 {
     return(DeviceApproveChannels.TryGetValue(channel, out var text) ? text : channel.ToString());
 }