Skip to content

Commit

Permalink
Windows 10 1511 Release - July 2016 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
oldnewthing committed Jul 14, 2016
2 parents 8e5862e + a60115e commit 500fd73
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 139 deletions.
4 changes: 2 additions & 2 deletions Samples/UserConsentVerifier/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!---
<!---
category: IdentitySecurityAndEncryption
samplefwlink: http://go.microsoft.com/fwlink/p/?LinkId=620615
--->

# UserConsentVerifier sample

Demonstrates how to use the UserConsentVerifier class to check whether a biometric device is available to request fingerprint consent, and to request fingerprint verification from the user.
Demonstrates how to use the UserConsentVerifier class to check whether a verifier device, such as a Microsoft Passport PIN, Windows Hello, or fingerprint reader, is available.

**Note**  This sample was created using one of the universal app templates available in Visual Studio. It shows how its solution is structured so it can run on both Windows 10 and Windows Phone 10.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,53 +23,34 @@ Scenario1_CheckConsentAvailability::Scenario1_CheckConsentAvailability()
InitializeComponent();
}

// Checks the availability of User consent requisition via registered fingerprints.
// Check the availability of Windows Hello authentication through User Consent Verifier.
void Scenario1_CheckConsentAvailability::CheckAvailability_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
Button^ checkAvailabilityButton = dynamic_cast<Button^>(sender);
checkAvailabilityButton->IsEnabled = false;

try
{
// Check the availability of User Consent with fingerprints facility
create_task(Windows::Security::Credentials::UI::UserConsentVerifier::CheckAvailabilityAsync())
.then([checkAvailabilityButton](UserConsentVerifierAvailability consentAvailability)
{
switch (consentAvailability)
{
case UserConsentVerifierAvailability::Available:
{
MainPage::Current->NotifyUser("User consent requisition facility is available.", NotifyType::StatusMessage);
break;
}

case UserConsentVerifierAvailability::DeviceBusy:
{
MainPage::Current->NotifyUser("Biometric device is busy.", NotifyType::ErrorMessage);
MainPage::Current->NotifyUser("User consent verification available!", NotifyType::StatusMessage);
break;
}

case UserConsentVerifierAvailability::DeviceNotPresent:
{
MainPage::Current->NotifyUser("No biometric device found.", NotifyType::ErrorMessage);
break;
}

case UserConsentVerifierAvailability::DisabledByPolicy:
{
MainPage::Current->NotifyUser("Biometrics is disabled by policy.", NotifyType::ErrorMessage);
break;
}

case UserConsentVerifierAvailability::NotConfiguredForUser:
{
MainPage::Current->NotifyUser("User has no fingeprints registered.", NotifyType::ErrorMessage);
MainPage::Current->NotifyUser("No PIN or biometric found, please set one up.", NotifyType::ErrorMessage);
break;
}

default:
{
MainPage::Current->NotifyUser("Consent verification with fingerprints is currently unavailable.", NotifyType::ErrorMessage);
MainPage::Current->NotifyUser("User consent verification is currently unavailable.", NotifyType::ErrorMessage);
break;
}
}
Expand Down
36 changes: 6 additions & 30 deletions Samples/UserConsentVerifier/cpp/Scenario2_RequestConsent.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Scenario2_RequestConsent::Scenario2_RequestConsent()
InitializeComponent();
}

// Requests fingerprint consent from the current user.
// Requests consent from the current user.
void Scenario2_RequestConsent::RequestConsent_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
{
Button^ requestConsentButton = dynamic_cast<Button^>(sender);
Expand All @@ -34,57 +34,33 @@ void Scenario2_RequestConsent::RequestConsent_Click(Platform::Object^ sender, Wi
{
try
{
// Request the currently logged on user's consent via fingerprint swipe
// Request the logged on user's consent using Windows Hello via biometric verification or a PIN.
create_task(Windows::Security::Credentials::UI::UserConsentVerifier::RequestVerificationAsync(Message->Text))
.then([requestConsentButton](UserConsentVerificationResult consentResult)
{
switch (consentResult)
{
case UserConsentVerificationResult::Verified:
{
MainPage::Current->NotifyUser("User's presence verified.", NotifyType::StatusMessage);
break;
}

case UserConsentVerificationResult::DeviceBusy:
{
MainPage::Current->NotifyUser("Biometric device is busy.", NotifyType::ErrorMessage);
MainPage::Current->NotifyUser("User consent verified!", NotifyType::StatusMessage);
break;
}

case UserConsentVerificationResult::DeviceNotPresent:
{
MainPage::Current->NotifyUser("No biometric device found.", NotifyType::ErrorMessage);
break;
}

case UserConsentVerificationResult::DisabledByPolicy:
{
MainPage::Current->NotifyUser("Biometrics is disabled by policy.", NotifyType::ErrorMessage);
break;
}

case UserConsentVerificationResult::NotConfiguredForUser:
{
MainPage::Current->NotifyUser("User has no fingeprints registered.", NotifyType::ErrorMessage);
break;
}

case UserConsentVerificationResult::RetriesExhausted:
{
MainPage::Current->NotifyUser("Too many failed attempts.", NotifyType::ErrorMessage);
MainPage::Current->NotifyUser("No PIN or biometric found, please set one up.", NotifyType::ErrorMessage);
break;
}

case UserConsentVerificationResult::Canceled:
{
MainPage::Current->NotifyUser("Consent request prompt was canceled.", NotifyType::ErrorMessage);
MainPage::Current->NotifyUser("User consent verification canceled.", NotifyType::ErrorMessage);
break;
}

default:
{
MainPage::Current->NotifyUser("Consent verification with fingerprints is currently unavailable.", NotifyType::ErrorMessage);
MainPage::Current->NotifyUser("User consent verification is currently unavailable.", NotifyType::ErrorMessage);
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ public Scenario1_CheckConsentAvailability()
}

/// <summary>
/// This is the click handler for the 'Check Availability' button. It checks the availability of User consent requisition
/// via registered fingerprints.
/// This is the click handler for the 'Check Availability' button. It checks the availability of Windows Hello via User Consent Verifier
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
Expand All @@ -39,43 +38,25 @@ private async void CheckAvailability_Click(object sender, RoutedEventArgs e)
b.IsEnabled = false;
try
{
// Check the availability of User Consent with fingerprints facility
// Check the availability of Windows Hello authentication through User Consent Verifier.
UserConsentVerifierAvailability consentAvailability = await Windows.Security.Credentials.UI.UserConsentVerifier.CheckAvailabilityAsync();
switch (consentAvailability)
{
case UserConsentVerifierAvailability.Available:
{
rootPage.NotifyUser("User consent requisition facility is available.", NotifyType.StatusMessage);
break;
}

case UserConsentVerifierAvailability.DeviceBusy:
{
rootPage.NotifyUser("Biometric device is busy.", NotifyType.ErrorMessage);
rootPage.NotifyUser("User consent verification available!", NotifyType.StatusMessage);
break;
}

case UserConsentVerifierAvailability.DeviceNotPresent:
{
rootPage.NotifyUser("No biometric device found.", NotifyType.ErrorMessage);
break;
}

case UserConsentVerifierAvailability.DisabledByPolicy:
{
rootPage.NotifyUser("Biometrics is disabled by policy.", NotifyType.ErrorMessage);
break;
}

case UserConsentVerifierAvailability.NotConfiguredForUser:
{
rootPage.NotifyUser("User has no fingeprints registered.", NotifyType.ErrorMessage);
rootPage.NotifyUser("No PIN or biometric found, please set one up.", NotifyType.ErrorMessage);
break;
}

default:
{
rootPage.NotifyUser("Consent verification with fingerprints is currently unavailable.", NotifyType.ErrorMessage);
rootPage.NotifyUser("User consent verification is currently unavailable.", NotifyType.ErrorMessage);
break;
}
}
Expand Down
33 changes: 5 additions & 28 deletions Samples/UserConsentVerifier/cs/Scenario2_RequestConsent.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,54 +41,31 @@ private async void RequestConsent_Click(object sender, RoutedEventArgs e)
{
try
{
// Request the currently logged on user's consent via fingerprint swipe
// Request the logged on user's consent using Windows Hello via biometric verification or a PIN.
UserConsentVerificationResult consentResult = await Windows.Security.Credentials.UI.UserConsentVerifier.RequestVerificationAsync(Message.Text);
switch (consentResult)
{
case UserConsentVerificationResult.Verified:
{
rootPage.NotifyUser("User's presence verified.", NotifyType.StatusMessage);
break;
}

case UserConsentVerificationResult.DeviceBusy:
{
rootPage.NotifyUser("Biometric device is busy.", NotifyType.ErrorMessage);
rootPage.NotifyUser("User consent verified!", NotifyType.StatusMessage);
break;
}

case UserConsentVerificationResult.DeviceNotPresent:
{
rootPage.NotifyUser("No biometric device found.", NotifyType.ErrorMessage);
break;
}

case UserConsentVerificationResult.DisabledByPolicy:
{
rootPage.NotifyUser("Biometrics is disabled by policy.", NotifyType.ErrorMessage);
rootPage.NotifyUser("No PIN or biometric found, please set one up.", NotifyType.ErrorMessage);
break;
}

case UserConsentVerificationResult.NotConfiguredForUser:
{
rootPage.NotifyUser("User has no fingeprints registered.", NotifyType.ErrorMessage);
break;
}

case UserConsentVerificationResult.RetriesExhausted:
{
rootPage.NotifyUser("Too many failed attempts.", NotifyType.ErrorMessage);
break;
}
case UserConsentVerificationResult.Canceled:
{
rootPage.NotifyUser("Consent request prompt was canceled.", NotifyType.ErrorMessage);
rootPage.NotifyUser("User consent verification canceled.", NotifyType.ErrorMessage);
break;
}

default:
{
rootPage.NotifyUser("Consent verification with fingerprints is currently unavailable.", NotifyType.ErrorMessage);
rootPage.NotifyUser("User consent verification is currently unavailable.", NotifyType.ErrorMessage);
break;
}
}
Expand Down
18 changes: 4 additions & 14 deletions Samples/UserConsentVerifier/js/js/scenario1.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,21 @@
}
});

// Checks the availability of User consent requisition via registered fingerprints.
// Check the availability of Windows Hello authentication through User Consent Verifier.
function checkConsentAvailability() {
try {

// Check the availability of User Consent with fingerprints facility
Windows.Security.Credentials.UI.UserConsentVerifier.checkAvailabilityAsync()
.then(function (consentAvailability) {
switch (consentAvailability) {
case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.available:
WinJS.log && WinJS.log("User consent requisition facility is available.", "sample", "status");
WinJS.log && WinJS.log("User consent verification available!", "sample", "status");
break;
case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.deviceNotPresent:
WinJS.log && WinJS.log("No biometric device found.", "sample", "error");
break;
case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.disabledByPolicy:
WinJS.log && WinJS.log("Biometrics is disabled by policy.", "sample", "error");
break;
case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.notConfiguredForUser:
WinJS.log && WinJS.log("User has no fingeprints registered.", "sample", "error");
break;
case Windows.Security.Credentials.UI.UserConsentVerifierAvailability.deviceBusy:
WinJS.log && WinJS.log("Biometric device is busy.", "sample", "error");
WinJS.log && WinJS.log("No PIN or biometric found, please set one up.", "sample", "error");
break;
default:
WinJS.log && WinJS.log("Consent verification is currently unavailable.", "sample", "error");
WinJS.log && WinJS.log("User consent verification is currently unavailable.", "sample", "error");
break;
}
});
Expand Down
23 changes: 5 additions & 18 deletions Samples/UserConsentVerifier/js/js/scenario2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,39 +8,26 @@
}
});

// Requests fingerprint consent from the current user.
// Request the logged on user's consent using Windows Hello via biometric verification or a PIN.
function requestConsent() {
try {
// Read the message that has to be displayed in the consent request prompt
var message = document.getElementById("Message").value;

// Request the currently logged on user's consent via fingerprint swipe
Windows.Security.Credentials.UI.UserConsentVerifier.requestVerificationAsync(message)
.then(function (consentResult) {
switch (consentResult) {
case Windows.Security.Credentials.UI.UserConsentVerificationResult.verified:
WinJS.log && WinJS.log("User's presence verified.", "sample", "status");
WinJS.log && WinJS.log("User consent verified!", "sample", "status");
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.deviceNotPresent:
WinJS.log && WinJS.log("No biometric device found.", "sample", "error");
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.disabledByPolicy:
WinJS.log && WinJS.log("Biometrics is disabled by policy.", "sample", "error");
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.retriesExhausted:
WinJS.log && WinJS.log("Too many failed attempts.", "sample", "error");
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.notConfiguredForUser:
WinJS.log && WinJS.log("User has no fingeprints registered.", "sample", "error");
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.deviceBusy:
WinJS.log && WinJS.log("Biometric device is busy.", "sample", "error");
WinJS.log && WinJS.log("No PIN or biometric found, please set one up.", "sample", "error");
break;
case Windows.Security.Credentials.UI.UserConsentVerificationResult.canceled:
WinJS.log && WinJS.log("Consent request prompt was canceled.", "sample", "error");
WinJS.log && WinJS.log("User consent verification canceled.", "sample", "error");
break;
default:
WinJS.log && WinJS.log("Consent verification is currently unavailable.", "sample", "error");
WinJS.log && WinJS.log("User consent verification is currently unavailable.", "sample", "error");
break;
}
});
Expand Down

0 comments on commit 500fd73

Please sign in to comment.