Class TwoFactorAuthenticator
- Assembly
- IpPbxCDSSharedLib.dll
public class TwoFactorAuthenticator
- Inheritance
-
TwoFactorAuthenticator
Constructors
TwoFactorAuthenticator()
public TwoFactorAuthenticator()
TwoFactorAuthenticator(bool, bool)
public TwoFactorAuthenticator(bool useManagedSha1, bool useUnmanagedOnFail)
Parameters
Fields
_epoch
public static DateTime _epoch
Field Value
Properties
DefaultClockDriftTolerance
public TimeSpan DefaultClockDriftTolerance { get; set; }
Property Value
TryUnmanagedAlgorithmOnFailure
public bool TryUnmanagedAlgorithmOnFailure { get; set; }
Property Value
UseManagedSha1Algorithm
public bool UseManagedSha1Algorithm { get; set; }
Property Value
Methods
GenerateSetupCode(string, string, int, int)
Generate a setup code for a Google Authenticator user to scan.
public SetupCode GenerateSetupCode(string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight)
Parameters
accountTitleNoSpaces
stringAccount Title (no spaces)
accountSecretKey
stringAccount Secret Key
qrCodeWidth
intQR Code Width
qrCodeHeight
intQR Code Height
Returns
- SetupCode
SetupCode object
GenerateSetupCode(string, string, string, int, int)
Generate a setup code for a Google Authenticator user to scan (with issuer ID).
public SetupCode GenerateSetupCode(string issuer, string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight)
Parameters
issuer
stringIssuer ID (the name of the system, i.e. 'MyApp')
accountTitleNoSpaces
stringAccount Title (no spaces)
accountSecretKey
stringAccount Secret Key
qrCodeWidth
intQR Code Width
qrCodeHeight
intQR Code Height
Returns
- SetupCode
SetupCode object
GenerateSetupCode(string, string, string, int, int, bool)
Generate a setup code for a Google Authenticator user to scan (with issuer ID).
public SetupCode GenerateSetupCode(string issuer, string accountTitleNoSpaces, string accountSecretKey, int qrCodeWidth, int qrCodeHeight, bool useHttps)
Parameters
issuer
stringIssuer ID (the name of the system, i.e. 'MyApp')
accountTitleNoSpaces
stringAccount Title (no spaces)
accountSecretKey
stringAccount Secret Key
qrCodeWidth
intQR Code Width
qrCodeHeight
intQR Code Height
useHttps
boolUse HTTPS instead of HTTP
Returns
- SetupCode
SetupCode object
GetCurrentPIN(string)
public string GetCurrentPIN(string accountSecretKey)
Parameters
accountSecretKey
string
Returns
GetCurrentPIN(string, DateTime)
public string GetCurrentPIN(string accountSecretKey, DateTime now)
Parameters
Returns
GetCurrentPINs(string)
public string[] GetCurrentPINs(string accountSecretKey)
Parameters
accountSecretKey
string
Returns
- string[]
GetCurrentPINs(string, TimeSpan)
public string[] GetCurrentPINs(string accountSecretKey, TimeSpan timeTolerance)
Parameters
Returns
- string[]
ValidateTwoFactorPIN(string, string)
public bool ValidateTwoFactorPIN(string accountSecretKey, string twoFactorCodeFromClient)
Parameters
Returns
ValidateTwoFactorPIN(string, string, TimeSpan)
public bool ValidateTwoFactorPIN(string accountSecretKey, string twoFactorCodeFromClient, TimeSpan timeTolerance)