Skip to content

Class QFieldAppAuthRequestHandler

ClassList > QFieldAppAuthRequestHandler

More...

  • #include <qfieldappauthrequesthandler.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
QFieldAppAuthRequestHandler ()
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 QFieldAppAuthRequestHandler::hasPendingAuthRequest;

property isProjectLoading [1/2]

bool QFieldAppAuthRequestHandler::isProjectLoading;

Public Signals Documentation

signal hasPendingAuthRequestChanged

void QFieldAppAuthRequestHandler::hasPendingAuthRequestChanged;

signal hideLoginBrowser

void QFieldAppAuthRequestHandler::hideLoginBrowser;

signal isProjectLoadingChanged

void QFieldAppAuthRequestHandler::isProjectLoadingChanged;

signal loginDialogClosed

void QFieldAppAuthRequestHandler::loginDialogClosed;

signal reloadEverything

void QFieldAppAuthRequestHandler::reloadEverything;

signal showLoginBrowser

void QFieldAppAuthRequestHandler::showLoginBrowser;

signal showLoginDialog

void QFieldAppAuthRequestHandler::showLoginDialog;

Public Functions Documentation

function QFieldAppAuthRequestHandler

QFieldAppAuthRequestHandler::QFieldAppAuthRequestHandler () 

function abortAuthBrowser

abort an ongoing external browser authentication request

Q_INVOKABLE void QFieldAppAuthRequestHandler::abortAuthBrowser () 

function clearStoredRealms

clears the stored realms

Q_INVOKABLE void QFieldAppAuthRequestHandler::clearStoredRealms () 

function enterCredentials

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

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

function handleAuthRequest

handles the auth request - triggered by the authRequestOccurred signal

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

function handleAuthRequestCloseBrowser

void QFieldAppAuthRequestHandler::handleAuthRequestCloseBrowser () override

function handleAuthRequestOpenBrowser

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

function handleLayerLogins

handles each realm after the project has been loaded

Q_INVOKABLE bool QFieldAppAuthRequestHandler::handleLayerLogins () 

function hasPendingAuthRequest [2/2]

returns the number of pending authentication requests

bool QFieldAppAuthRequestHandler::hasPendingAuthRequest () const

function isProjectLoading [2/2]

returns TRUE is a project is loading

bool QFieldAppAuthRequestHandler::isProjectLoading () const

function setIsProjectLoading

sets whether a project is loading __

void QFieldAppAuthRequestHandler::setIsProjectLoading (
    bool loading
) 

Protected Functions Documentation

function request

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

function requestMasterPassword

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


The documentation for this class was generated from the following file src/core/qfieldappauthrequesthandler.h