2

我在我的应用程序中使用凭据选择器进行用户身份验证。我的数据库中的身份验证详细信息采用字符串格式。但是凭据选择器传递的密码是加密形式的(默认情况下协商身份验证协议),所以如何解密该密码以便我可以匹配我的数据库密码。与数据库存储密码进行密码匹配的最佳和正确解决方案是什么?下面是代码片段:

function launchCredentialPicker() {
    Windows.Security.Credentials.UI.CredentialPicker.pickAsync("My Target", "My Message", "my Caption").then(function (results) {

        var domainName = results.credentialDomainName;
        WinJS.Application.sessionState.Username = results.credentialUserName;
        WinJS.Application.sessionState.Password = results.credentialPassword;
        WinJS.Application.sessionState.RememberPassword = (results.credentialSaveOption === Windows.Security.Credentials.UI.CredentialSaveOption.hidden) ? "Hidden" :
                               ((results.credentialSaveOption === Windows.Security.Credentials.UI.CredentialSaveOption.selected) ? "Selected" : "Unselected");

    });
}
4

1 回答 1

3

您需要为 的方法使用CredentialPickerOptions对象。配置为使用基本身份验证后,您将能够看到用户输入的密码。PickAsyncCredentialPickerCredentialPickerOptions

var options = new Windows.Security.Credentials.UI.CredentialPickerOptions();
options.authenticationProtocol = Windows.Security.Credentials.UI.AuthenticationProtocol.basic;

Windows.Security.Credentials.UI.CredentialPicker.pickAsync(options).then(/* */);
于 2013-09-21T12:26:56.193 回答