83 Q_ENUM( MessageLevel )
94 Q_DECL_DEPRECATED
bool init(
const QString &pluginPath = QString(),
const QString &authDatabasePath = QString() )
SIP_DEPRECATED;
106 void setup( const QString &pluginPath = QString(), const QString &authDatabasePath = QString() );
115 bool ensureInitialized() const;
130 Q_DECL_DEPRECATED QSqlDatabase authDatabaseConnection() const
SIP_DEPRECATED;
136 Q_DECL_DEPRECATED const QString authDatabaseConfigTable() const
SIP_DEPRECATED {
return AUTH_CONFIG_TABLE; }
143 const QString methodConfigTableName()
const;
153 bool isDisabled()
const;
156 const QString disabledMessage()
const;
163 Q_DECL_DEPRECATED
const QString authenticationDatabasePath()
const;
168 static bool isFilesystemBasedDatabase(
const QString &uri );
181 const QString authenticationDatabaseUri() const;
187 const QString authenticationDatabaseUriStripped() const;
194 bool setMasterPassword(
bool verify = false );
202 bool setMasterPassword( const QString &password,
bool verify = false );
209 bool verifyMasterPassword( const QString &compare = QString() );
212 bool masterPasswordIsSet() const;
215 bool masterPasswordHashInDatabase() const;
221 void clearMasterPassword() { mMasterPass = QString(); }
227 bool masterPasswordSame(
const QString &password )
const;
237 bool resetMasterPassword(
const QString &newpass,
const QString &oldpass,
bool keepbackup, QString *backuppath
SIP_INOUT =
nullptr );
257 void setScheduledAuthDatabaseErase(
bool scheduleErase )
SIP_SKIP;
273 bool registerCoreAuthMethods();
279 void updateConfigAuthMethods();
291 QString configAuthMethodKey(
const QString &authcfg )
const;
296 QStringList authMethodsKeys(
const QString &dataprovider = QString() );
326 QWidget *authMethodEditWidget(
const QString &authMethodKey, QWidget *parent );
337 const QString uniqueConfigId()
const;
343 bool configIdUnique(
const QString &
id )
const;
349 static bool hasConfigId(
const QString &txt );
355 QStringList configIds()
const;
386 bool removeAuthenticationConfig(
const QString &authcfg );
395 bool exportAuthenticationConfigsToXml(
const QString &filename,
const QStringList &authcfgs,
const QString &password = QString() );
404 bool importAuthenticationConfigsFromXml(
const QString &filename,
const QString &password = QString(),
bool overwrite =
false );
410 bool removeAllAuthenticationConfigs();
416 bool backupAuthenticationDatabase( QString *backuppath
SIP_INOUT =
nullptr );
424 bool eraseAuthenticationDatabase(
bool backup, QString *backuppath
SIP_INOUT =
nullptr );
436 bool updateNetworkRequest( QNetworkRequest &request
SIP_INOUT,
const QString &authcfg,
437 const QString &dataprovider = QString() );
446 bool updateNetworkReply( QNetworkReply *reply,
const QString &authcfg,
447 const QString &dataprovider = QString() );
456 bool updateDataSourceUriItems( QStringList &connectionItems
SIP_INOUT,
const QString &authcfg,
457 const QString &dataprovider = QString() );
466 bool updateNetworkProxy( QNetworkProxy &proxy
SIP_INOUT,
const QString &authcfg,
467 const QString &dataprovider = QString() );
472 bool storeAuthSetting(
const QString &key,
const QVariant &value,
bool encrypt =
false );
481 QVariant authSetting(
const QString &key,
const QVariant &defaultValue = QVariant(),
bool decrypt =
false );
484 bool existsAuthSetting(
const QString &key );
487 bool removeAuthSetting(
const QString &key );
493 bool initSslCaches();
496 bool storeCertIdentity(
const QSslCertificate &cert,
const QSslKey &key );
503 const QSslCertificate certIdentity(
const QString &
id );
511 const QPair<QSslCertificate, QSslKey> certIdentityBundle(
const QString &
id )
SIP_SKIP;
518 const QStringList certIdentityBundleToPem(
const QString &
id );
524 const QList<QSslCertificate> certIdentities();
532 QStringList certIdentityIds()
const;
535 bool existsCertIdentity(
const QString &
id );
538 bool removeCertIdentity(
const QString &
id );
563 const QList<QgsAuthConfigSslServer> sslCertCustomConfigs();
566 bool existsSslCertCustomConfig(
const QString &
id,
const QString &hostport );
569 bool removeSslCertCustomConfig(
const QString &
id,
const QString &hostport );
579 void dumpIgnoredSslErrorsCache_();
585 bool updateIgnoredSslErrorsCache(
const QString &shahostport,
const QList<QSslError> &errors );
588 bool rebuildIgnoredSslErrorCache();
592 bool storeCertAuthorities(
const QList<QSslCertificate> &certs );
595 bool storeCertAuthority(
const QSslCertificate &cert );
604 const QSslCertificate certAuthority(
const QString &
id );
607 bool existsCertAuthority(
const QSslCertificate &cert );
610 bool removeCertAuthority(
const QSslCertificate &cert );
616 static const QList<QSslCertificate> systemRootCAs();
622 const QList<QSslCertificate> extraFileCAs();
628 const QList<QSslCertificate> databaseCAs();
634 const QMap<QString, QSslCertificate> mappedDatabaseCAs();
643 return mCaCertsCache;
647 bool rebuildCaCertsCache();
660 bool removeCertTrustPolicies(
const QList<QSslCertificate> &certs );
663 bool removeCertTrustPolicy(
const QSslCertificate &cert );
682 const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList >
certTrustCache() {
return mCertTrustCache; }
685 bool rebuildCertTrustCache();
692 const QList<QSslCertificate> trustedCaCerts(
bool includeinvalid =
false );
698 const QList<QSslCertificate> untrustedCaCerts( QList<QSslCertificate> trustedCAs = QList<QSslCertificate>() );
701 bool rebuildTrustedCaCertsCache();
713 const QByteArray trustedCaCertsPemText();
727 bool passwordHelperDelete()
SIP_SKIP;
733 static
bool passwordHelperEnabled();
739 void setPasswordHelperEnabled(
bool enabled );
745 static
bool passwordHelperLoggingEnabled()
SIP_SKIP;
751 static
void setPasswordHelperLoggingEnabled(
bool enabled )
SIP_SKIP;
757 bool passwordHelperSync();
760 static const QString AUTH_PASSWORD_HELPER_DISPLAY_NAME;
763 static const QString AUTH_MAN_TAG;
772 void passwordHelperFailure();
778 void passwordHelperSuccess();
824 void masterPasswordVerified(
bool verified );
827 void authDatabaseEraseRequested();
830 void authDatabaseChanged();
834 void clearAllCachedConfigs();
837 void clearCachedConfig( const QString &authcfg );
851 void tryToStartDbErase();
872 bool initPrivate(
const QString &pluginPath );
878 QString passwordHelperName()
const;
881 void passwordHelperLog(
const QString &msg )
const;
884 QString passwordHelperRead();
887 bool passwordHelperWrite(
const QString &password );
890 void passwordHelperSetErrorMessage(
const QString &errorMessage ) { mPasswordHelperErrorMessage = errorMessage; }
893 void passwordHelperClearErrors();
899 void passwordHelperProcessError();
901 bool masterPasswordInput();
903 bool masterPasswordRowsInDb(
int *rows )
const;
905 bool masterPasswordCheckAgainstDb(
const QString &compare = QString() )
const;
907 bool masterPasswordStoreInDb()
const;
909 bool masterPasswordClearDb();
911 const QString masterPasswordCiv()
const;
913 bool verifyPasswordCanDecryptConfigs()
const;
915 bool reencryptAllAuthenticationConfigs(
const QString &prevpass,
const QString &prevciv );
917 bool reencryptAuthenticationConfig(
const QString &authcfg,
const QString &prevpass,
const QString &prevciv );
919 bool reencryptAllAuthenticationSettings(
const QString &prevpass,
const QString &prevciv );
921 bool reencryptAllAuthenticationIdentities(
const QString &prevpass,
const QString &prevciv );
923 bool reencryptAuthenticationIdentity(
const QString &identid,
const QString &prevpass,
const QString &prevciv );
929 QString authPasswordHelperKeyName()
const;
939 const QString sqliteDatabasePath()
const;
942 static const QString AUTH_CONFIG_TABLE;
943 static const QString AUTH_SERVERS_TABLE;
944 static const QString AUTH_CFG_REGEX;
947 QString mAuthDatabaseConnectionUri;
949 mutable bool mLazyInitResult =
false;
950 bool mAuthInit =
false;
952 mutable std::unique_ptr<QgsAuthConfigurationStorageRegistry> mAuthConfigurationStorageRegistry;
954 std::unique_ptr<QCA::Initializer> mQcaInitializer;
956 QHash<QString, QString> mConfigAuthMethods;
957 QHash<QString, QgsAuthMethod *> mAuthMethods;
961 bool mAuthDisabled =
false;
962 QString mAuthDisabledMessage;
963 QTimer *mScheduledDbEraseTimer =
nullptr;
964 bool mScheduledDbErase =
false;
965 int mScheduledDbEraseRequestWait = 3 ;
966 bool mScheduledDbEraseRequestEmitted =
false;
967 int mScheduledDbEraseRequestCount = 0;
969 std::unique_ptr<QRecursiveMutex> mMutex;
970 std::unique_ptr<QRecursiveMutex> mMasterPasswordMutex;
974 QMap<QString, QPair<QgsAuthCertUtils::CaCertSource, QSslCertificate> > mCaCertsCache;
976 QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > mCertTrustCache;
978 QList<QSslCertificate> mTrustedCaCertsCache;
980 QHash<QString, QSet<QSslError::SslError> > mIgnoredSslErrorsCache;
982 bool mHasCustomConfigByHost =
false;
983 bool mHasCheckedIfCustomConfigByHostExists =
false;
984 QMap< QString, QgsAuthConfigSslServer > mCustomConfigByHostCache;
991 bool mPasswordHelperVerificationError =
false;
994 QString mPasswordHelperErrorMessage;
997 QKeychain::Error mPasswordHelperErrorCode = QKeychain::NoError;
1000 bool mPasswordHelperLoggingEnabled =
false;
1003 bool mPasswordHelperFailedInit =
false;
1006 static const QLatin1String AUTH_PASSWORD_HELPER_KEY_NAME_BASE;
1009 static const QLatin1String AUTH_PASSWORD_HELPER_FOLDER_NAME;
1011 mutable QMap<QThread *, QMetaObject::Connection> mConnectedThreads;