Skip to content

Class QfAppAuthRequestHandler

ClassList > QfAppAuthRequestHandler

More...

  • #include <qfappauthrequesthandler.h>

Inherits the following classes: QObject, QgsCredentials, QgsNetworkAuthenticationHandler

Public Properties

Type Name
property bool hasPendingAuthRequest
property bool isProjectLoading

Public Signals

Type Name
signal void hasPendingAuthRequestChanged
signal void hideLoginBrowser
signal void isProjectLoadingChanged
signal void loginDialogClosed (const QString & realm, const bool canceled)
signal void reloadEverything
signal void showLoginBrowser (const QString & url)
signal void showLoginDialog (const QString & realm, const QString & title)

Public Functions

Type Name
QfAppAuthRequestHandler ()
Q_INVOKABLE void abortAuthBrowser ()
abort an ongoing external browser authentication request
Q_INVOKABLE void clearStoredRealms ()
clears the stored realms
Q_INVOKABLE void enterCredentials (const QString & realm, const QString & username, const QString & password)
stores the credentials after the information is entered in the login dialog
void handleAuthRequest (QNetworkReply * reply, QAuthenticator * auth) override
handles the auth request - triggered by the authRequestOccurred signal
void handleAuthRequestCloseBrowser () override
void handleAuthRequestOpenBrowser (const QUrl & url) override
Q_INVOKABLE bool handleLayerLogins ()
handles each realm after the project has been loaded
bool hasPendingAuthRequest () const
returns the number of pending authentication requests
bool isProjectLoading () const
returns TRUE is a project is loading
void setIsProjectLoading (bool loading)
sets whether a project is loading __

Protected Functions

Type Name
bool request (const QString & realm, QString & username, QString & password, const QString & message=QString()) override
bool requestMasterPassword (QString & password, bool stored=false) override

Detailed Description

When a layer requests and authentication, this handler is triggered. When the credentials are found in QgsCredentials (because it's stored before), they are used for the login. If not, QGIS would popup a Login Dialog, but QField does not. The realms (where it should log in to) are just added to the list of unhandled realms. When all layers are handled, the login dialog is diplayed for each of them. On successful login, the credentials are stored in QgsCredentials and removed from the list. When the list is empty (or contains only canceled realms), the project is reloaded. This time the logins are contained in QgsCredentials and no dialog needs to pop up.

Public Properties Documentation

property hasPendingAuthRequest [1/2]

bool QfAppAuthRequestHandler::hasPendingAuthRequest;

property isProjectLoading [1/2]

bool QfAppAuthRequestHandler::isProjectLoading;

Public Signals Documentation

signal hasPendingAuthRequestChanged

void QfAppAuthRequestHandler::hasPendingAuthRequestChanged;

signal hideLoginBrowser

void QfAppAuthRequestHandler::hideLoginBrowser;

signal isProjectLoadingChanged

void QfAppAuthRequestHandler::isProjectLoadingChanged;

signal loginDialogClosed

void QfAppAuthRequestHandler::loginDialogClosed;

signal reloadEverything

void QfAppAuthRequestHandler::reloadEverything;

signal showLoginBrowser

void QfAppAuthRequestHandler::showLoginBrowser;

signal showLoginDialog

void QfAppAuthRequestHandler::showLoginDialog;

Public Functions Documentation

function QfAppAuthRequestHandler

QfAppAuthRequestHandler::QfAppAuthRequestHandler () 

function abortAuthBrowser

abort an ongoing external browser authentication request

Q_INVOKABLE void QfAppAuthRequestHandler::abortAuthBrowser () 


function clearStoredRealms

clears the stored realms

Q_INVOKABLE void QfAppAuthRequestHandler::clearStoredRealms () 


function enterCredentials

stores the credentials after the information is entered in the login dialog

Q_INVOKABLE void QfAppAuthRequestHandler::enterCredentials (
    const QString & realm,
    const QString & username,
    const QString & password
) 


function handleAuthRequest

handles the auth request - triggered by the authRequestOccurred signal

void QfAppAuthRequestHandler::handleAuthRequest (
    QNetworkReply * reply,
    QAuthenticator * auth
) override


function handleAuthRequestCloseBrowser

void QfAppAuthRequestHandler::handleAuthRequestCloseBrowser () override

function handleAuthRequestOpenBrowser

void QfAppAuthRequestHandler::handleAuthRequestOpenBrowser (
    const QUrl & url
) override

function handleLayerLogins

handles each realm after the project has been loaded

Q_INVOKABLE bool QfAppAuthRequestHandler::handleLayerLogins () 


function hasPendingAuthRequest [2/2]

returns the number of pending authentication requests

bool QfAppAuthRequestHandler::hasPendingAuthRequest () const


function isProjectLoading [2/2]

returns TRUE is a project is loading

bool QfAppAuthRequestHandler::isProjectLoading () const


function setIsProjectLoading

sets whether a project is loading __

void QfAppAuthRequestHandler::setIsProjectLoading (
    bool loading
) 


Protected Functions Documentation

function request

bool QfAppAuthRequestHandler::request (
    const QString & realm,
    QString & username,
    QString & password,
    const QString & message=QString()
) override

function requestMasterPassword

inline bool QfAppAuthRequestHandler::requestMasterPassword (
    QString & password,
    bool stored=false
) override


The documentation for this class was generated from the following file src/app/qfappauthrequesthandler.h