Class OneTimeCodeAuthentication
public class OneTimeCodeAuthentication : IAuthentication
- Inheritance
-
OneTimeCodeAuthentication
- Implements
- Inherited Members
Constructors
OneTimeCodeAuthentication(int)
public OneTimeCodeAuthentication(int maxAttempts = 3)
Parameters
maxAttemptsint
Fields
VerificationAttemptsClaimKey
public static readonly string VerificationAttemptsClaimKey
Field Value
VerificationCodeClaimKey
public static readonly string VerificationCodeClaimKey
Field Value
Properties
IsAuthoritative
If true, the returned identity should be accepted without server verification
public bool IsAuthoritative { get; }
Property Value
Remarks
May depend on ambient state - don't cache the result. As well as enabling automatic login, this is used by SecurityService to decide whether it's ok to perform purely-local authentication without calling IEntityStore.Connect.
Realm
Describes identities within the purview of this authenticator
public string Realm { get; }
Property Value
RequiresCredentials
Expects non-empty Credentials in order to perform client-side identity operations
public bool RequiresCredentials { get; }
Property Value
Methods
ConsumeCodeAsync(IUserAccount, VerificationCode, CancellationToken?)
public Task<AuthenticationResult> ConsumeCodeAsync(IUserAccount userAccount, VerificationCode code, CancellationToken? cancellationToken = null)
Parameters
userAccountIUserAccountcodeVerificationCodecancellationTokenCancellationToken?
Returns
GetIdentity(Credentials)
Extract a subject from the environment or the supplied credentials.
public AuthenticationResult<string> GetIdentity(Credentials credentials)
Parameters
credentialsCredentials
Returns
- AuthenticationResult<string>
subject name, unverified - from local knowledge only
SetCodeAsync(IUserAccount, VerificationCode, TimeSpan?, CancellationToken?)
public static Task SetCodeAsync(IUserAccount userAccount, VerificationCode code, TimeSpan? expiryPeriod = null, CancellationToken? cancellationToken = null)
Parameters
userAccountIUserAccountcodeVerificationCodeexpiryPeriodTimeSpan?cancellationTokenCancellationToken?
Returns
VerifyIdentity(Credentials, string)
Verify that the subject matches the supplied credentials. Available synchronously only if IsAuthoritative returns true.
public AuthenticationResult VerifyIdentity(Credentials credentials, string subject)
Parameters
credentialsCredentialssubjectstring
Returns
- AuthenticationResult
(true/false for authentication state, null/reason for failure)
VerifyIdentityAsync(Credentials, IEntityContext, string)
verify that the subject matches the supplied credentials
public Task<AuthenticationResult> VerifyIdentityAsync(Credentials credentials, IEntityContext scopedContext, string subject)
Parameters
credentialsCredentialsscopedContextIEntityContextsubjectstring
Returns
- Task<AuthenticationResult>
(true/false for authentication state, null/reason for failure)