Question How do I use Windows Hello Authentication (Windows.Security.Credentials)

Cecil

19+ years progress programming and still learning.
Windows 10:
OpenEdge 12.8.

This is my code and I want to start using the "Windows Hello" as a form of Authenticator using biometrics and or PIN code.

Code:
using Progress.Lang.*.
using Windows.Security.Credentials.*.

block-level on error undo, throw.

class ABLWindowsHello:
    
    method public void MicrosoftPassportKeyCredentials(  ):
        
        define variable IsSupported as logical no-undo.
        
        wait-for KeyCredentialManager:IsSupportedAsync() set IsSupported.
        
        if IsSupported then
            message "Windows Hello is supported"
                view-as alert-box info.
        else
            message "Windows Hello is not supported"
                view-as alert-box info.
        
        return.

    end method.

end class.


The compile Error:
1710147310063.png

I can't seem to find the Windows.Security.Credentials assembly .dlls.

Reference:
https://learn.microsoft.com/en-us/uwp/api/windows.security.credentials.keycredentialmanager?view=winrt-10240
 

Osborne

Active Member
Yes, this seems to be hidden deep as there is no indication of where it can be found. I do not know if what is posted here is any help:


Windows.Security.Credentials class avilible only in WinRT based projects type. For example in WindowsRuntimeComponent.
 

Cecil

19+ years progress programming and still learning.
Thanks for your feedback. It looks like i might have use an intermediary an SDK to do what I want to do.

Windows.Security.Credentials.UI

 

Cecil

19+ years progress programming and still learning.
I've given up trying to use the Windows Hello / Password. I don't know how to implement this into the ABL.
 

RaphaelFrei

New Member
I'd recommend you to create an C# DLL and encapsulate the file inside your application... I did this to integrate our login system into Azure's authentication.

You'll require the following Nugets:
  1. Microsoft.Windows.SDK.Contracts package. In the right pane of the NuGet Package Manager window select the desired version of the package based on the version of Windows 10 you want to target and click install.
  2. Microsoft.NETCore.UniversalWindowsPlatform.
And inside the C# file you can do something like this:

C#:
namespace YourNamespace{

    public static class YourFile{

        public static string CheckWindowsHello() {

            string status;

            try {

                bool supported = await KeyCredentialManager.IsSupportedAsync();
                
                if (supported){
                    KeyCredentialRetrievalResult result =
                        await KeyCredentialManager.RequestCreateAsync("login", KeyCredentialCreationOption.ReplaceExisting);
                    if (result.Status == KeyCredentialStatus.Success){
                        status = $"SUCCESS - Logged in";
                    }
                    else{
                        status = $"ERROR - Login failed";
                    }
                } else {
                    status = $"ERROR - Windows Hello is not supported";
                }

            } catch (Exception e) {
                status = $"ERROR - Something wrong happened: {e}";

            }

            return status;
        }
    }
}

And call it by this inside your Progress program:

Code:
cStatus = YourNamespace.YourFile:CheckWindowsHello().
IF cStatus BEGINS "SUCCESS" THEN 
// DO YOUR CODE
ELSE ...
 
Top