IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

AuthenticationDialogRequest QML Type

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

This type was introduced in QtWebEngine 1.4.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

AuthenticationDialogRequest QML Type

  • Import Statement: import QtWebEngine

  • Since:: QtWebEngine 1.4

Detailed Description

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 property.

The 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 property to true, make sure to call either dialogAccept() or dialogReject() afterwards.

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

 
Sélectionnez
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;
    }
    // ...
}

Property Documentation

 

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.

The default is 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.

Constant

Description

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.

See Also

See also proxyHost

Method Documentation

 

void dialogAccept(string username, string password)

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

void dialogReject()

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

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+