81 Q_ENUM( MessageLevel )
92 Q_DECL_DEPRECATED
bool init(
const QString &pluginPath = QString(),
const QString &authDatabasePath = QString() )
SIP_DEPRECATED;
104 void setup( const QString &pluginPath = QString(), const QString &authDatabasePath = QString() );
113 bool ensureInitialized() const;
118 QSqlDatabase authDatabaseConnection() const;
121 const QString authDatabaseConfigTable()
const {
return AUTH_CONFIG_TABLE; }
128 bool isDisabled()
const;
131 const QString disabledMessage()
const;
144 bool setMasterPassword(
bool verify =
false );
152 bool setMasterPassword(
const QString &pass,
bool verify =
false );
159 bool verifyMasterPassword(
const QString &compare = QString() );
162 bool masterPasswordIsSet()
const;
165 bool masterPasswordHashInDatabase()
const;
177 bool masterPasswordSame(
const QString &pass )
const;
187 bool resetMasterPassword(
const QString &newpass,
const QString &oldpass,
bool keepbackup, QString *backuppath
SIP_INOUT =
nullptr );
207 void setScheduledAuthDatabaseErase(
bool scheduleErase )
SIP_SKIP;
223 bool registerCoreAuthMethods();
229 void updateConfigAuthMethods();
241 QString configAuthMethodKey(
const QString &authcfg )
const;
246 QStringList authMethodsKeys(
const QString &dataprovider = QString() );
276 QWidget *authMethodEditWidget(
const QString &authMethodKey, QWidget *parent );
287 const QString uniqueConfigId()
const;
293 bool configIdUnique(
const QString &
id )
const;
299 static bool hasConfigId(
const QString &txt );
305 QStringList configIds()
const;
336 bool removeAuthenticationConfig(
const QString &authcfg );
345 bool exportAuthenticationConfigsToXml(
const QString &filename,
const QStringList &authcfgs,
const QString &password = QString() );
354 bool importAuthenticationConfigsFromXml(
const QString &filename,
const QString &password = QString(),
bool overwrite =
false );
360 bool removeAllAuthenticationConfigs();
366 bool backupAuthenticationDatabase( QString *backuppath
SIP_INOUT =
nullptr );
374 bool eraseAuthenticationDatabase(
bool backup, QString *backuppath
SIP_INOUT =
nullptr );
386 bool updateNetworkRequest( QNetworkRequest &request
SIP_INOUT,
const QString &authcfg,
387 const QString &dataprovider = QString() );
396 bool updateNetworkReply( QNetworkReply *reply,
const QString &authcfg,
397 const QString &dataprovider = QString() );
406 bool updateDataSourceUriItems( QStringList &connectionItems
SIP_INOUT,
const QString &authcfg,
407 const QString &dataprovider = QString() );
416 bool updateNetworkProxy( QNetworkProxy &proxy
SIP_INOUT,
const QString &authcfg,
417 const QString &dataprovider = QString() );
422 bool storeAuthSetting(
const QString &key,
const QVariant &value,
bool encrypt =
false );
431 QVariant authSetting(
const QString &key,
const QVariant &defaultValue = QVariant(),
bool decrypt =
false );
434 bool existsAuthSetting(
const QString &key );
437 bool removeAuthSetting(
const QString &key );
443 bool initSslCaches();
446 bool storeCertIdentity(
const QSslCertificate &cert,
const QSslKey &key );
453 const QSslCertificate certIdentity(
const QString &
id );
461 const QPair<QSslCertificate, QSslKey> certIdentityBundle(
const QString &
id )
SIP_SKIP;
468 const QStringList certIdentityBundleToPem(
const QString &
id );
474 const QList<QSslCertificate> certIdentities();
482 QStringList certIdentityIds()
const;
485 bool existsCertIdentity(
const QString &
id );
488 bool removeCertIdentity(
const QString &
id );
513 const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
516 bool existsSslCertCustomConfig(
const QString &
id,
const QString &hostport );
519 bool removeSslCertCustomConfig(
const QString &
id,
const QString &hostport );
529 void dumpIgnoredSslErrorsCache_();
535 bool updateIgnoredSslErrorsCache(
const QString &shahostport,
const QList<QSslError> &errors );
538 bool rebuildIgnoredSslErrorCache();
542 bool storeCertAuthorities(
const QList<QSslCertificate> &certs );
545 bool storeCertAuthority(
const QSslCertificate &cert );
554 const QSslCertificate certAuthority(
const QString &
id );
557 bool existsCertAuthority(
const QSslCertificate &cert );
560 bool removeCertAuthority(
const QSslCertificate &cert );
566 static const QList<QSslCertificate> systemRootCAs();
572 const QList<QSslCertificate> extraFileCAs();
578 const QList<QSslCertificate> databaseCAs();
584 const QMap<QString, QSslCertificate> mappedDatabaseCAs();
593 return mCaCertsCache;
597 bool rebuildCaCertsCache();
610 bool removeCertTrustPolicies(
const QList<QSslCertificate> &certs );
613 bool removeCertTrustPolicy(
const QSslCertificate &cert );
632 const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList >
certTrustCache() {
return mCertTrustCache; }
635 bool rebuildCertTrustCache();
642 const QList<QSslCertificate> trustedCaCerts(
bool includeinvalid =
false );
648 const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
651 bool rebuildTrustedCaCertsCache();
663 const QByteArray trustedCaCertsPemText();
677 bool passwordHelperDelete()
SIP_SKIP;
683 static
bool passwordHelperEnabled();
689 void setPasswordHelperEnabled(
bool enabled );
695 static
bool passwordHelperLoggingEnabled()
SIP_SKIP;
701 static
void setPasswordHelperLoggingEnabled(
bool enabled )
SIP_SKIP;
707 bool passwordHelperSync();
710 static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME;
713 static const QString AUTH_MAN_TAG;
721 void passwordHelperFailure();
727 void passwordHelperSuccess();
752 void masterPasswordVerified(
bool verified );
755 void authDatabaseEraseRequested();
758 void authDatabaseChanged();
762 void clearAllCachedConfigs();
765 void clearCachedConfig( const QString &authcfg );
779 void tryToStartDbErase();
800 bool initPrivate(
const QString &pluginPath,
const QString &authDatabasePath );
806 QString passwordHelperName()
const;
809 void passwordHelperLog(
const QString &msg )
const;
812 QString passwordHelperRead();
815 bool passwordHelperWrite(
const QString &password );
818 void passwordHelperSetErrorMessage(
const QString &errorMessage ) { mPasswordHelperErrorMessage = errorMessage; }
821 void passwordHelperClearErrors();
827 void passwordHelperProcessError();
829 bool createConfigTables();
831 bool createCertTables();
833 bool masterPasswordInput();
835 bool masterPasswordRowsInDb(
int *rows )
const;
837 bool masterPasswordCheckAgainstDb(
const QString &compare = QString() )
const;
839 bool masterPasswordStoreInDb()
const;
841 bool masterPasswordClearDb();
843 const QString masterPasswordCiv()
const;
845 bool verifyPasswordCanDecryptConfigs()
const;
847 bool reencryptAllAuthenticationConfigs(
const QString &prevpass,
const QString &prevciv );
849 bool reencryptAuthenticationConfig(
const QString &authcfg,
const QString &prevpass,
const QString &prevciv );
851 bool reencryptAllAuthenticationSettings(
const QString &prevpass,
const QString &prevciv );
853 bool reencryptAllAuthenticationIdentities(
const QString &prevpass,
const QString &prevciv );
855 bool reencryptAuthenticationIdentity(
const QString &identid,
const QString &prevpass,
const QString &prevciv );
857 bool authDbOpen()
const;
859 bool authDbQuery( QSqlQuery *query )
const;
861 bool authDbStartTransaction()
const;
863 bool authDbCommit()
const;
865 bool authDbTransactionQuery( QSqlQuery *query )
const;
871 const QString authDbPassTable()
const {
return AUTH_PASS_TABLE; }
873 const QString authDbSettingsTable()
const {
return AUTH_SETTINGS_TABLE; }
875 const QString authDbIdentitiesTable()
const {
return AUTH_IDENTITIES_TABLE; }
877 const QString authDbAuthoritiesTable()
const {
return AUTH_AUTHORITIES_TABLE; }
879 const QString authDbTrustTable()
const {
return AUTH_TRUST_TABLE; }
881 QString authPasswordHelperKeyName()
const;
884 static const QString AUTH_CONFIG_TABLE;
885 static const QString AUTH_PASS_TABLE;
886 static const QString AUTH_SETTINGS_TABLE;
887 static const QString AUTH_IDENTITIES_TABLE;
888 static const QString AUTH_SERVERS_TABLE;
889 static const QString AUTH_AUTHORITIES_TABLE;
890 static const QString AUTH_TRUST_TABLE;
891 static const QString AUTH_CFG_REGEX;
894 QString mAuthDatabasePath;
895 mutable bool mLazyInitResult =
false;
897 bool mAuthInit =
false;
900 std::unique_ptr<QCA::Initializer> mQcaInitializer;
902 QHash<QString, QString> mConfigAuthMethods;
903 QHash<QString, QgsAuthMethod *> mAuthMethods;
907 bool mAuthDisabled =
false;
908 QString mAuthDisabledMessage;
909 QTimer *mScheduledDbEraseTimer =
nullptr;
910 bool mScheduledDbErase =
false;
911 int mScheduledDbEraseRequestWait = 3 ;
912 bool mScheduledDbEraseRequestEmitted =
false;
913 int mScheduledDbEraseRequestCount = 0;
915 std::unique_ptr<QRecursiveMutex> mMutex;
916 std::unique_ptr<QRecursiveMutex> mMasterPasswordMutex;
920 QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> > mCaCertsCache;
922 QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
924 QList<QSslCertificate> mTrustedCaCertsCache;
926 QHash<QString, QSet<QSslError::SslError> > mIgnoredSslErrorsCache;
928 bool mHasCustomConfigByHost =
false;
929 bool mHasCheckedIfCustomConfigByHostExists =
false;
930 QMap< QString, QgsAuthConfigSslServer > mCustomConfigByHostCache;
937 bool mPasswordHelperVerificationError =
false;
940 QString mPasswordHelperErrorMessage;
943 QKeychain::Error mPasswordHelperErrorCode = QKeychain::NoError;
946 bool mPasswordHelperLoggingEnabled =
false;
949 bool mPasswordHelperFailedInit =
false;
952 static const QLatin1String AUTH_PASSWORD_HELPER_KEY_NAME_BASE;
955 static const QLatin1String AUTH_PASSWORD_HELPER_FOLDER_NAME;
957 mutable QMap<QThread *, QMetaObject::Connection> mConnectedThreads;