19 #include <QTextStream>
27 QgsDebugMsg(
"already registered an instance of QgsCredentials" );
30 smInstance = theInstance;
51 if ( mCredentialCache.
contains( realm ) )
54 username = credentials.first;
55 password = credentials.second;
56 QgsDebugMsg(
QString(
"retrieved realm:%1 username:%2 password:%3" ).arg( realm ).arg( username ).arg( password ) );
62 if (
request( realm, username, password, message ) )
64 QgsDebugMsg(
QString(
"requested realm:%1 username:%2 password:%3" ).arg( realm ).arg( username ).arg( password ) );
76 QgsDebugMsg(
QString(
"inserting realm:%1 username:%2 password:%3" ).arg( realm ).arg( username ).arg( password ) );
104 out <<
"credentials for " << realm << endl;
106 out <<
"message: " << message << endl;
bool contains(const Key &key) const
Interface for requesting credentials in QGIS in GUI independent way.
static QgsCredentials * instance()
retrieves instance
bool get(QString realm, QString &username, QString &password, QString message=QString::null)
void lock()
Lock the instance against access from multiple threads.
virtual bool request(QString realm, QString &username, QString &password, QString message=QString::null)=0
request a password
void put(QString realm, QString username, QString password)
virtual bool request(QString realm, QString &username, QString &password, QString message=QString::null) override
request a password
Default implementation of credentials interface.
virtual ~QgsCredentials()
virtual destructor
iterator insert(const Key &key, const T &value)
void unlock()
Unlock the instance after being locked.
void setInstance(QgsCredentials *theInstance)
register instance