86 Q_ENUM( MessageLevel )
97 Q_DECL_DEPRECATED
bool init(
const QString &pluginPath = QString(),
const QString &authDatabasePath = QString() )
SIP_DEPRECATED;
109 void setup( const QString &pluginPath = QString(), const QString &authDatabasePath = QString() );
118 bool ensureInitialized() const;
133 Q_DECL_DEPRECATED QSqlDatabase authDatabaseConnection() const
SIP_DEPRECATED;
146 const QString methodConfigTableName()
const;
156 bool isDisabled()
const;
159 const QString disabledMessage()
const;
166 Q_DECL_DEPRECATED
const QString authenticationDatabasePath()
const;
171 static bool isFilesystemBasedDatabase(
const QString &uri );
184 const QString authenticationDatabaseUri() const;
190 const QString authenticationDatabaseUriStripped() const;
199 bool createAndStoreRandomMasterPasswordInKeyChain()
SIP_SKIP;
206 bool setMasterPassword(
bool verify = false );
214 bool setMasterPassword( const QString &password,
bool verify = false );
221 bool verifyMasterPassword( const QString &compare = QString() );
224 bool masterPasswordIsSet() const;
227 bool masterPasswordHashInDatabase() const;
239 bool masterPasswordSame(
const QString &password )
const;
250 bool resetMasterPassword(
const QString &newpass,
const QString &oldpass,
bool keepbackup, QString *backuppath
SIP_INOUT =
nullptr );
265 bool resetMasterPasswordUsingStoredPasswordHelper(
const QString &newPassword,
bool keepBackup, QString *backupPath =
nullptr )
SIP_SKIP;
285 void setScheduledAuthDatabaseErase(
bool scheduleErase )
SIP_SKIP;
301 bool registerCoreAuthMethods();
307 void updateConfigAuthMethods();
319 QString configAuthMethodKey(
const QString &authcfg )
const;
324 QStringList authMethodsKeys(
const QString &dataprovider = QString() );
354 QWidget *authMethodEditWidget(
const QString &authMethodKey, QWidget *parent );
365 const QString uniqueConfigId()
const;
371 bool configIdUnique(
const QString &
id )
const;
377 static bool hasConfigId(
const QString &txt );
383 QStringList configIds()
const;
414 bool removeAuthenticationConfig(
const QString &authcfg );
423 bool exportAuthenticationConfigsToXml(
const QString &filename,
const QStringList &authcfgs,
const QString &password = QString() );
432 bool importAuthenticationConfigsFromXml(
const QString &filename,
const QString &password = QString(),
bool overwrite =
false );
438 bool removeAllAuthenticationConfigs();
444 bool backupAuthenticationDatabase( QString *backuppath
SIP_INOUT =
nullptr );
452 bool eraseAuthenticationDatabase(
bool backup, QString *backuppath
SIP_INOUT =
nullptr );
464 bool updateNetworkRequest( QNetworkRequest &request
SIP_INOUT,
const QString &authcfg,
465 const QString &dataprovider = QString() );
474 bool updateNetworkReply( QNetworkReply *reply,
const QString &authcfg,
475 const QString &dataprovider = QString() );
484 bool updateDataSourceUriItems( QStringList &connectionItems
SIP_INOUT,
const QString &authcfg,
485 const QString &dataprovider = QString() );
494 bool updateNetworkProxy( QNetworkProxy &proxy
SIP_INOUT,
const QString &authcfg,
495 const QString &dataprovider = QString() );
506 bool storeAuthSetting(
const QString &key,
const QVariant &value,
bool encrypt =
false );
520 QVariant authSetting(
const QString &key,
const QVariant &defaultValue = QVariant(),
bool decrypt =
false );
523 bool existsAuthSetting(
const QString &key );
526 bool removeAuthSetting(
const QString &key );
532 bool initSslCaches();
535 bool storeCertIdentity(
const QSslCertificate &cert,
const QSslKey &key );
542 const QSslCertificate certIdentity(
const QString &
id );
550 const QPair<QSslCertificate, QSslKey> certIdentityBundle(
const QString &
id )
SIP_SKIP;
557 const QStringList certIdentityBundleToPem(
const QString &
id );
563 const QList<QSslCertificate> certIdentities();
571 QStringList certIdentityIds()
const;
574 bool existsCertIdentity(
const QString &
id );
577 bool removeCertIdentity(
const QString &
id );
602 const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
605 bool existsSslCertCustomConfig(
const QString &
id,
const QString &hostport );
608 bool removeSslCertCustomConfig(
const QString &
id,
const QString &hostport );
618 void dumpIgnoredSslErrorsCache_();
624 bool updateIgnoredSslErrorsCache(
const QString &shahostport,
const QList<QSslError> &errors );
627 bool rebuildIgnoredSslErrorCache();
631 bool storeCertAuthorities(
const QList<QSslCertificate> &certs );
634 bool storeCertAuthority(
const QSslCertificate &cert );
643 const QSslCertificate certAuthority(
const QString &
id );
646 bool existsCertAuthority(
const QSslCertificate &cert );
649 bool removeCertAuthority(
const QSslCertificate &cert );
655 static const QList<QSslCertificate> systemRootCAs();
661 const QList<QSslCertificate> extraFileCAs();
667 const QList<QSslCertificate> databaseCAs();
673 const QMap<QString, QSslCertificate> mappedDatabaseCAs();
682 return mCaCertsCache;
686 bool rebuildCaCertsCache();
699 bool removeCertTrustPolicies(
const QList<QSslCertificate> &certs );
702 bool removeCertTrustPolicy(
const QSslCertificate &cert );
721 const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList >
certTrustCache() {
return mCertTrustCache; }
724 bool rebuildCertTrustCache();
731 const QList<QSslCertificate> trustedCaCerts(
bool includeinvalid =
false );
737 const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
740 bool rebuildTrustedCaCertsCache();
752 const QByteArray trustedCaCertsPemText();
766 bool passwordHelperDelete()
SIP_SKIP;
772 static
bool passwordHelperEnabled();
778 void setPasswordHelperEnabled(
bool enabled );
784 static
bool passwordHelperLoggingEnabled()
SIP_SKIP;
790 static
void setPasswordHelperLoggingEnabled(
bool enabled )
SIP_SKIP;
796 bool passwordHelperSync();
804 bool verifyStoredPasswordHelperPassword()
SIP_SKIP;
920 void tryToStartDbErase();
944 static QString generatePassword();
946 bool initPrivate(
const QString &pluginPath );
952 QString passwordHelperName()
const;
955 void passwordHelperLog(
const QString &msg )
const;
958 QString passwordHelperRead(
bool &ok );
961 bool passwordHelperWrite(
const QString &password );
964 void passwordHelperSetErrorMessage(
const QString &errorMessage ) { mPasswordHelperErrorMessage = errorMessage; }
967 void passwordHelperClearErrors();
973 void passwordHelperProcessError();
975 bool masterPasswordInput();
983 bool masterPasswordRowsInDb(
int &rows )
const;
985 bool masterPasswordCheckAgainstDb(
const QString &compare = QString() )
const;
987 bool masterPasswordStoreInDb()
const;
989 bool masterPasswordClearDb();
991 const QString masterPasswordCiv()
const;
993 bool verifyPasswordCanDecryptConfigs()
const;
995 bool reencryptAllAuthenticationConfigs(
const QString &prevpass,
const QString &prevciv );
997 bool reencryptAuthenticationConfig(
const QString &authcfg,
const QString &prevpass,
const QString &prevciv );
999 bool reencryptAllAuthenticationSettings(
const QString &prevpass,
const QString &prevciv );
1001 bool reencryptAllAuthenticationIdentities(
const QString &prevpass,
const QString &prevciv );
1003 bool reencryptAuthenticationIdentity(
const QString &identid,
const QString &prevpass,
const QString &prevciv );
1009 QString authPasswordHelperKeyName()
const;
1017 static const QString AUTH_CONFIG_TABLE;
1018 static const QString AUTH_SERVERS_TABLE;
1019 static const QString AUTH_CFG_REGEX;
1021 QString mPluginPath;
1022 QString mAuthDatabaseConnectionUri;
1024 mutable bool mLazyInitResult =
false;
1025 bool mAuthInit =
false;
1027 mutable std::unique_ptr<QgsAuthConfigurationStorageRegistry> mAuthConfigurationStorageRegistry;
1029 std::unique_ptr<QCA::Initializer> mQcaInitializer;
1032 QHash<QString, QString> mConfigAuthMethods;
1033 QHash<QString, QgsAuthMethod *> mAuthMethods;
1035 QString mMasterPass;
1037 bool mAuthDisabled =
false;
1038 QString mAuthDisabledMessage;
1039 std::unique_ptr<QTimer> mScheduledDbEraseTimer;
1040 bool mScheduledDbErase =
false;
1041 int mScheduledDbEraseRequestWait = 3 ;
1042 bool mScheduledDbEraseRequestEmitted =
false;
1043 int mScheduledDbEraseRequestCount = 0;
1045 std::unique_ptr<QRecursiveMutex> mMutex;
1046 std::unique_ptr<QRecursiveMutex> mMasterPasswordMutex;
1050 QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> > mCaCertsCache;
1052 QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
1054 QList<QSslCertificate> mTrustedCaCertsCache;
1056 QHash<QString, QSet<QSslError::SslError> > mIgnoredSslErrorsCache;
1058 bool mHasCustomConfigByHost =
false;
1059 bool mHasCheckedIfCustomConfigByHostExists =
false;
1060 QMap< QString, QgsAuthConfigSslServer > mCustomConfigByHostCache;
1067 bool mPasswordHelperVerificationError =
false;
1070 QString mPasswordHelperErrorMessage;
1073 QKeychain::Error mPasswordHelperErrorCode = QKeychain::NoError;
1076 bool mPasswordHelperLoggingEnabled =
false;
1079 bool mPasswordHelperFailedInit =
false;
1082 static const QLatin1String AUTH_PASSWORD_HELPER_KEY_NAME_BASE;
1085 static const QLatin1String AUTH_PASSWORD_HELPER_FOLDER_NAME;
1087 mutable QMap<QThread *, QMetaObject::Connection> mConnectedThreads;