QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Public Member Functions | List of all members
QgsNetworkAuthenticationHandler Class Reference

Network authentication handler, used for responding to network authentication requests during network requests. More...

#include <qgsnetworkaccessmanager.h>

Public Member Functions

virtual ~QgsNetworkAuthenticationHandler ()=default
 
virtual void handleAuthRequest (QNetworkReply *reply, QAuthenticator *auth)
 Called whenever network authentication requests are encountered during a network reply. More...
 

Detailed Description

Network authentication handler, used for responding to network authentication requests during network requests.

QgsNetworkAuthenticationHandler responds to authentication requests encountered during network requests. The base QgsNetworkAuthenticationHandler class responds to requests only by logging the request, but does not provide any username or password to allow the request to proceed.

Subclasses can override this behavior by implementing their own handleAuthRequest() method. QgsNetworkAuthenticationHandler are ONLY ever called from the main thread, so it is safe to utilize gui widgets and dialogs during handleAuthRequest (e.g. to present prompts to users requesting the username and password).

If a reply is coming from background thread, that thread is blocked while handleAuthRequest() is running.

An application instance can only have a single network authentication handler. The current authentication handler is set by calling QgsNetworkAccessManager::setAuthHandler(). By default an instance of the logging-only QgsNetworkAuthenticationHandler base class is used.

Since
QGIS 3.6

Definition at line 213 of file qgsnetworkaccessmanager.h.

Constructor & Destructor Documentation

◆ ~QgsNetworkAuthenticationHandler()

virtual QgsNetworkAuthenticationHandler::~QgsNetworkAuthenticationHandler ( )
virtualdefault

Member Function Documentation

◆ handleAuthRequest()

void QgsNetworkAuthenticationHandler::handleAuthRequest ( QNetworkReply *  reply,
QAuthenticator *  auth 
)
virtual

Called whenever network authentication requests are encountered during a network reply.

Subclasses should reimplement this method to implement their own logic regarding how to handle the requests and whether they should be presented to users.

The base class method just logs the request but does not provide any username/password resolution.

Definition at line 699 of file qgsnetworkaccessmanager.cpp.


The documentation for this class was generated from the following files: