85 Q_ENUM( MessageLevel )
96 Q_DECL_DEPRECATED
bool init(
const QString &pluginPath = QString(),
const QString &authDatabasePath = QString() )
SIP_DEPRECATED;
108 void setup( const QString &pluginPath = QString(), const QString &authDatabasePath = QString() );
117 bool ensureInitialized() const;
132 Q_DECL_DEPRECATED QSqlDatabase authDatabaseConnection() const
SIP_DEPRECATED;
145 const QString methodConfigTableName()
const;
155 bool isDisabled()
const;
158 const QString disabledMessage()
const;
165 Q_DECL_DEPRECATED
const QString authenticationDatabasePath()
const;
170 static bool isFilesystemBasedDatabase(
const QString &uri );
183 const QString authenticationDatabaseUri() const;
189 const QString authenticationDatabaseUriStripped() const;
198 bool createAndStoreRandomMasterPasswordInKeyChain()
SIP_SKIP;
205 bool setMasterPassword(
bool verify = false );
213 bool setMasterPassword( const QString &password,
bool verify = false );
220 bool verifyMasterPassword( const QString &compare = QString() );
223 bool masterPasswordIsSet() const;
226 bool masterPasswordHashInDatabase() const;
238 bool masterPasswordSame(
const QString &password )
const;
249 bool resetMasterPassword(
const QString &newpass,
const QString &oldpass,
bool keepbackup, QString *backuppath
SIP_INOUT =
nullptr );
264 bool resetMasterPasswordUsingStoredPasswordHelper(
const QString &newPassword,
bool keepBackup, QString *backupPath =
nullptr )
SIP_SKIP;
284 void setScheduledAuthDatabaseErase(
bool scheduleErase )
SIP_SKIP;
300 bool registerCoreAuthMethods();
306 void updateConfigAuthMethods();
318 QString configAuthMethodKey(
const QString &authcfg )
const;
323 QStringList authMethodsKeys(
const QString &dataprovider = QString() );
353 QWidget *authMethodEditWidget(
const QString &authMethodKey, QWidget *parent );
364 const QString uniqueConfigId()
const;
370 bool configIdUnique(
const QString &
id )
const;
376 static bool hasConfigId(
const QString &txt );
382 QStringList configIds()
const;
413 bool removeAuthenticationConfig(
const QString &authcfg );
422 bool exportAuthenticationConfigsToXml(
const QString &filename,
const QStringList &authcfgs,
const QString &password = QString() );
431 bool importAuthenticationConfigsFromXml(
const QString &filename,
const QString &password = QString(),
bool overwrite =
false );
437 bool removeAllAuthenticationConfigs();
443 bool backupAuthenticationDatabase( QString *backuppath
SIP_INOUT =
nullptr );
451 bool eraseAuthenticationDatabase(
bool backup, QString *backuppath
SIP_INOUT =
nullptr );
463 bool updateNetworkRequest( QNetworkRequest &request
SIP_INOUT,
const QString &authcfg,
const QString &dataprovider = QString() );
472 bool updateNetworkReply( QNetworkReply *reply,
const QString &authcfg,
const QString &dataprovider = QString() );
481 bool updateDataSourceUriItems( QStringList &connectionItems
SIP_INOUT,
const QString &authcfg,
const QString &dataprovider = QString() );
490 bool updateNetworkProxy( QNetworkProxy &proxy
SIP_INOUT,
const QString &authcfg,
const QString &dataprovider = QString() );
501 bool storeAuthSetting(
const QString &key,
const QVariant &value,
bool encrypt =
false );
515 QVariant authSetting(
const QString &key,
const QVariant &defaultValue = QVariant(),
bool decrypt =
false );
518 bool existsAuthSetting(
const QString &key );
521 bool removeAuthSetting(
const QString &key );
527 bool initSslCaches();
530 bool storeCertIdentity(
const QSslCertificate &cert,
const QSslKey &key );
537 const QSslCertificate certIdentity(
const QString &
id );
545 const QPair<QSslCertificate, QSslKey> certIdentityBundle(
const QString &
id )
SIP_SKIP;
552 const QStringList certIdentityBundleToPem(
const QString &
id );
558 const QList<QSslCertificate> certIdentities();
566 QStringList certIdentityIds()
const;
569 bool existsCertIdentity(
const QString &
id );
572 bool removeCertIdentity(
const QString &
id );
597 const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
600 bool existsSslCertCustomConfig(
const QString &
id,
const QString &hostport );
603 bool removeSslCertCustomConfig(
const QString &
id,
const QString &hostport );
613 void dumpIgnoredSslErrorsCache_();
619 bool updateIgnoredSslErrorsCache(
const QString &shahostport,
const QList<QSslError> &errors );
622 bool rebuildIgnoredSslErrorCache();
626 bool storeCertAuthorities(
const QList<QSslCertificate> &certs );
629 bool storeCertAuthority(
const QSslCertificate &cert );
638 const QSslCertificate certAuthority(
const QString &
id );
641 bool existsCertAuthority(
const QSslCertificate &cert );
644 bool removeCertAuthority(
const QSslCertificate &cert );
650 static const QList<QSslCertificate> systemRootCAs();
656 const QList<QSslCertificate> extraFileCAs();
662 const QList<QSslCertificate> databaseCAs();
668 const QMap<QString, QSslCertificate> mappedDatabaseCAs();
675 const QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> >
caCertsCache()
SIP_SKIP {
return mCaCertsCache; }
678 bool rebuildCaCertsCache();
691 bool removeCertTrustPolicies(
const QList<QSslCertificate> &certs );
694 bool removeCertTrustPolicy(
const QSslCertificate &cert );
713 const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList >
certTrustCache() {
return mCertTrustCache; }
716 bool rebuildCertTrustCache();
723 const QList<QSslCertificate> trustedCaCerts(
bool includeinvalid =
false );
729 const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
732 bool rebuildTrustedCaCertsCache();
744 const QByteArray trustedCaCertsPemText();
758 bool passwordHelperDelete()
SIP_SKIP;
764 static
bool passwordHelperEnabled();
770 void setPasswordHelperEnabled(
bool enabled );
776 static
bool passwordHelperLoggingEnabled()
SIP_SKIP;
782 static
void setPasswordHelperLoggingEnabled(
bool enabled )
SIP_SKIP;
788 bool passwordHelperSync();
796 bool verifyStoredPasswordHelperPassword()
SIP_SKIP;
913 void tryToStartDbErase();
935 static QString generatePassword();
937 bool initPrivate(
const QString &pluginPath );
943 QString passwordHelperName()
const;
946 void passwordHelperLog(
const QString &msg )
const;
949 QString passwordHelperRead(
bool &ok );
952 bool passwordHelperWrite(
const QString &password );
955 void passwordHelperSetErrorMessage(
const QString &errorMessage ) { mPasswordHelperErrorMessage = errorMessage; }
958 void passwordHelperClearErrors();
964 void passwordHelperProcessError();
966 bool masterPasswordInput();
974 bool masterPasswordRowsInDb(
int &rows )
const;
976 bool masterPasswordCheckAgainstDb(
const QString &compare = QString() )
const;
978 bool masterPasswordStoreInDb()
const;
980 bool masterPasswordClearDb();
982 const QString masterPasswordCiv()
const;
984 bool verifyPasswordCanDecryptConfigs()
const;
986 bool reencryptAllAuthenticationConfigs(
const QString &prevpass,
const QString &prevciv );
988 bool reencryptAuthenticationConfig(
const QString &authcfg,
const QString &prevpass,
const QString &prevciv );
990 bool reencryptAllAuthenticationSettings(
const QString &prevpass,
const QString &prevciv );
992 bool reencryptAllAuthenticationIdentities(
const QString &prevpass,
const QString &prevciv );
994 bool reencryptAuthenticationIdentity(
const QString &identid,
const QString &prevpass,
const QString &prevciv );
1000 QString authPasswordHelperKeyName()
const;
1008 static const QString AUTH_CONFIG_TABLE;
1009 static const QString AUTH_SERVERS_TABLE;
1010 static const QString AUTH_CFG_REGEX;
1012 QString mPluginPath;
1013 QString mAuthDatabaseConnectionUri;
1015 mutable bool mLazyInitResult =
false;
1016 bool mAuthInit =
false;
1018 mutable std::unique_ptr<QgsAuthConfigurationStorageRegistry> mAuthConfigurationStorageRegistry;
1020 std::unique_ptr<QCA::Initializer> mQcaInitializer;
1023 QHash<QString, QString> mConfigAuthMethods;
1024 QHash<QString, QgsAuthMethod *> mAuthMethods;
1026 QString mMasterPass;
1028 bool mAuthDisabled =
false;
1029 QString mAuthDisabledMessage;
1030 std::unique_ptr<QTimer> mScheduledDbEraseTimer;
1031 bool mScheduledDbErase =
false;
1032 int mScheduledDbEraseRequestWait = 3;
1033 bool mScheduledDbEraseRequestEmitted =
false;
1034 int mScheduledDbEraseRequestCount = 0;
1036 std::unique_ptr<QRecursiveMutex> mMutex;
1037 std::unique_ptr<QRecursiveMutex> mMasterPasswordMutex;
1041 QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> > mCaCertsCache;
1043 QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
1045 QList<QSslCertificate> mTrustedCaCertsCache;
1047 QHash<QString, QSet<QSslError::SslError> > mIgnoredSslErrorsCache;
1049 bool mHasCustomConfigByHost =
false;
1050 bool mHasCheckedIfCustomConfigByHostExists =
false;
1051 QMap< QString, QgsAuthConfigSslServer > mCustomConfigByHostCache;
1058 bool mPasswordHelperVerificationError =
false;
1061 QString mPasswordHelperErrorMessage;
1064 QKeychain::Error mPasswordHelperErrorCode = QKeychain::NoError;
1067 bool mPasswordHelperLoggingEnabled =
false;
1070 bool mPasswordHelperFailedInit =
false;
1073 static const QLatin1String AUTH_PASSWORD_HELPER_KEY_NAME_BASE;
1076 static const QLatin1String AUTH_PASSWORD_HELPER_FOLDER_NAME;
1078 mutable QMap<QThread *, QMetaObject::Connection> mConnectedThreads;