78 Q_ENUM( MessageLevel )
88 bool init(
const QString &pluginPath = QString(),
const QString &authDatabasePath = QString() );
93 QSqlDatabase authDatabaseConnection()
const;
103 bool isDisabled()
const;
106 const QString disabledMessage()
const;
119 bool setMasterPassword(
bool verify =
false );
127 bool setMasterPassword(
const QString &pass,
bool verify =
false );
134 bool verifyMasterPassword(
const QString &compare = QString() );
137 bool masterPasswordIsSet()
const;
140 bool masterPasswordHashInDatabase()
const;
152 bool masterPasswordSame(
const QString &pass )
const;
162 bool resetMasterPassword(
const QString &newpass,
const QString &oldpass,
bool keepbackup, QString *backuppath
SIP_INOUT =
nullptr );
182 void setScheduledAuthDatabaseErase(
bool scheduleErase )
SIP_SKIP;
198 bool registerCoreAuthMethods();
204 void updateConfigAuthMethods();
216 QString configAuthMethodKey(
const QString &authcfg )
const;
221 QStringList authMethodsKeys(
const QString &dataprovider = QString() );
251 QWidget *authMethodEditWidget(
const QString &authMethodKey, QWidget *parent );
259 QgsAuthMethod::Expansions supportedAuthMethodExpansions(
const QString &authcfg );
262 const QString uniqueConfigId()
const;
268 bool configIdUnique(
const QString &
id )
const;
274 bool hasConfigId(
const QString &txt )
const;
280 QStringList configIds()
const;
311 bool removeAuthenticationConfig(
const QString &authcfg );
320 bool exportAuthenticationConfigsToXml(
const QString &filename,
const QStringList &authcfgs,
const QString &password = QString() );
329 bool importAuthenticationConfigsFromXml(
const QString &filename,
const QString &password = QString(),
bool overwrite =
false );
335 bool removeAllAuthenticationConfigs();
341 bool backupAuthenticationDatabase( QString *backuppath
SIP_INOUT =
nullptr );
349 bool eraseAuthenticationDatabase(
bool backup, QString *backuppath
SIP_INOUT =
nullptr );
361 bool updateNetworkRequest( QNetworkRequest &request
SIP_INOUT,
const QString &authcfg,
362 const QString &dataprovider = QString() );
371 bool updateNetworkReply( QNetworkReply *reply,
const QString &authcfg,
372 const QString &dataprovider = QString() );
381 bool updateDataSourceUriItems( QStringList &connectionItems
SIP_INOUT,
const QString &authcfg,
382 const QString &dataprovider = QString() );
391 bool updateNetworkProxy( QNetworkProxy &proxy
SIP_INOUT,
const QString &authcfg,
392 const QString &dataprovider = QString() );
397 bool storeAuthSetting(
const QString &key,
const QVariant &value,
bool encrypt =
false );
407 QVariant authSetting(
const QString &key,
const QVariant &defaultValue = QVariant(),
bool decrypt =
false );
410 bool existsAuthSetting(
const QString &key );
413 bool removeAuthSetting(
const QString &key );
419 bool initSslCaches();
422 bool storeCertIdentity(
const QSslCertificate &cert,
const QSslKey &key );
430 const QSslCertificate certIdentity(
const QString &
id );
439 const QPair<QSslCertificate, QSslKey> certIdentityBundle(
const QString &
id )
SIP_SKIP;
447 const QStringList certIdentityBundleToPem(
const QString &
id );
454 const QList<QSslCertificate> certIdentities();
463 QStringList certIdentityIds()
const;
466 bool existsCertIdentity(
const QString &
id );
469 bool removeCertIdentity(
const QString &
id );
497 const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
500 bool existsSslCertCustomConfig(
const QString &
id,
const QString &hostport );
503 bool removeSslCertCustomConfig(
const QString &
id,
const QString &hostport );
514 void dumpIgnoredSslErrorsCache_();
520 bool updateIgnoredSslErrorsCache(
const QString &shahostport,
const QList<QSslError> &errors );
523 bool rebuildIgnoredSslErrorCache();
527 bool storeCertAuthorities(
const QList<QSslCertificate> &certs );
530 bool storeCertAuthority(
const QSslCertificate &cert );
540 const QSslCertificate certAuthority(
const QString &
id );
543 bool existsCertAuthority(
const QSslCertificate &cert );
546 bool removeCertAuthority(
const QSslCertificate &cert );
553 const QList<QSslCertificate> systemRootCAs();
560 const QList<QSslCertificate> extraFileCAs();
567 const QList<QSslCertificate> databaseCAs();
574 const QMap<QString, QSslCertificate> mappedDatabaseCAs();
584 return mCaCertsCache;
588 bool rebuildCaCertsCache();
602 bool removeCertTrustPolicies(
const QList<QSslCertificate> &certs );
605 bool removeCertTrustPolicy(
const QSslCertificate &cert );
626 const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList >
certTrustCache() {
return mCertTrustCache; }
629 bool rebuildCertTrustCache();
637 const QList<QSslCertificate> trustedCaCerts(
bool includeinvalid =
false );
644 const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
647 bool rebuildTrustedCaCertsCache();
661 const QByteArray trustedCaCertsPemText();
675 bool passwordHelperDelete()
SIP_SKIP;
681 bool passwordHelperEnabled() const;
687 void setPasswordHelperEnabled(
bool enabled );
693 bool passwordHelperLoggingEnabled() const
SIP_SKIP;
699 void setPasswordHelperLoggingEnabled(
bool enabled )
SIP_SKIP;
705 bool passwordHelperSync();
708 static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME;
711 static const QString AUTH_MAN_TAG;
719 void passwordHelperFailure();
725 void passwordHelperSuccess();
750 void masterPasswordVerified(
bool verified );
753 void authDatabaseEraseRequested();
756 void authDatabaseChanged();
760 void clearAllCachedConfigs();
763 void clearCachedConfig( const QString &authcfg );
777 void tryToStartDbErase();
802 QString passwordHelperName()
const;
805 void passwordHelperLog(
const QString &msg )
const;
808 QString passwordHelperRead();
811 bool passwordHelperWrite(
const QString &password );
814 void passwordHelperSetErrorMessage(
const QString &errorMessage ) { mPasswordHelperErrorMessage = errorMessage; }
817 void passwordHelperClearErrors();
823 void passwordHelperProcessError();
825 bool createConfigTables();
827 bool createCertTables();
829 bool masterPasswordInput();
831 bool masterPasswordRowsInDb(
int *rows )
const;
833 bool masterPasswordCheckAgainstDb(
const QString &compare = QString() )
const;
835 bool masterPasswordStoreInDb()
const;
837 bool masterPasswordClearDb();
839 const QString masterPasswordCiv()
const;
841 bool verifyPasswordCanDecryptConfigs()
const;
843 bool reencryptAllAuthenticationConfigs(
const QString &prevpass,
const QString &prevciv );
845 bool reencryptAuthenticationConfig(
const QString &authcfg,
const QString &prevpass,
const QString &prevciv );
847 bool reencryptAllAuthenticationSettings(
const QString &prevpass,
const QString &prevciv );
849 bool reencryptAllAuthenticationIdentities(
const QString &prevpass,
const QString &prevciv );
851 bool reencryptAuthenticationIdentity(
const QString &identid,
const QString &prevpass,
const QString &prevciv );
853 bool authDbOpen()
const;
855 bool authDbQuery( QSqlQuery *query )
const;
857 bool authDbStartTransaction()
const;
859 bool authDbCommit()
const;
861 bool authDbTransactionQuery( QSqlQuery *query )
const;
867 const QString authDbPassTable()
const {
return AUTH_PASS_TABLE; }
869 const QString authDbSettingsTable()
const {
return AUTH_SETTINGS_TABLE; }
871 const QString authDbIdentitiesTable()
const {
return AUTH_IDENTITIES_TABLE; }
873 const QString authDbAuthoritiesTable()
const {
return AUTH_AUTHORITIES_TABLE; }
875 const QString authDbTrustTable()
const {
return AUTH_TRUST_TABLE; }
878 static const QString AUTH_CONFIG_TABLE;
879 static const QString AUTH_PASS_TABLE;
880 static const QString AUTH_SETTINGS_TABLE;
881 static const QString AUTH_IDENTITIES_TABLE;
882 static const QString AUTH_SERVERS_TABLE;
883 static const QString AUTH_AUTHORITIES_TABLE;
884 static const QString AUTH_TRUST_TABLE;
885 static const QString AUTH_CFG_REGEX;
887 bool mAuthInit =
false;
890 std::unique_ptr<QCA::Initializer> mQcaInitializer;
892 QHash<QString, QString> mConfigAuthMethods;
893 QHash<QString, QgsAuthMethod *> mAuthMethods;
897 bool mAuthDisabled =
false;
898 QString mAuthDisabledMessage;
899 QTimer *mScheduledDbEraseTimer =
nullptr;
900 bool mScheduledDbErase =
false;
901 int mScheduledDbEraseRequestWait = 3 ;
902 bool mScheduledDbEraseRequestEmitted =
false;
903 int mScheduledDbEraseRequestCount = 0;
905 std::unique_ptr<QRecursiveMutex> mMutex;
906 std::unique_ptr<QRecursiveMutex> mMasterPasswordMutex;
910 QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> > mCaCertsCache;
912 QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
914 QList<QSslCertificate> mTrustedCaCertsCache;
916 QHash<QString, QSet<QSslError::SslError> > mIgnoredSslErrorsCache;
918 bool mHasCustomConfigByHost =
false;
919 bool mHasCheckedIfCustomConfigByHostExists =
false;
920 QMap< QString, QgsAuthConfigSslServer > mCustomConfigByHostCache;
927 bool mPasswordHelperVerificationError =
false;
930 QString mPasswordHelperErrorMessage;
933 QKeychain::Error mPasswordHelperErrorCode = QKeychain::NoError;
936 bool mPasswordHelperLoggingEnabled =
false;
939 bool mPasswordHelperFailedInit =
false;
942 static const QLatin1String AUTH_PASSWORD_HELPER_KEY_NAME;
945 static const QLatin1String AUTH_PASSWORD_HELPER_FOLDER_NAME;
947 mutable QMap<QThread *, QMetaObject::Connection> mConnectedThreads;