17 #ifndef QGSAUTHMANAGER_H 18 #define QGSAUTHMANAGER_H 22 #include <QNetworkReply> 23 #include <QNetworkRequest> 24 #include <QSqlDatabase> 27 #include <QStringList> 30 #include <QSslCertificate> 46 class QgsAuthProvider;
86 bool init(
const QString& pluginPath = QString::null );
89 bool isDisabled()
const;
92 const QString disabledMessage()
const;
103 bool setMasterPassword(
bool verify =
false );
110 bool setMasterPassword(
const QString& pass,
bool verify =
false );
116 bool verifyMasterPassword(
const QString &compare = QString::null );
119 bool masterPasswordIsSet()
const;
122 bool masterPasswordHashInDb()
const;
132 bool masterPasswordSame(
const QString& pass )
const;
141 bool resetMasterPassword(
const QString& newpass,
const QString& oldpass,
bool keepbackup,
QString *backuppath =
nullptr );
159 void setScheduledAuthDbErase(
bool scheduleErase );
174 bool registerCoreAuthMethods();
180 void updateConfigAuthMethods();
223 QgsAuthMethod::Expansions supportedAuthMethodExpansions(
const QString &authcfg );
226 const QString uniqueConfigId()
const;
232 bool configIdUnique(
const QString &
id )
const;
238 bool hasConfigId(
const QString &txt )
const;
274 bool removeAuthenticationConfig(
const QString& authcfg );
280 bool removeAllAuthenticationConfigs();
286 bool backupAuthenticationDatabase(
QString *backuppath =
nullptr );
294 bool eraseAuthenticationDatabase(
bool backup,
QString *backuppath =
nullptr );
332 bool storeAuthSetting(
const QString& key,
const QVariant& value,
bool encrypt =
false );
338 bool existsAuthSetting(
const QString& key );
341 bool removeAuthSetting(
const QString& key );
343 #ifndef QT_NO_OPENSSL 347 bool initSslCaches();
370 bool existsCertIdentity(
const QString&
id );
373 bool removeCertIdentity(
const QString&
id );
389 bool existsSslCertCustomConfig(
const QString&
id,
const QString &hostport );
392 bool removeSslCertCustomConfig(
const QString&
id,
const QString &hostport );
400 void dumpIgnoredSslErrorsCache_();
409 bool rebuildIgnoredSslErrorCache();
444 return mCaCertsCache;
448 bool rebuildCaCertsCache();
477 bool rebuildCertTrustCache();
486 bool rebuildTrustedCaCertsCache();
513 void masterPasswordVerified(
bool verified )
const;
516 void authDatabaseEraseRequested()
const;
519 void authDatabaseChanged()
const;
523 void clearAllCachedConfigs();
526 void clearCachedConfig(
const QString& authcfg );
539 void tryToStartDbErase();
546 bool createConfigTables();
548 bool createCertTables();
550 bool masterPasswordInput();
552 bool masterPasswordRowsInDb(
int *rows )
const;
554 bool masterPasswordCheckAgainstDb(
const QString &compare = QString::null )
const;
556 bool masterPasswordStoreInDb()
const;
558 bool masterPasswordClearDb();
560 const QString masterPasswordCiv()
const;
562 bool verifyPasswordCanDecryptConfigs()
const;
564 bool reencryptAllAuthenticationConfigs(
const QString& prevpass,
const QString& prevciv );
566 bool reencryptAuthenticationConfig(
const QString& authcfg,
const QString& prevpass,
const QString& prevciv );
568 bool reencryptAllAuthenticationSettings(
const QString& prevpass,
const QString& prevciv );
570 bool reencryptAllAuthenticationIdentities(
const QString& prevpass,
const QString& prevciv );
572 bool reencryptAuthenticationIdentity(
const QString& identid,
const QString& prevpass,
const QString& prevciv );
574 bool authDbOpen()
const;
576 bool authDbQuery(
QSqlQuery *query )
const;
578 bool authDbStartTransaction()
const;
580 bool authDbCommit()
const;
582 bool authDbTransactionQuery(
QSqlQuery *query )
const;
584 #ifndef QT_NO_OPENSSL 588 const QString authDbPassTable()
const {
return smAuthPassTable; }
590 const QString authDbSettingsTable()
const {
return smAuthSettingsTable; }
592 const QString authDbIdentitiesTable()
const {
return smAuthIdentitiesTable; }
594 const QString authDbAuthoritiesTable()
const {
return smAuthAuthoritiesTable; }
596 const QString authDbTrustTable()
const {
return smAuthTrustTable; }
599 static const QString smAuthConfigTable;
600 static const QString smAuthPassTable;
601 static const QString smAuthSettingsTable;
602 static const QString smAuthIdentitiesTable;
603 static const QString smAuthServersTable;
604 static const QString smAuthAuthoritiesTable;
605 static const QString smAuthTrustTable;
606 static const QString smAuthManTag;
607 static const QString smAuthCfgRegex;
612 QCA::Initializer * mQcaInitializer;
621 QTimer *mScheduledDbEraseTimer;
622 bool mScheduledDbErase;
623 int mScheduledDbEraseRequestWait;
624 bool mScheduledDbEraseRequestEmitted;
625 int mScheduledDbEraseRequestCount;
628 #ifndef QT_NO_OPENSSL 641 #endif // QGSAUTHMANAGER_H Singleton offering an interface to manage the authentication configuration database and to utilize co...
bool scheduledAuthDbErase()
Whether there is a scheduled opitonal erase of authentication database.
const QString authDbConfigTable() const
Name of the authentication database table that stores configs.
Configuration container for SSL server connection exceptions or overrides.
Abstract base class for the edit widget of authentication method plugins.
MessageLevel
Message log level (mirrors that of QgsMessageLog, so it can also output there)
QString authManTag() const
Simple text tag describing authentication system for message logs.
Configuration storage class for authentication method configurations.
const QList< QSslCertificate > getTrustedCaCertsCache()
Get cache of trusted certificate authorities, ready for network connections.
const QString authenticationDbPath() const
The standard authentication database file in ~/.qgis2/ or defined location.
const QString authDbServersTable() const
Name of the authentication database table that stores server exceptions/configs.
const QMap< QgsAuthCertUtils::CertTrustPolicy, QStringList > getCertTrustCache()
Get cache of certificate sha1s, per trust policy.
void setScheduledAuthDbEraseRequestEmitted(bool emitted)
Re-emit a signal to schedule an optional erase of authentication database.
Abstract base class for authentication method plugins.
CaCertSource
Type of CA certificate source.
const QMap< QString, QPair< QgsAuthCertUtils::CaCertSource, QSslCertificate > > getCaCertsCache()
Get all CA certs mapped to their sha1 from cache.
void clearMasterPassword()
Clear supplied master password.
QHash< QString, QSet< QSslError::SslError > > getIgnoredSslErrorCache()
Get ignored SSL error cache, keyed with cert/connection's sha:host:port.
QString configIdRegex() const
Return regular expression for authcfg=.
QMutex * mutex()
Return pointer to mutex.
CertTrustPolicy
Type of certificate trust policy.