91 Q_ENUM( MessageLevel )
102 Q_DECL_DEPRECATED
bool init(
const QString &pluginPath = QString(),
const QString &authDatabasePath = QString() )
SIP_DEPRECATED;
114 void setup( const QString &pluginPath = QString(), const QString &authDatabasePath = QString() );
123 bool ensureInitialized() const;
138 Q_DECL_DEPRECATED QSqlDatabase authDatabaseConnection() const
SIP_DEPRECATED;
151 const QString methodConfigTableName()
const;
161 bool isDisabled()
const;
164 const QString disabledMessage()
const;
171 Q_DECL_DEPRECATED
const QString authenticationDatabasePath()
const;
176 static bool isFilesystemBasedDatabase(
const QString &uri );
189 const QString authenticationDatabaseUri() const;
195 const QString authenticationDatabaseUriStripped() const;
204 bool createAndStoreRandomMasterPasswordInKeyChain()
SIP_SKIP;
211 bool setMasterPassword(
bool verify = false );
219 bool setMasterPassword( const QString &password,
bool verify = false );
226 bool verifyMasterPassword( const QString &compare = QString() );
229 bool masterPasswordIsSet() const;
232 bool masterPasswordHashInDatabase() const;
244 bool masterPasswordSame(
const QString &password )
const;
255 bool resetMasterPassword(
const QString &newpass,
const QString &oldpass,
bool keepbackup, QString *backuppath
SIP_INOUT =
nullptr );
270 bool resetMasterPasswordUsingStoredPasswordHelper(
const QString &newPassword,
bool keepBackup, QString *backupPath =
nullptr )
SIP_SKIP;
290 void setScheduledAuthDatabaseErase(
bool scheduleErase )
SIP_SKIP;
306 bool registerCoreAuthMethods();
312 void updateConfigAuthMethods();
324 QString configAuthMethodKey(
const QString &authcfg )
const;
329 QStringList authMethodsKeys(
const QString &dataprovider = QString() );
359 QWidget *authMethodEditWidget(
const QString &authMethodKey, QWidget *parent );
370 const QString uniqueConfigId()
const;
376 bool configIdUnique(
const QString &
id )
const;
382 static bool hasConfigId(
const QString &txt );
388 QStringList configIds()
const;
419 bool removeAuthenticationConfig(
const QString &authcfg );
428 bool exportAuthenticationConfigsToXml(
const QString &filename,
const QStringList &authcfgs,
const QString &password = QString() );
437 bool importAuthenticationConfigsFromXml(
const QString &filename,
const QString &password = QString(),
bool overwrite =
false );
443 bool removeAllAuthenticationConfigs();
449 bool backupAuthenticationDatabase( QString *backuppath
SIP_INOUT =
nullptr );
457 bool eraseAuthenticationDatabase(
bool backup, QString *backuppath
SIP_INOUT =
nullptr );
469 bool updateNetworkRequest( QNetworkRequest &request
SIP_INOUT,
const QString &authcfg,
const QString &dataprovider = QString() );
478 bool updateNetworkReply( QNetworkReply *reply,
const QString &authcfg,
const QString &dataprovider = QString() );
487 bool updateDataSourceUriItems( QStringList &connectionItems
SIP_INOUT,
const QString &authcfg,
const QString &dataprovider = QString() );
496 bool updateNetworkProxy( QNetworkProxy &proxy
SIP_INOUT,
const QString &authcfg,
const QString &dataprovider = QString() );
507 bool storeAuthSetting(
const QString &key,
const QVariant &value,
bool encrypt =
false );
521 QVariant authSetting(
const QString &key,
const QVariant &defaultValue = QVariant(),
bool decrypt =
false );
524 bool existsAuthSetting(
const QString &key );
527 bool removeAuthSetting(
const QString &key );
533 bool initSslCaches();
536 bool storeCertIdentity(
const QSslCertificate &cert,
const QSslKey &key );
543 const QSslCertificate certIdentity(
const QString &
id );
551 const QPair<QSslCertificate, QSslKey> certIdentityBundle(
const QString &
id )
SIP_SKIP;
558 const QStringList certIdentityBundleToPem(
const QString &
id );
564 const QList<QSslCertificate> certIdentities();
572 QStringList certIdentityIds()
const;
575 bool existsCertIdentity(
const QString &
id );
578 bool removeCertIdentity(
const QString &
id );
603 const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
606 bool existsSslCertCustomConfig(
const QString &
id,
const QString &hostport );
609 bool removeSslCertCustomConfig(
const QString &
id,
const QString &hostport );
619 void dumpIgnoredSslErrorsCache_();
625 bool updateIgnoredSslErrorsCache(
const QString &shahostport,
const QList<QSslError> &errors );
628 bool rebuildIgnoredSslErrorCache();
632 bool storeCertAuthorities(
const QList<QSslCertificate> &certs );
635 bool storeCertAuthority(
const QSslCertificate &cert );
644 const QSslCertificate certAuthority(
const QString &
id );
647 bool existsCertAuthority(
const QSslCertificate &cert );
650 bool removeCertAuthority(
const QSslCertificate &cert );
656 static const QList<QSslCertificate> systemRootCAs();
662 const QList<QSslCertificate> extraFileCAs();
668 const QList<QSslCertificate> databaseCAs();
674 const QMap<QString, QSslCertificate> mappedDatabaseCAs();
681 const QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> >
caCertsCache()
SIP_SKIP {
return mCaCertsCache; }
684 bool rebuildCaCertsCache();
697 bool removeCertTrustPolicies(
const QList<QSslCertificate> &certs );
700 bool removeCertTrustPolicy(
const QSslCertificate &cert );
719 const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList >
certTrustCache() {
return mCertTrustCache; }
722 bool rebuildCertTrustCache();
729 const QList<QSslCertificate> trustedCaCerts(
bool includeinvalid =
false );
735 const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
738 bool rebuildTrustedCaCertsCache();
750 const QByteArray trustedCaCertsPemText();
764 bool passwordHelperDelete()
SIP_SKIP;
770 static
bool passwordHelperEnabled();
776 void setPasswordHelperEnabled(
bool enabled );
782 static
bool passwordHelperLoggingEnabled()
SIP_SKIP;
788 static
void setPasswordHelperLoggingEnabled(
bool enabled )
SIP_SKIP;
794 bool passwordHelperSync();
802 bool verifyStoredPasswordHelperPassword()
SIP_SKIP;
919 void tryToStartDbErase();
941 static QString generatePassword();
943 bool initPrivate(
const QString &pluginPath );
949 QString passwordHelperName()
const;
952 void passwordHelperLog(
const QString &msg )
const;
955 QString passwordHelperRead(
bool &ok );
958 bool passwordHelperWrite(
const QString &password );
961 void passwordHelperSetErrorMessage(
const QString &errorMessage ) { mPasswordHelperErrorMessage = errorMessage; }
964 void passwordHelperClearErrors();
970 void passwordHelperProcessError();
972 bool masterPasswordInput();
980 bool masterPasswordRowsInDb(
int &rows )
const;
982 bool masterPasswordCheckAgainstDb(
const QString &compare = QString() )
const;
984 bool masterPasswordStoreInDb()
const;
986 bool masterPasswordClearDb();
988 const QString masterPasswordCiv()
const;
990 bool verifyPasswordCanDecryptConfigs()
const;
992 bool reencryptAllAuthenticationConfigs(
const QString &prevpass,
const QString &prevciv );
994 bool reencryptAuthenticationConfig(
const QString &authcfg,
const QString &prevpass,
const QString &prevciv );
996 bool reencryptAllAuthenticationSettings(
const QString &prevpass,
const QString &prevciv );
998 bool reencryptAllAuthenticationIdentities(
const QString &prevpass,
const QString &prevciv );
1000 bool reencryptAuthenticationIdentity(
const QString &identid,
const QString &prevpass,
const QString &prevciv );
1006 QString authPasswordHelperKeyName()
const;
1014 static const QString AUTH_CONFIG_TABLE;
1015 static const QString AUTH_SERVERS_TABLE;
1016 static const QString AUTH_CFG_REGEX;
1018 QString mPluginPath;
1019 QString mAuthDatabaseConnectionUri;
1021 mutable bool mLazyInitResult =
false;
1022 bool mAuthInit =
false;
1024 mutable std::unique_ptr<QgsAuthConfigurationStorageRegistry> mAuthConfigurationStorageRegistry;
1026 std::unique_ptr<QCA::Initializer> mQcaInitializer;
1029 QHash<QString, QString> mConfigAuthMethods;
1030 QHash<QString, QgsAuthMethod *> mAuthMethods;
1032 QString mMasterPass;
1034 bool mAuthDisabled =
false;
1035 QString mAuthDisabledMessage;
1036 std::unique_ptr<QTimer> mScheduledDbEraseTimer;
1037 bool mScheduledDbErase =
false;
1038 int mScheduledDbEraseRequestWait = 3;
1039 bool mScheduledDbEraseRequestEmitted =
false;
1040 int mScheduledDbEraseRequestCount = 0;
1042 std::unique_ptr<QRecursiveMutex> mMutex;
1043 std::unique_ptr<QRecursiveMutex> mMasterPasswordMutex;
1047 QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> > mCaCertsCache;
1049 QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
1051 QList<QSslCertificate> mTrustedCaCertsCache;
1053 QHash<QString, QSet<QSslError::SslError> > mIgnoredSslErrorsCache;
1055 bool mHasCustomConfigByHost =
false;
1056 bool mHasCheckedIfCustomConfigByHostExists =
false;
1057 QMap< QString, QgsAuthConfigSslServer > mCustomConfigByHostCache;
1064 bool mPasswordHelperVerificationError =
false;
1067 QString mPasswordHelperErrorMessage;
1070 QKeychain::Error mPasswordHelperErrorCode = QKeychain::NoError;
1073 bool mPasswordHelperLoggingEnabled =
false;
1076 bool mPasswordHelperFailedInit =
false;
1079 static const QLatin1String AUTH_PASSWORD_HELPER_KEY_NAME_BASE;
1082 static const QLatin1String AUTH_PASSWORD_HELPER_FOLDER_NAME;
1084 mutable QMap<QThread *, QMetaObject::Connection> mConnectedThreads;