88 Q_ENUM( MessageLevel )
99 Q_DECL_DEPRECATED
bool init(
const QString &pluginPath = QString(),
const QString &authDatabasePath = QString() )
SIP_DEPRECATED;
111 void setup( const QString &pluginPath = QString(), const QString &authDatabasePath = QString() );
120 bool ensureInitialized() const;
135 Q_DECL_DEPRECATED QSqlDatabase authDatabaseConnection() const
SIP_DEPRECATED;
148 const QString methodConfigTableName()
const;
158 bool isDisabled()
const;
161 const QString disabledMessage()
const;
168 Q_DECL_DEPRECATED
const QString authenticationDatabasePath()
const;
173 static bool isFilesystemBasedDatabase(
const QString &uri );
186 const QString authenticationDatabaseUri() const;
192 const QString authenticationDatabaseUriStripped() const;
201 bool createAndStoreRandomMasterPasswordInKeyChain()
SIP_SKIP;
208 bool setMasterPassword(
bool verify = false );
216 bool setMasterPassword( const QString &password,
bool verify = false );
223 bool verifyMasterPassword( const QString &compare = QString() );
226 bool masterPasswordIsSet() const;
229 bool masterPasswordHashInDatabase() const;
241 bool masterPasswordSame(
const QString &password )
const;
252 bool resetMasterPassword(
const QString &newpass,
const QString &oldpass,
bool keepbackup, QString *backuppath
SIP_INOUT =
nullptr );
267 bool resetMasterPasswordUsingStoredPasswordHelper(
const QString &newPassword,
bool keepBackup, QString *backupPath =
nullptr )
SIP_SKIP;
287 void setScheduledAuthDatabaseErase(
bool scheduleErase )
SIP_SKIP;
303 bool registerCoreAuthMethods();
309 void updateConfigAuthMethods();
321 QString configAuthMethodKey(
const QString &authcfg )
const;
326 QStringList authMethodsKeys(
const QString &dataprovider = QString() );
356 QWidget *authMethodEditWidget(
const QString &authMethodKey, QWidget *parent );
367 const QString uniqueConfigId()
const;
373 bool configIdUnique(
const QString &
id )
const;
379 static bool hasConfigId(
const QString &txt );
385 QStringList configIds()
const;
416 bool removeAuthenticationConfig(
const QString &authcfg );
425 bool exportAuthenticationConfigsToXml(
const QString &filename,
const QStringList &authcfgs,
const QString &password = QString() );
434 bool importAuthenticationConfigsFromXml(
const QString &filename,
const QString &password = QString(),
bool overwrite =
false );
440 bool removeAllAuthenticationConfigs();
446 bool backupAuthenticationDatabase( QString *backuppath
SIP_INOUT =
nullptr );
454 bool eraseAuthenticationDatabase(
bool backup, QString *backuppath
SIP_INOUT =
nullptr );
466 bool updateNetworkRequest( QNetworkRequest &request
SIP_INOUT,
const QString &authcfg,
467 const QString &dataprovider = QString() );
476 bool updateNetworkReply( QNetworkReply *reply,
const QString &authcfg,
477 const QString &dataprovider = QString() );
486 bool updateDataSourceUriItems( QStringList &connectionItems
SIP_INOUT,
const QString &authcfg,
487 const QString &dataprovider = QString() );
496 bool updateNetworkProxy( QNetworkProxy &proxy
SIP_INOUT,
const QString &authcfg,
497 const QString &dataprovider = QString() );
508 bool storeAuthSetting(
const QString &key,
const QVariant &value,
bool encrypt =
false );
522 QVariant authSetting(
const QString &key,
const QVariant &defaultValue = QVariant(),
bool decrypt =
false );
525 bool existsAuthSetting(
const QString &key );
528 bool removeAuthSetting(
const QString &key );
534 bool initSslCaches();
537 bool storeCertIdentity(
const QSslCertificate &cert,
const QSslKey &key );
544 const QSslCertificate certIdentity(
const QString &
id );
552 const QPair<QSslCertificate, QSslKey> certIdentityBundle(
const QString &
id )
SIP_SKIP;
559 const QStringList certIdentityBundleToPem(
const QString &
id );
565 const QList<QSslCertificate> certIdentities();
573 QStringList certIdentityIds()
const;
576 bool existsCertIdentity(
const QString &
id );
579 bool removeCertIdentity(
const QString &
id );
604 const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
607 bool existsSslCertCustomConfig(
const QString &
id,
const QString &hostport );
610 bool removeSslCertCustomConfig(
const QString &
id,
const QString &hostport );
620 void dumpIgnoredSslErrorsCache_();
626 bool updateIgnoredSslErrorsCache(
const QString &shahostport,
const QList<QSslError> &errors );
629 bool rebuildIgnoredSslErrorCache();
633 bool storeCertAuthorities(
const QList<QSslCertificate> &certs );
636 bool storeCertAuthority(
const QSslCertificate &cert );
645 const QSslCertificate certAuthority(
const QString &
id );
648 bool existsCertAuthority(
const QSslCertificate &cert );
651 bool removeCertAuthority(
const QSslCertificate &cert );
657 static const QList<QSslCertificate> systemRootCAs();
663 const QList<QSslCertificate> extraFileCAs();
669 const QList<QSslCertificate> databaseCAs();
675 const QMap<QString, QSslCertificate> mappedDatabaseCAs();
684 return mCaCertsCache;
688 bool rebuildCaCertsCache();
701 bool removeCertTrustPolicies(
const QList<QSslCertificate> &certs );
704 bool removeCertTrustPolicy(
const QSslCertificate &cert );
723 const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList >
certTrustCache() {
return mCertTrustCache; }
726 bool rebuildCertTrustCache();
733 const QList<QSslCertificate> trustedCaCerts(
bool includeinvalid =
false );
739 const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
742 bool rebuildTrustedCaCertsCache();
754 const QByteArray trustedCaCertsPemText();
768 bool passwordHelperDelete()
SIP_SKIP;
774 static
bool passwordHelperEnabled();
780 void setPasswordHelperEnabled(
bool enabled );
786 static
bool passwordHelperLoggingEnabled()
SIP_SKIP;
792 static
void setPasswordHelperLoggingEnabled(
bool enabled )
SIP_SKIP;
798 bool passwordHelperSync();
806 bool verifyStoredPasswordHelperPassword()
SIP_SKIP;
922 void tryToStartDbErase();
946 static QString generatePassword();
948 bool initPrivate(
const QString &pluginPath );
954 QString passwordHelperName()
const;
957 void passwordHelperLog(
const QString &msg )
const;
960 QString passwordHelperRead(
bool &ok );
963 bool passwordHelperWrite(
const QString &password );
966 void passwordHelperSetErrorMessage(
const QString &errorMessage ) { mPasswordHelperErrorMessage = errorMessage; }
969 void passwordHelperClearErrors();
975 void passwordHelperProcessError();
977 bool masterPasswordInput();
985 bool masterPasswordRowsInDb(
int &rows )
const;
987 bool masterPasswordCheckAgainstDb(
const QString &compare = QString() )
const;
989 bool masterPasswordStoreInDb()
const;
991 bool masterPasswordClearDb();
993 const QString masterPasswordCiv()
const;
995 bool verifyPasswordCanDecryptConfigs()
const;
997 bool reencryptAllAuthenticationConfigs(
const QString &prevpass,
const QString &prevciv );
999 bool reencryptAuthenticationConfig(
const QString &authcfg,
const QString &prevpass,
const QString &prevciv );
1001 bool reencryptAllAuthenticationSettings(
const QString &prevpass,
const QString &prevciv );
1003 bool reencryptAllAuthenticationIdentities(
const QString &prevpass,
const QString &prevciv );
1005 bool reencryptAuthenticationIdentity(
const QString &identid,
const QString &prevpass,
const QString &prevciv );
1011 QString authPasswordHelperKeyName()
const;
1019 static const QString AUTH_CONFIG_TABLE;
1020 static const QString AUTH_SERVERS_TABLE;
1021 static const QString AUTH_CFG_REGEX;
1023 QString mPluginPath;
1024 QString mAuthDatabaseConnectionUri;
1026 mutable bool mLazyInitResult =
false;
1027 bool mAuthInit =
false;
1029 mutable std::unique_ptr<QgsAuthConfigurationStorageRegistry> mAuthConfigurationStorageRegistry;
1031 std::unique_ptr<QCA::Initializer> mQcaInitializer;
1033 QHash<QString, QString> mConfigAuthMethods;
1034 QHash<QString, QgsAuthMethod *> mAuthMethods;
1036 QString mMasterPass;
1038 bool mAuthDisabled =
false;
1039 QString mAuthDisabledMessage;
1040 std::unique_ptr<QTimer> mScheduledDbEraseTimer;
1041 bool mScheduledDbErase =
false;
1042 int mScheduledDbEraseRequestWait = 3 ;
1043 bool mScheduledDbEraseRequestEmitted =
false;
1044 int mScheduledDbEraseRequestCount = 0;
1046 std::unique_ptr<QRecursiveMutex> mMutex;
1047 std::unique_ptr<QRecursiveMutex> mMasterPasswordMutex;
1051 QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> > mCaCertsCache;
1053 QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
1055 QList<QSslCertificate> mTrustedCaCertsCache;
1057 QHash<QString, QSet<QSslError::SslError> > mIgnoredSslErrorsCache;
1059 bool mHasCustomConfigByHost =
false;
1060 bool mHasCheckedIfCustomConfigByHostExists =
false;
1061 QMap< QString, QgsAuthConfigSslServer > mCustomConfigByHostCache;
1068 bool mPasswordHelperVerificationError =
false;
1071 QString mPasswordHelperErrorMessage;
1074 QKeychain::Error mPasswordHelperErrorCode = QKeychain::NoError;
1077 bool mPasswordHelperLoggingEnabled =
false;
1080 bool mPasswordHelperFailedInit =
false;
1083 static const QLatin1String AUTH_PASSWORD_HELPER_KEY_NAME_BASE;
1086 static const QLatin1String AUTH_PASSWORD_HELPER_FOLDER_NAME;
1088 mutable QMap<QThread *, QMetaObject::Connection> mConnectedThreads;