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()); } }
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)); }
public DeviceApprovalKeeperPushAction() { Channel = DeviceApprovalChannel.KeeperPush; }
public DeviceApprovalEmailResend() { Channel = DeviceApprovalChannel.Email; Resend = false; }
public static string DeviceApprovalChannelText(this DeviceApprovalChannel channel) { return(DeviceApproveChannels.TryGetValue(channel, out var text) ? text : channel.ToString()); }