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, username, password ) );
62 if (
request( realm, username, password, message ) )
64 QgsDebugMsg(
QString(
"requested realm:%1 username:%2 password:%3" ).arg( realm, username, password ) );
76 QgsDebugMsg(
QString(
"inserting realm:%1 username:%2 password:%3" ).arg( realm, username, password ) );
112 Q_UNUSED( username );
113 Q_UNUSED( password );
120 Q_UNUSED( password );
138 out <<
"credentials for " << realm << endl;
140 out <<
"message: " << message << endl;
156 QString msg( stored ?
"Master password for authentication configs: " :
"Set master password for authentication configs: " );
bool getMasterPassword(QString &password, bool stored=false)
bool contains(const Key &key) const
Interface for requesting credentials in QGIS in GUI independent way.
virtual bool requestMasterPassword(QString &password, bool stored=false) override
request a master password
virtual bool requestMasterPassword(QString &password, bool stored=false)=0
request a master password
static QgsCredentials * instance()
retrieves instance
Default implementation of credentials interface.
virtual bool request(const QString &realm, QString &username, QString &password, const QString &message=QString::null)=0
request a password
void lock()
Lock the instance against access from multiple threads.
virtual bool request(const QString &realm, QString &username, QString &password, const QString &message=QString::null) override
request a password
bool get(const QString &realm, QString &username, QString &password, const QString &message=QString::null)
virtual bool request(const QString &realm, QString &username, QString &password, const QString &message=QString::null) override
request a password
virtual ~QgsCredentials()
virtual destructor
iterator insert(const Key &key, const T &value)
void unlock()
Unlock the instance after being locked.
void put(const QString &realm, const QString &username, const QString &password)
void setInstance(QgsCredentials *theInstance)
register instance
virtual bool requestMasterPassword(QString &password, bool stored=false) override
request a master password