1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgscredentials.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsCredentials
{
%Docstring(signature="appended")
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 :py:class:`QgsCredentials` will be used if not
overridden with other credential creator function.
QGIS application uses :py:class:`QgsCredentialDialog` class for
displaying a dialog to the user.
Caller can use the mutex to synchronize authentications to avoid
requesting credentials for the same resource several times.
Object deletes itself when it's not needed anymore. Children should use
signal :py:func:`~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(), bool requestCredentials = true );
%Docstring
Requests credentials for the specified ``realm``.
If existing credentials exist for the given ``realm``, these will be
returned. Otherwise the credential handler will prompt for the correct
username and password if ``requestCredentials`` is set to True.
The retrieved or user-entered details will be stored in ``username`` and
``password``.
Optionally, a specific ``message`` can be used to advise users of the
context for the credentials request.
.. note::
This method will not automatically store the newly obtained credentials. Callers must
manually call :py:func:`~QgsCredentials.put` after verifying that the obtained credentials are correct.
.. seealso:: :py:func:`put`
%End
void put( const QString &realm, const QString &username, const QString &password );
%Docstring
Stores the correct ``username`` and ``password`` for the specified
``realm``.
These values will be used for all future calls to
:py:func:`~QgsCredentials.get` for the same ``realm``, without
requesting users to re-enter them. It is the caller's responsibility to
ensure that only valid ``username`` and ``password`` combinations are
used with this method.
.. seealso:: :py:func:`get`
%End
bool getMasterPassword( QString &password /In,Out/, bool stored = false );
static QgsCredentials *instance();
%Docstring
retrieves instance
%End
void lock();
%Docstring
Lock the instance against access from multiple threads. This does not
really lock access to get/put methods, 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
:py:func:`~QgsCredentials.lock` before the get/put calls to avoid race
conditions.
%End
void unlock();
%Docstring
Unlock the instance after being locked.
%End
QMutex *mutex();
%Docstring
Returns pointer to mutex
%End
protected:
QgsCredentials();
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(signature="appended")
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(signature="appended")
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.py again *
************************************************************************/
|