AuthenticationDialogRequest QML Type

A request for providing authentication credentials required by proxies or HTTP servers. 更多...

import 语句: import QtWebEngine
Since: QtWebEngine 1.4

特性

方法

详细描述

An AuthenticationDialogRequest is passed as an argument of the WebEngineView::authenticationDialogRequested signal. It is generated when basic HTTP or proxy authentication is required. The type of authentication can be checked with the type 特性。

accepted property of the request indicates whether the request is handled by the user code or the default dialog should be displayed. If you set the accepted 特性到 true , make sure to call either dialogAccept() or dialogReject() afterwards.

The following code uses a custom dialog to handle the request:

WebEngineView {
    // ...
    onAuthenticationDialogRequested: function(request) {
        request.accepted = true;
        myDialog.request = request // keep the reference to the request
        myDialog.accept.connect(request.dialogAccept);
        myDialog.reject.connect(request.dialogReject);
        myDialog.visible = true;
    }
    // ...
}
					

特性文档编制

accepted : bool

Indicates whether the authentication dialog request has been accepted by the signal handler.

If the property is false after any signal handlers for WebEngineView::authenticationDialogRequested have been executed, a default authentication dialog will be shown. To prevent this, set request.accepted to true .

默认为 false .

[read-only] proxyHost : string

The hostname of the authentication proxy. Empty if type is AuthenticationTypeHTTP.

[read-only] realm : string

The HTTP authentication realm attribute value of the WWW-Authenticate header. Empty if type is AuthenticationTypeProxy.

[read-only] type : enumeration

The type of the authentication request.

常量 描述
WebEngineAuthenticationDialogRequest.AuthenticationTypeHTTP HTTP authentication.
WebEngineAuthenticationDialogRequest.AuthenticationTypeProxy Proxy authentication.
[read-only] url : url

The URL of the HTTP request for which authentication was requested. In case of proxy authentication, this is a request URL which is proxied via host.

另请参阅 proxyHost .


方法文档编制

void dialogAccept ( string username , string password )

This function notifies the engine that the user accepted the dialog, providing the username password required for authentication.

void dialogReject ()

This function notifies the engine that the user rejected the dialog and the authentication shall not proceed.