refactor(Configurations): move to common
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
using OtpNet;
|
||||
using System.Globalization;
|
||||
|
||||
namespace EnvelopeGenerator.Application.Common.Configurations;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class TotpSmsParams
|
||||
{
|
||||
/// <summary>
|
||||
/// The unit is second.
|
||||
/// </summary>
|
||||
public int TotpStep { get; init; } = 90;
|
||||
|
||||
/// <summary>
|
||||
/// Default value is 'Ihr 2FA-Passwort lautet {0}. Gültig bis {1}'
|
||||
/// </summary>
|
||||
public string Format { get; init; } = "Ihr 2FA-Passwort lautet {0}. Gültig bis {1}";
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public ExpirationHandler Expiration { get; init; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Default value is VerificationWindow.RfcSpecifiedNetworkDelay
|
||||
/// </summary>
|
||||
public VerificationWindow? TotpVerificationWindow { get; private init; } = VerificationWindow.RfcSpecifiedNetworkDelay;
|
||||
|
||||
private IEnumerable<int>? _tvwParams;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public IEnumerable<int>? TotpVerificationWindowParams
|
||||
{
|
||||
get => _tvwParams;
|
||||
init
|
||||
{
|
||||
_tvwParams = value;
|
||||
if(_tvwParams is not null)
|
||||
TotpVerificationWindow = new(previous: _tvwParams.ElementAtOrDefault(0), future: _tvwParams.ElementAtOrDefault(0));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class ExpirationHandler
|
||||
{
|
||||
/// <summary>
|
||||
/// Default value is 'e{0}_r{1}_sms_code_expiration'
|
||||
/// </summary>
|
||||
public string CacheKeyFormat { get; init; } = "e{0}_r{1}_sms_code_expiration";
|
||||
|
||||
/// <summary>
|
||||
/// Default value is HH:mm:ss
|
||||
/// </summary>
|
||||
public string Format { get; init; } = "HH:mm:ss";
|
||||
|
||||
/// <summary>
|
||||
/// Default value is 'de-DE'
|
||||
/// </summary>
|
||||
public string CultureName
|
||||
{
|
||||
get => _cultureInfo.Name;
|
||||
init => _cultureInfo = new(value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Default value is 'de-DE'
|
||||
/// </summary>
|
||||
private CultureInfo _cultureInfo = new("de-DE");
|
||||
|
||||
/// <summary>
|
||||
/// Default value is 'de-DE'
|
||||
/// </summary>
|
||||
public CultureInfo CultureInfo => _cultureInfo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user