Provides interface tools for biometric authentication. More...
Import Statement: | import ArcGIS.AppFramework.Authentication 1.0 |
Properties
- activated : bool
- errorMessage : string
- message : string
- supported : bool
Signals
Methods
Detailed Description
Biometric authentication is a way of verifying a user's identity based on a physical attribute. The BiometricAuthenticator component provides an interface for implementing biometric authentication in apps for use in devices that support biometric authentication, such as fingerprint scanning and face ID. To use this capability, you have to set the message property and call the authenticate method.
This component is a singleton, and as such does not need to be instantiated.
This code sample demonstrates a basic usage of BiometricAuthentication. When this sample is run, it prompts the user to authenticate if biometric authentication is supported by the device. Depending on the results of the authentication, it either displays "Authentication Failed" or "Authentication Successful".
Rectangle { id: app width: 400 height: 640 Text { id: status font.pixelSize: 18 anchors.centerIn: parent } Component.onCompleted: { if (BiometricAuthenticator.supported && BiometricAuthenticator.activated) { BiometricAuthenticator.message = "Please authenticate to proceed."; BiometricAuthenticator.authenticate(); } else { status.text = "Not supported"; } } Connections { target: BiometricAuthenticator onRejected: { status.text = "Authentication failed"; } onAccepted: { status.text = "Authentication Successful"; } } }
Enumerations
Reason enumeration
This enum describes the potential reasons that a biometric authentication attempt can fail.
Name | Value |
---|---|
BiometricAuthenticator.Success | 0 |
BiometricAuthenticator.CancelledByUser | 1 |
BiometricAuthenticator.InValidCredentials | 2 |
BiometricAuthenticator.BiometricNotConfigured | 3 |
BiometricAuthenticator.UserFallback | 4 |
BiometricAuthenticator.PermissionDenied | 5 |
BiometricAuthenticator.BiometricNotSupported | 6 |
BiometricAuthenticator.BadCapture | 7 |
BiometricAuthenticator.PlatformNotSupported | 8 |
Property Documentation
Returns true if biometric authentication is activated. Otherwise, returns false.
Rectangle { property color successColor: "green" property color errorColor: "red" anchors.fill: parent color: BiometricAuthenticator.activated ? successColor : errorColor }
The message displayed when the authentication attempt has failed. Make sure to check for this property only when a device is supported.
Label { text: BiometricAuthenticator.errorMessage font.pixelSize: 16 visible: BiometricAuthenticator.errorMessage !== "No Error" }
A custom message displayed in the authentication dialog box. This property has to be set along with the authenticate method in order to call a platform-native biometric authentication dialog box. This property also has to be set before calling the authenticate method.
Component.onCompleted: { BiometricAuthenticator.message = "Please authenticate your identity to log into your account." BiometricAuthenticator.authenticate() }
Returns true if biometric authentication is supported on this device. Otherwise, returns false.
Text { id: supportCheck text: BiometricAuthenticator.supported ? "Authentication supported" : "Authentication not supported" }
Signal Documentation
Signal emitted when the biometric authentication has been accepted.
Text { id:statusMessage Connections { target:BiometricAuthenticator onAccepted :{ statusMessage.text = qsTr("Success") } } }
Note: The corresponding handler is onAccepted
.
Signal emitted when the biometric authentication attempt has been rejected.
Text { id:statusMessage Connections { target:BiometricAuthenticator onRejected: { statusMessage.text = qsTr("Fail") } } }
Note: The corresponding handler is onRejected
.
Method Documentation
Displays a platform-native authentication dialog box.
Button { id: touchIDButton text: "Touch ID" onClicked: { BiometricAuthenticator.authenticate() } }