IMultiFactorProvider

Namespace: ASPSecurityKit.AuthProviders
Assembly: ASPSecurityKit.dll

Summary

Provides an interface to perform the multi-factor step of the security pipeline. To learn more, visit https://ASPSecurityKit.net/docs/the-security-pipeline/#multi-factor-authentication

Methods

IsEnabled(requestService)

Summary

Determines whether the current identity has multi-factor enabled.

Returns

true if the current identity has multi-factor enabled; otherwise, false.

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
Exceptions
Type Description
System.ArgumentNullException When requestService is null.

Verify(requestService)

Summary

Performs multi-factor check for the specified request. This is only called if IsEnabled returns true.

Returns

AuthResult instance with Code as Success if multi-factor verification succeeded; otherwise, a possible reason of failure (most likely NotMultiFactored).

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
Exceptions
Type Description
System.ArgumentNullException When requestService is null.

HandleUnverifiedRequest(requestService,result)

Summary

Handles response when request failed multi-factor verification.

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
result ASPSecurityKit.AuthProviders.AuthResult The result instance with failure details.
Exceptions
Type Description
System.ArgumentNullException When requestService/result is null.
System.ArgumentException When result is not a failed one.

IsEnabledAsync(requestService)

Summary

Determines whether the current identity has multi-factor enabled.

Returns

true if the current identity has multi-factor enabled; otherwise, false.

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
Exceptions
Type Description
System.ArgumentNullException When requestService is null.

IsEnabledAsync(requestService,cancellationToken)

Summary

Determines whether the current identity has multi-factor enabled.

Returns

true if the current identity has multi-factor enabled; otherwise, false.

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
cancellationToken System.Threading.CancellationToken The cancellation token.
Exceptions
Type Description
System.ArgumentNullException When requestService is null.

VerifyAsync(requestService)

Summary

Performs multi-factor check for the specified request. This is only called if IsEnabled returns true.

Returns

AuthResult instance with Code as Success if multi-factor verification succeeded; otherwise, a possible reason of failure (most likely NotMultiFactored).

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
Exceptions
Type Description
System.ArgumentNullException When requestService is null.

VerifyAsync(requestService,cancellationToken)

Summary

Performs multi-factor check for the specified request. This is only called if IsEnabled returns true.

Returns

AuthResult instance with Code as Success if multi-factor verification succeeded; otherwise, a possible reason of failure (most likely NotMultiFactored).

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
cancellationToken System.Threading.CancellationToken The cancellation token.
Exceptions
Type Description
System.ArgumentNullException When requestService is null.

HandleUnverifiedRequestAsync(requestService,result)

Summary

Handles response when request failed multi-factor verification.

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
result ASPSecurityKit.AuthProviders.AuthResult The result instance with failure details.
Exceptions
Type Description
System.ArgumentNullException When requestService/result is null.
System.ArgumentException When result is not a failed one.

HandleUnverifiedRequestAsync(requestService,result,cancellationToken)

Summary

Handles response when request failed multi-factor verification.

Parameters
Name Type Description
requestService ASPSecurityKit.IRequestService The request service.
result ASPSecurityKit.AuthProviders.AuthResult The result instance with failure details.
cancellationToken System.Threading.CancellationToken The cancellation token.
Exceptions
Type Description
System.ArgumentNullException When requestService/result is null.
System.ArgumentException When result is not a failed one.