简体   繁体   English

Hololens - UserConsentVerifier 不适用于 Hololens 第一代

[英]Hololens - UserConsentVerifier not working on Hololens 1st Generation

I'm currently working on an Hololens app that should work on both Hololens 1st gen and 2. One of the security requirements we have is to request user consent (using windows hello) before the app loads.我目前正在开发一个 Hololens 应用程序,该应用程序应该适用于 Hololens 1st gen 和 2。我们的安全要求之一是在应用程序加载之前请求用户同意(使用 windows hello)。

I've implemented a very similar approach to the following described on the link here .我已经实现了与此处链接中描述的以下内容非常相似的方法。

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

    if (String.IsNullOrEmpty(userMessage))
    {
        userMessage = "Please provide fingerprint verification.";
    }

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

        switch (consentResult)
        {
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.Verified:
                returnMessage = "Fingerprint verified.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.DeviceBusy:
                returnMessage = "Biometric device is busy.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.DeviceNotPresent:
                returnMessage = "No biometric device found.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.DisabledByPolicy:
                returnMessage = "Biometric verification is disabled by policy.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.NotConfiguredForUser:
                returnMessage = "The user has no fingerprints registered. Please add a fingerprint to the " +
                                "fingerprint database and try again.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.RetriesExhausted:
                returnMessage = "There have been too many failed attempts. Fingerprint authentication canceled.";
                break;
            case Windows.Security.Credentials.UI.UserConsentVerificationResult.Canceled:
                returnMessage = "Fingerprint authentication canceled.";
                break;
            default:
                returnMessage = "Fingerprint authentication is currently unavailable.";
                break;
        }
    }
    catch (Exception ex)
    {
        returnMessage = "Fingerprint authentication failed: " + ex.ToString();
    }

    return returnMessage;}

Everithin works fine on Hololens 2 although on Hololens 1 for no clear reason I get the following exception on this line: Everithin 在 Hololens 2 上运行良好,尽管在 Hololens 1 上没有明确的原因我在这条线上得到以下异常:

var consentResult = await Windows.Security.Credentials.UI.UserConsentVerifier.RequestVerificationAsync(userMessage);

{"No more data is available. (Exception from HRESULT: 0x8009002A)"} {“没有更多数据可用。(HRESULT 异常:0x8009002A)”}

I wonder if I'm doing something wrong or if this API does not support Hololens 1st generation at all.我想知道我是不是做错了什么,或者这个 API 根本不支持第一代 Hololens。 Although the class description says it supports all kind of verifications:虽然 class 描述说它支持所有类型的验证:

  • Checks for availability of a verification device (such as a Microsoft Passport PIN, Windows Hello biometric, or fingerprint reader) and performs a verification.检查验证设备(例如 Microsoft Passport PIN、Windows Hello 生物识别或指纹读取器)的可用性并执行验证。

It looks like UserConsentVerifier will always return NTE_NO_MORE_ITEMS (0x8009002A) on HoloLens (1st gen) due to a unimplemented underlying dependancy.由于未实现的底层依赖性,UserConsentVerifier 将始终在 HoloLens(第一代)上返回 NTE_NO_MORE_ITEMS (0x8009002A)。 This is fixed on HoloLens 2.这在 HoloLens 2 上已修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM