mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-09 00:35:20 -05:00
Remove responsibility for credentials mutex locking from external callers and handle appropriate locks internally. This allows the mutex lock to be much "tighter" and avoids deadlocks when credentials are requested while an existing credentials dialog is being shown. (No mutex is required protecting the credentials dialog itself as this is ALWAYS shown in the main thread) Fixes #20826
158 lines
4.5 KiB
Plaintext
158 lines
4.5 KiB
Plaintext
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/qgscredentials.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
class QgsCredentials
|
|
{
|
|
%Docstring
|
|
Interface for requesting credentials in QGIS in GUI independent way.
|
|
This class provides abstraction of a dialog for requesting credentials to the user.
|
|
By default QgsCredentials will be used if not overridden with other
|
|
credential creator function.
|
|
|
|
QGIS application uses QgsCredentialDialog class for displaying a dialog to the user.
|
|
|
|
Object deletes itself when it's not needed anymore. Children should use
|
|
signal destroyed() to be notified of the deletion
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscredentials.h"
|
|
%End
|
|
public:
|
|
|
|
virtual ~QgsCredentials();
|
|
|
|
bool get( const QString &realm, QString &username /In,Out/, QString &password /In,Out/, const QString &message = QString() );
|
|
void put( const QString &realm, const QString &username, const QString &password );
|
|
|
|
bool getMasterPassword( QString &password /In,Out/, bool stored = false );
|
|
|
|
static QgsCredentials *instance();
|
|
%Docstring
|
|
retrieves instance
|
|
%End
|
|
|
|
void lock() /Deprecated/;
|
|
%Docstring
|
|
Lock the instance against access from multiple threads. This does not really lock access to get/put methds,
|
|
it will just prevent other threads to lock the instance and continue the execution. When the class is used
|
|
from non-GUI threads, they should call lock() before the get/put calls to avoid race conditions.
|
|
|
|
.. deprecated:: since QGIS 3.4 - mutex locking is automatically handled
|
|
%End
|
|
|
|
void unlock() /Deprecated/;
|
|
%Docstring
|
|
Unlock the instance after being locked.
|
|
|
|
.. deprecated:: since QGIS 3.4 - mutex locking is automatically handled
|
|
%End
|
|
|
|
QMutex *mutex() /Deprecated/;
|
|
%Docstring
|
|
Returns pointer to mutex
|
|
|
|
.. deprecated:: since QGIS 3.4 - mutex locking is automatically handled
|
|
%End
|
|
|
|
protected:
|
|
|
|
QgsCredentials();
|
|
%Docstring
|
|
Constructor for QgsCredentials.
|
|
%End
|
|
|
|
virtual bool request( const QString &realm, QString &username /In,Out/, QString &password /In,Out/, const QString &message = QString() ) = 0;
|
|
%Docstring
|
|
request a password
|
|
%End
|
|
|
|
virtual bool requestMasterPassword( QString &password /In,Out/, bool stored = false ) = 0;
|
|
%Docstring
|
|
request a master password
|
|
%End
|
|
|
|
void setInstance( QgsCredentials *instance );
|
|
%Docstring
|
|
register instance
|
|
%End
|
|
|
|
private:
|
|
QgsCredentials( const QgsCredentials & );
|
|
};
|
|
|
|
|
|
class QgsCredentialsNone : QObject, QgsCredentials
|
|
{
|
|
%Docstring
|
|
Default implementation of credentials interface
|
|
|
|
This class doesn't prompt or return credentials
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscredentials.h"
|
|
%End
|
|
public:
|
|
QgsCredentialsNone();
|
|
|
|
signals:
|
|
void destroyed();
|
|
%Docstring
|
|
signals that object will be destroyed and shouldn't be used anymore
|
|
%End
|
|
|
|
protected:
|
|
virtual bool request( const QString &realm, QString &username /In,Out/, QString &password /In,Out/, const QString &message = QString() );
|
|
|
|
virtual bool requestMasterPassword( QString &password /In,Out/, bool stored = false );
|
|
|
|
};
|
|
|
|
|
|
class QgsCredentialsConsole : QObject, QgsCredentials
|
|
{
|
|
%Docstring
|
|
Implementation of credentials interface for the console
|
|
|
|
This class outputs message to the standard output and retrieves input from
|
|
standard input. Therefore it won't be the right choice for apps without
|
|
GUI.
|
|
%End
|
|
|
|
%TypeHeaderCode
|
|
#include "qgscredentials.h"
|
|
%End
|
|
public:
|
|
QgsCredentialsConsole();
|
|
|
|
signals:
|
|
void destroyed();
|
|
%Docstring
|
|
signals that object will be destroyed and shouldn't be used anymore
|
|
%End
|
|
|
|
protected:
|
|
virtual bool request( const QString &realm, QString &username /In,Out/, QString &password /In,Out/, const QString &message = QString() );
|
|
|
|
virtual bool requestMasterPassword( QString &password /In,Out/, bool stored = false );
|
|
|
|
};
|
|
|
|
/************************************************************************
|
|
* This file has been generated automatically from *
|
|
* *
|
|
* src/core/qgscredentials.h *
|
|
* *
|
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
|
************************************************************************/
|