UserConsentVerificationResult 枚举

定义

描述验证操作的结果。

public enum class UserConsentVerificationResult
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
enum class UserConsentVerificationResult
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
public enum UserConsentVerificationResult
var value = Windows.Security.Credentials.UI.UserConsentVerificationResult.verified
Public Enum UserConsentVerificationResult
继承
UserConsentVerificationResult
属性

Windows 要求

设备系列
Windows 10 (在 10.0.10240.0 中引入)
API contract
Windows.Foundation.UniversalApiContract (在 v1.0 中引入)

字段

Canceled 6

验证操作已取消。

DeviceBusy 4

身份验证设备正在执行操作,但不可用。

DeviceNotPresent 1

没有可用的身份验证设备。

DisabledByPolicy 3

组策略已禁用身份验证设备验证。

NotConfiguredForUser 2

未为此用户配置身份验证验证程序设备。

RetriesExhausted 5

尝试 10 次后,未验证原始验证请求和同一验证中的所有后续尝试。

Verified 0

用户已验证。

示例

以下示例演示一个方法,该方法从身份验证设备请求验证,并返回一条消息,该消息描述基于 UserConsentVerificationResult 值的结果。

private async System.Threading.Tasks.Task<string> RequestConsent(string userMessage)
{
    string returnMessage;

    // Request the logged on user's consent via authentication device.
    var consentResult = await Windows.Security.Credentials.UI.UserConsentVerifier.RequestVerificationAsync(userMessage);

    switch (consentResult)
    {
        case Windows.Security.Credentials.UI.UserConsentVerificationResult.Verified:
            returnMessage = "User verified.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerificationResult.DeviceBusy:
            returnMessage = "Authentication device is busy.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerificationResult.DeviceNotPresent:
            returnMessage = "No authentication device found.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerificationResult.DisabledByPolicy:
            returnMessage = "Authentication device verification is disabled by policy.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerificationResult.NotConfiguredForUser:
            returnMessage = "Please go to Account Settings to set up PIN or other advanced authentication.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerificationResult.RetriesExhausted:
            returnMessage = "There have been too many failed attempts. Device authentication canceled.";
            break;
        case Windows.Security.Credentials.UI.UserConsentVerificationResult.Canceled:
            returnMessage = "Device authentication canceled.";
            break;
        default:
            returnMessage = "Authentication device is currently unavailable.";
            break;
    }
    return returnMessage;
}

适用于

另请参阅