87 Q_ENUM( MessageLevel )
98 Q_DECL_DEPRECATED
bool init(
const QString &pluginPath = QString(),
const QString &authDatabasePath = QString() )
SIP_DEPRECATED;
110 void setup( const QString &pluginPath = QString(), const QString &authDatabasePath = QString() );
119 bool ensureInitialized() const;
134 Q_DECL_DEPRECATED QSqlDatabase authDatabaseConnection() const
SIP_DEPRECATED;
140 Q_DECL_DEPRECATED const QString authDatabaseConfigTable() const
SIP_DEPRECATED {
return AUTH_CONFIG_TABLE; }
147 const QString methodConfigTableName()
const;
157 bool isDisabled()
const;
160 const QString disabledMessage()
const;
167 Q_DECL_DEPRECATED
const QString authenticationDatabasePath()
const;
172 static bool isFilesystemBasedDatabase(
const QString &uri );
185 const QString authenticationDatabaseUri() const;
191 const QString authenticationDatabaseUriStripped() const;
200 bool createAndStoreRandomMasterPasswordInKeyChain()
SIP_SKIP;
207 bool setMasterPassword(
bool verify = false );
215 bool setMasterPassword( const QString &password,
bool verify = false );
222 bool verifyMasterPassword( const QString &compare = QString() );
225 bool masterPasswordIsSet() const;
228 bool masterPasswordHashInDatabase() const;
234 void clearMasterPassword() { mMasterPass = QString(); }
240 bool masterPasswordSame(
const QString &password )
const;
251 bool resetMasterPassword(
const QString &newpass,
const QString &oldpass,
bool keepbackup, QString *backuppath
SIP_INOUT =
nullptr );
266 bool resetMasterPasswordUsingStoredPasswordHelper(
const QString &newPassword,
bool keepBackup, QString *backupPath =
nullptr )
SIP_SKIP;
272 bool scheduledAuthDatabaseErase()
SIP_SKIP {
return mScheduledDbErase; }
286 void setScheduledAuthDatabaseErase(
bool scheduleErase )
SIP_SKIP;
302 bool registerCoreAuthMethods();
308 void updateConfigAuthMethods();
320 QString configAuthMethodKey(
const QString &authcfg )
const;
325 QStringList authMethodsKeys(
const QString &dataprovider = QString() );
355 QWidget *authMethodEditWidget(
const QString &authMethodKey, QWidget *parent );
366 const QString uniqueConfigId()
const;
372 bool configIdUnique(
const QString &
id )
const;
378 static bool hasConfigId(
const QString &txt );
384 QStringList configIds()
const;
415 bool removeAuthenticationConfig(
const QString &authcfg );
424 bool exportAuthenticationConfigsToXml(
const QString &filename,
const QStringList &authcfgs,
const QString &password = QString() );
433 bool importAuthenticationConfigsFromXml(
const QString &filename,
const QString &password = QString(),
bool overwrite =
false );
439 bool removeAllAuthenticationConfigs();
445 bool backupAuthenticationDatabase( QString *backuppath
SIP_INOUT =
nullptr );
453 bool eraseAuthenticationDatabase(
bool backup, QString *backuppath
SIP_INOUT =
nullptr );
465 bool updateNetworkRequest( QNetworkRequest &request
SIP_INOUT,
const QString &authcfg,
466 const QString &dataprovider = QString() );
475 bool updateNetworkReply( QNetworkReply *reply,
const QString &authcfg,
476 const QString &dataprovider = QString() );
485 bool updateDataSourceUriItems( QStringList &connectionItems
SIP_INOUT,
const QString &authcfg,
486 const QString &dataprovider = QString() );
495 bool updateNetworkProxy( QNetworkProxy &proxy
SIP_INOUT,
const QString &authcfg,
496 const QString &dataprovider = QString() );
501 bool storeAuthSetting(
const QString &key,
const QVariant &value,
bool encrypt =
false );
510 QVariant authSetting(
const QString &key,
const QVariant &defaultValue = QVariant(),
bool decrypt =
false );
513 bool existsAuthSetting(
const QString &key );
516 bool removeAuthSetting(
const QString &key );
522 bool initSslCaches();
525 bool storeCertIdentity(
const QSslCertificate &cert,
const QSslKey &key );
532 const QSslCertificate certIdentity(
const QString &
id );
540 const QPair<QSslCertificate, QSslKey> certIdentityBundle(
const QString &
id )
SIP_SKIP;
547 const QStringList certIdentityBundleToPem(
const QString &
id );
553 const QList<QSslCertificate> certIdentities();
561 QStringList certIdentityIds()
const;
564 bool existsCertIdentity(
const QString &
id );
567 bool removeCertIdentity(
const QString &
id );
592 const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
595 bool existsSslCertCustomConfig(
const QString &
id,
const QString &hostport );
598 bool removeSslCertCustomConfig(
const QString &
id,
const QString &hostport );
608 void dumpIgnoredSslErrorsCache_();
614 bool updateIgnoredSslErrorsCache(
const QString &shahostport,
const QList<QSslError> &errors );
617 bool rebuildIgnoredSslErrorCache();
621 bool storeCertAuthorities(
const QList<QSslCertificate> &certs );
624 bool storeCertAuthority(
const QSslCertificate &cert );
633 const QSslCertificate certAuthority(
const QString &
id );
636 bool existsCertAuthority(
const QSslCertificate &cert );
639 bool removeCertAuthority(
const QSslCertificate &cert );
645 static const QList<QSslCertificate> systemRootCAs();
651 const QList<QSslCertificate> extraFileCAs();
657 const QList<QSslCertificate> databaseCAs();
663 const QMap<QString, QSslCertificate> mappedDatabaseCAs();
672 return mCaCertsCache;
676 bool rebuildCaCertsCache();
689 bool removeCertTrustPolicies(
const QList<QSslCertificate> &certs );
692 bool removeCertTrustPolicy(
const QSslCertificate &cert );
711 const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList >
certTrustCache() {
return mCertTrustCache; }
714 bool rebuildCertTrustCache();
721 const QList<QSslCertificate> trustedCaCerts(
bool includeinvalid =
false );
727 const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
730 bool rebuildTrustedCaCertsCache();
742 const QByteArray trustedCaCertsPemText();
756 bool passwordHelperDelete()
SIP_SKIP;
762 static
bool passwordHelperEnabled();
768 void setPasswordHelperEnabled(
bool enabled );
774 static
bool passwordHelperLoggingEnabled()
SIP_SKIP;
780 static
void setPasswordHelperLoggingEnabled(
bool enabled )
SIP_SKIP;
786 bool passwordHelperSync();
794 bool verifyStoredPasswordHelperPassword()
SIP_SKIP;
803 static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME;
813 static QString passwordHelperDisplayName(
bool titleCase = false );
816 static const QString AUTH_MAN_TAG;
823 QString sqliteDatabasePath() const
SIP_SKIP;
831 void passwordHelperFailure();
837 void passwordHelperSuccess();
883 void masterPasswordVerified(
bool verified );
886 void authDatabaseEraseRequested();
889 void authDatabaseChanged();
893 void clearAllCachedConfigs();
896 void clearCachedConfig( const QString &authcfg );
910 void tryToStartDbErase();
934 static QString generatePassword();
936 bool initPrivate(
const QString &pluginPath );
942 QString passwordHelperName()
const;
945 void passwordHelperLog(
const QString &msg )
const;
948 QString passwordHelperRead(
bool &ok );
951 bool passwordHelperWrite(
const QString &password );
954 void passwordHelperSetErrorMessage(
const QString &errorMessage ) { mPasswordHelperErrorMessage = errorMessage; }
957 void passwordHelperClearErrors();
963 void passwordHelperProcessError();
965 bool masterPasswordInput();
967 bool masterPasswordRowsInDb(
int *rows )
const;
969 bool masterPasswordCheckAgainstDb(
const QString &compare = QString() )
const;
971 bool masterPasswordStoreInDb()
const;
973 bool masterPasswordClearDb();
975 const QString masterPasswordCiv()
const;
977 bool verifyPasswordCanDecryptConfigs()
const;
979 bool reencryptAllAuthenticationConfigs(
const QString &prevpass,
const QString &prevciv );
981 bool reencryptAuthenticationConfig(
const QString &authcfg,
const QString &prevpass,
const QString &prevciv );
983 bool reencryptAllAuthenticationSettings(
const QString &prevpass,
const QString &prevciv );
985 bool reencryptAllAuthenticationIdentities(
const QString &prevpass,
const QString &prevciv );
987 bool reencryptAuthenticationIdentity(
const QString &identid,
const QString &prevpass,
const QString &prevciv );
993 QString authPasswordHelperKeyName()
const;
1001 static const QString AUTH_CONFIG_TABLE;
1002 static const QString AUTH_SERVERS_TABLE;
1003 static const QString AUTH_CFG_REGEX;
1005 QString mPluginPath;
1006 QString mAuthDatabaseConnectionUri;
1008 mutable bool mLazyInitResult =
false;
1009 bool mAuthInit =
false;
1011 mutable std::unique_ptr<QgsAuthConfigurationStorageRegistry> mAuthConfigurationStorageRegistry;
1013 std::unique_ptr<QCA::Initializer> mQcaInitializer;
1015 QHash<QString, QString> mConfigAuthMethods;
1016 QHash<QString, QgsAuthMethod *> mAuthMethods;
1018 QString mMasterPass;
1020 bool mAuthDisabled =
false;
1021 QString mAuthDisabledMessage;
1022 QTimer *mScheduledDbEraseTimer =
nullptr;
1023 bool mScheduledDbErase =
false;
1024 int mScheduledDbEraseRequestWait = 3 ;
1025 bool mScheduledDbEraseRequestEmitted =
false;
1026 int mScheduledDbEraseRequestCount = 0;
1028 std::unique_ptr<QRecursiveMutex> mMutex;
1029 std::unique_ptr<QRecursiveMutex> mMasterPasswordMutex;
1033 QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> > mCaCertsCache;
1035 QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
1037 QList<QSslCertificate> mTrustedCaCertsCache;
1039 QHash<QString, QSet<QSslError::SslError> > mIgnoredSslErrorsCache;
1041 bool mHasCustomConfigByHost =
false;
1042 bool mHasCheckedIfCustomConfigByHostExists =
false;
1043 QMap< QString, QgsAuthConfigSslServer > mCustomConfigByHostCache;
1050 bool mPasswordHelperVerificationError =
false;
1053 QString mPasswordHelperErrorMessage;
1056 QKeychain::Error mPasswordHelperErrorCode = QKeychain::NoError;
1059 bool mPasswordHelperLoggingEnabled =
false;
1062 bool mPasswordHelperFailedInit =
false;
1065 static const QLatin1String AUTH_PASSWORD_HELPER_KEY_NAME_BASE;
1068 static const QLatin1String AUTH_PASSWORD_HELPER_FOLDER_NAME;
1070 mutable QMap<QThread *, QMetaObject::Connection> mConnectedThreads;