summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2024-02-29 13:28:43 +0100
committerMarc Mutz <marc.mutz@qt.io>2024-03-04 12:17:25 +0100
commitc2045137d4fb3e6ae7c02cc6474c5ae92c88fa82 (patch)
treecc1b201417308b11b282529702b600ecefdb96a6
parent30ff354d057a2517d928722402a3dabcc63c31ad (diff)
QWebEngineWebAuthUxRequest: add RegisterEnumClassesUnscoped for QML
Adding the scope later is a SiC (Type A, but still) change, so better do it now when we introduce the class. Found in API-review. Amends 605b0b3dcce24ff82c1e7a1ab3db7dace9668b81. Pick-to: 6.7 Change-Id: I4f399beed4a7a817c3f58e5864ed56b3a223a116 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Anu Aliyas <anu.aliyas@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
-rw-r--r--examples/webenginequick/quicknanobrowser/WebAuthDialog.qml56
-rw-r--r--src/core/api/qwebenginewebauthuxrequest.cpp55
-rw-r--r--src/core/api/qwebenginewebauthuxrequest.h1
3 files changed, 58 insertions, 54 deletions
diff --git a/examples/webenginequick/quicknanobrowser/WebAuthDialog.qml b/examples/webenginequick/quicknanobrowser/WebAuthDialog.qml
index a7e47e305..66baaaf48 100644
--- a/examples/webenginequick/quicknanobrowser/WebAuthDialog.qml
+++ b/examples/webenginequick/quicknanobrowser/WebAuthDialog.qml
@@ -28,10 +28,10 @@ Dialog {
onApplied: {
switch (webAuthDialog.authrequest.state) {
- case WebEngineWebAuthUxRequest.CollectPin:
+ case WebEngineWebAuthUxRequest.WebAuthUxState.CollectPin:
webAuthDialog.authrequest.setPin(pinEdit.text);
break;
- case WebEngineWebAuthUxRequest.SelectAccount:
+ case WebEngineWebAuthUxRequest.WebAuthUxState.SelectAccount:
webAuthDialog.authrequest.setSelectedAccount(webAuthDialog.selectAccount);
break;
default:
@@ -58,19 +58,19 @@ Dialog {
function setupUI(state) {
switch (state) {
- case WebEngineWebAuthUxRequest.SelectAccount:
+ case WebEngineWebAuthUxRequest.WebAuthUxState.SelectAccount:
setupSelectAccountUI();
break;
- case WebEngineWebAuthUxRequest.CollectPin:
+ case WebEngineWebAuthUxRequest.WebAuthUxState.CollectPin:
setupCollectPin();
break;
- case WebEngineWebAuthUxRequest.FinishTokenCollection:
+ case WebEngineWebAuthUxRequest.WebAuthUxState.FinishTokenCollection:
setupFinishCollectToken();
break;
- case WebEngineWebAuthUxRequest.RequestFailed:
+ case WebEngineWebAuthUxRequest.WebAuthUxState.RequestFailed:
setupErrorUI();
break;
- case WebEngineWebAuthUxRequest.Completed:
+ case WebEngineWebAuthUxRequest.WebAuthUxState.Completed:
webAuthDialog.close();
break;
}
@@ -181,14 +181,14 @@ Dialog {
pinEdit.clear();
- if (requestInfo.reason === WebEngineWebAuthUxRequest.Challenge) {
+ if (requestInfo.reason === WebEngineWebAuthUxRequest.PinEntryReason.Challenge) {
heading.text = "PIN required";
description.text = "Enter the PIN for your security key";
pinLabel.visible = true;
pinEdit.visible = true;
confirmPinLabel.visible = false;
confirmPinEdit.visible = false;
- } else if (reason === WebEngineWebAuthUxRequest.Set) {
+ } else if (reason === WebEngineWebAuthUxRequest.PinEntryReason.Set) {
heading.text = "Set PIN ";
description.text = "Set new PIN for your security key";
pinLabel.visible = true;
@@ -207,17 +207,17 @@ Dialog {
function getPINErrorDetails() {
var requestInfo = webAuthDialog.authrequest.pinRequest;
switch (requestInfo.error) {
- case WebEngineWebAuthUxRequest.NoError:
+ case WebEngineWebAuthUxRequest.PinEntryError.NoError:
return "";
- case WebEngineWebAuthUxRequest.TooShort:
+ case WebEngineWebAuthUxRequest.PinEntryError.TooShort:
return "Too short";
- case WebEngineWebAuthUxRequest.InternalUvLocked:
+ case WebEngineWebAuthUxRequest.PinEntryError.InternalUvLocked:
return "Internal Uv locked";
- case WebEngineWebAuthUxRequest.WrongPin:
+ case WebEngineWebAuthUxRequest.PinEntryError.WrongPin:
return "Wrong PIN";
- case WebEngineWebAuthUxRequest.InvalidCharacters:
+ case WebEngineWebAuthUxRequest.PinEntryError.InvalidCharacters:
return "Invalid characters";
- case WebEngineWebAuthUxRequest.SameAsCurrentPin:
+ case WebEngineWebAuthUxRequest.PinEntryError.SameAsCurrentPin:
return "Same as current PIN";
}
}
@@ -225,34 +225,34 @@ Dialog {
function getRequestFailureResaon() {
var requestFailureReason = webAuthDialog.authrequest.requestFailureReason;
switch (requestFailureReason) {
- case WebEngineWebAuthUxRequest.Timeout:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.Timeout:
return " Request Timeout";
- case WebEngineWebAuthUxRequest.KeyNotRegistered:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.KeyNotRegistered:
return "Key not registered";
- case WebEngineWebAuthUxRequest.KeyAlreadyRegistered:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.KeyAlreadyRegistered:
return "You already registered this device. You don't have to register it again
Try agin with different key or device";
- case WebEngineWebAuthUxRequest.SoftPinBlock:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.SoftPinBlock:
return "The security key is locked because the wrong PIN was entered too many times.
To unlock it, remove and reinsert it.";
- case WebEngineWebAuthUxRequest.HardPinBlock:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.HardPinBlock:
return "The security key is locked because the wrong PIN was entered too many times.
You'll need to reset the security key.";
- case WebEngineWebAuthUxRequest.AuthenticatorRemovedDuringPinEntry:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.AuthenticatorRemovedDuringPinEntry:
return "Authenticator removed during verification. Please reinsert and try again";
- case WebEngineWebAuthUxRequest.AuthenticatorMissingResidentKeys:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.AuthenticatorMissingResidentKeys:
return "Authenticator doesn't have resident key support";
- case WebEngineWebAuthUxRequest.AuthenticatorMissingUserVerification:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.AuthenticatorMissingUserVerification:
return "Authenticator missing user verification";
- case WebEngineWebAuthUxRequest.AuthenticatorMissingLargeBlob:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.AuthenticatorMissingLargeBlob:
return "Authenticator missing Large Blob support";
- case WebEngineWebAuthUxRequest.NoCommonAlgorithms:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.NoCommonAlgorithms:
return "No common Algorithms";
- case WebEngineWebAuthUxRequest.StorageFull:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.StorageFull:
return "Storage full";
- case WebEngineWebAuthUxRequest.UserConsentDenied:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.UserConsentDenied:
return "User consent denied";
- case WebEngineWebAuthUxRequest.WinUserCancelled:
+ case WebEngineWebAuthUxRequest.RequestFailureReason.WinUserCancelled:
return "User cancelled request";
}
}
diff --git a/src/core/api/qwebenginewebauthuxrequest.cpp b/src/core/api/qwebenginewebauthuxrequest.cpp
index 4fc7dd1d1..6a79daec9 100644
--- a/src/core/api/qwebenginewebauthuxrequest.cpp
+++ b/src/core/api/qwebenginewebauthuxrequest.cpp
@@ -209,8 +209,9 @@ QWebEngineWebAuthUxRequest::~QWebEngineWebAuthUxRequest() { }
\brief The available user names for the resident credential support.
This is needed when the current WebAuth request's UX state is
- WebEngineWebAuthUxRequest.SelectAccount. The WebAuth dialog displays user names.
- The user needs to select an account to proceed.
+ WebEngineWebAuthUxRequest.WebAuthUxState.SelectAccount. The
+ WebAuth dialog displays user names. The user needs to select an
+ account to proceed.
\sa state setSelectedAccount() QWebEngineWebAuthUxRequest::userNames
*/
@@ -271,18 +272,18 @@ QWebEngineWebAuthPinRequest QWebEngineWebAuthUxRequest::pinRequest() const
\qmlproperty enumeration WebEngineWebAuthUxRequest::state
\brief The WebAuth request's current UX state.
- \value WebEngineWebAuthUxRequest.NotStarted WebAuth UX request not started yet.
- \value WebEngineWebAuthUxRequest.SelectAccount The authenticator requires
+ \value WebEngineWebAuthUxRequest.WebAuthUxState.NotStarted WebAuth UX request not started yet.
+ \value WebEngineWebAuthUxRequest.WebAuthUxState.SelectAccount The authenticator requires
resident credential details. The application needs to display an account details dialog,
and the user needs to select an account to proceed.
- \value WebEngineWebAuthUxRequest.CollectPin The authenticator requires user verification.
+ \value WebEngineWebAuthUxRequest.WebAuthUxState.CollectPin The authenticator requires user verification.
The application needs to display a PIN request dialog.
- \value WebEngineWebAuthUxRequest.FinishTokenCollection The authenticator requires
+ \value WebEngineWebAuthUxRequest.WebAuthUxState.FinishTokenCollection The authenticator requires
token/user verification (like tap on the FIDO key) to complete the process.
- \value WebEngineWebAuthUxRequest.RequestFailed WebAuth request failed. Display error details.
- \value WebEngineWebAuthUxRequest.Cancelled WebAuth request is cancelled.
+ \value WebEngineWebAuthUxRequest.WebAuthUxState.RequestFailed WebAuth request failed. Display error details.
+ \value WebEngineWebAuthUxRequest.WebAuthUxState.Cancelled WebAuth request is cancelled.
Close the WebAuth dialog.
- \value WebEngineWebAuthUxRequest.Completed WebAuth request is completed.
+ \value WebEngineWebAuthUxRequest.WebAuthUxState.Completed WebAuth request is completed.
Close the WebAuth dialog.
*/
/*!
@@ -299,10 +300,12 @@ QWebEngineWebAuthUxRequest::WebAuthUxState QWebEngineWebAuthUxRequest::state() c
/*!
\qmlmethod void WebEngineWebAuthUxRequest::setSelectedAccount(const QString &selectedAccount)
+
Sends the \a selectedAccount name to the authenticator.
This is needed when the current WebAuth request's UX state is
- WebEngineWebAuthUxRequest.SelectAccount. The WebAuth request is blocked until the user selects
- an account and invokes this method.
+ WebEngineWebAuthUxRequest.WebAuthUxState.SelectAccount. The
+ WebAuth request is blocked until the user selects an account and
+ invokes this method.
\sa WebEngineWebAuthUxRequest::userNames state
*/
@@ -324,8 +327,8 @@ void QWebEngineWebAuthUxRequest::setSelectedAccount(const QString &selectedAccou
\qmlmethod void WebEngineWebAuthUxRequest::setPin(const QString &pin)
Sends the \a pin to the authenticator that prompts for a PIN.
This is needed when the current WebAuth request's UX state is
- WebEngineWebAuthUxRequest.CollectPin. The WebAuth request is blocked until
- the user responds with a PIN.
+ WebEngineWebAuthUxRequest.WebAuthUxState.CollectPin. The WebAuth
+ request is blocked until the user responds with a PIN.
\sa QWebEngineWebAuthPinRequest state
*/
@@ -382,27 +385,27 @@ void QWebEngineWebAuthUxRequest::retry()
\qmlproperty enumeration WebEngineWebAuthUxRequest::requestFailureReason
\brief The WebAuth request's failure reason.
- \value WebEngineWebAuthUxRequest.Timeout The authentication session has timed out.
- \value WebEngineWebAuthUxRequest.KeyNotRegistered Key is not registered with the authenticator.
- \value WebEngineWebAuthUxRequest.KeyAlreadyRegistered Key is already registered with
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.Timeout The authentication session has timed out.
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.KeyNotRegistered Key is not registered with the authenticator.
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.KeyAlreadyRegistered Key is already registered with
the authenticator. Try to register with another key or use another authenticator.
- \value WebEngineWebAuthUxRequest.SoftPinBlock The authenticator is blocked as the user
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.SoftPinBlock The authenticator is blocked as the user
entered the wrong key many times.
- \value WebEngineWebAuthUxRequest.HardPinBlock The authenticator is blocked as the user entered
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.HardPinBlock The authenticator is blocked as the user entered
the wrong key many times and reset the PIN to use the specific authenticator again.
- \value WebEngineWebAuthUxRequest.AuthenticatorRemovedDuringPinEntry Authenticator
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.AuthenticatorRemovedDuringPinEntry Authenticator
removed during PIN entry.
- \value WebEngineWebAuthUxRequest.AuthenticatorMissingResidentKeys Authenticator doesn't
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.AuthenticatorMissingResidentKeys Authenticator doesn't
have resident key support.
- \value WebEngineWebAuthUxRequest.AuthenticatorMissingUserVerification Authenticator doesn't
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.AuthenticatorMissingUserVerification Authenticator doesn't
have user verification support.
- \value WebEngineWebAuthUxRequest.AuthenticatorMissingLargeBlob Authenticator doesn't have
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.AuthenticatorMissingLargeBlob Authenticator doesn't have
large blob support.
- \value WebEngineWebAuthUxRequest.NoCommonAlgorithms No common algorithm.
- \value WebEngineWebAuthUxRequest.StorageFull The resident credential could not be created
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.NoCommonAlgorithms No common algorithm.
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.StorageFull The resident credential could not be created
because the authenticator has insufficient storage.
- \value WebEngineWebAuthUxRequest.UserConsentDenied User consent denied.
- \value WebEngineWebAuthUxRequest.WinUserCancelled The user clicked \uicontrol Cancel
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.UserConsentDenied User consent denied.
+ \value WebEngineWebAuthUxRequest.RequestFailureReason.WinUserCancelled The user clicked \uicontrol Cancel
in the native windows UI.
\sa stateChanged()
diff --git a/src/core/api/qwebenginewebauthuxrequest.h b/src/core/api/qwebenginewebauthuxrequest.h
index 59a97f260..111f52847 100644
--- a/src/core/api/qwebenginewebauthuxrequest.h
+++ b/src/core/api/qwebenginewebauthuxrequest.h
@@ -25,6 +25,7 @@ class Q_WEBENGINECORE_EXPORT QWebEngineWebAuthUxRequest : public QObject
Q_PROPERTY(QString relyingPartyId READ relyingPartyId CONSTANT FINAL)
Q_PROPERTY(QWebEngineWebAuthPinRequest pinRequest READ pinRequest CONSTANT FINAL)
Q_PROPERTY(RequestFailureReason requestFailureReason READ requestFailureReason CONSTANT FINAL)
+ Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
public:
enum class WebAuthUxState {
NotStarted,