QGIS API Documentation
3.20.0-Odense (decaadbb31)
|
Singleton offering an interface to manage the authentication configuration database and to utilize configurations through various authentication method plugins. More...
#include <qgsauthmanager.h>
Public Types | |
enum | MessageLevel { INFO = 0 , WARNING = 1 , CRITICAL = 2 } |
Message log level (mirrors that of QgsMessageLog, so it can also output there) More... | |
Public Slots | |
void | clearAllCachedConfigs () |
Clear all authentication configs from authentication method caches. More... | |
void | clearCachedConfig (const QString &authcfg) |
Clear an authentication config from its associated authentication method cache. More... | |
Signals | |
void | authDatabaseChanged () |
Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc. More... | |
void | authDatabaseEraseRequested () |
Emitted when a user has indicated they may want to erase the authentication db. More... | |
void | masterPasswordVerified (bool verified) |
Emitted when a password has been verify (or not) More... | |
void | messageOut (const QString &message, const QString &tag=QgsAuthManager::AUTH_MAN_TAG, QgsAuthManager::MessageLevel level=QgsAuthManager::INFO) const |
Custom logging signal to relay to console output and QgsMessageLog. More... | |
void | passwordHelperFailure () |
Signals emitted on password helper failure, mainly used in the tests to exit main application loop. More... | |
void | passwordHelperMessageOut (const QString &message, const QString &tag=QgsAuthManager::AUTH_MAN_TAG, QgsAuthManager::MessageLevel level=QgsAuthManager::INFO) |
Custom logging signal to inform the user about master password <-> password manager interactions. More... | |
void | passwordHelperSuccess () |
Signals emitted on password helper success, mainly used in the tests to exit main application loop. More... | |
Public Member Functions | |
~QgsAuthManager () override | |
const QString | authDatabaseConfigTable () const |
Name of the authentication database table that stores configs. More... | |
QSqlDatabase | authDatabaseConnection () const |
Sets up the application instance of the authentication database connection. More... | |
const QString | authDatabaseServersTable () const |
Name of the authentication database table that stores server exceptions/configs. More... | |
const QString | authenticationDatabasePath () const |
The standard authentication database file in ~/.qgis3/ or defined location. More... | |
QString | authManTag () const |
Simple text tag describing authentication system for message logs. More... | |
QgsAuthMethod * | authMethod (const QString &authMethodKey) |
Gets authentication method from the config/provider cache via its key. More... | |
QWidget * | authMethodEditWidget (const QString &authMethodKey, QWidget *parent) |
Gets authentication method edit widget via its key. More... | |
QStringList | authMethodsKeys (const QString &dataprovider=QString()) |
Gets keys of supported authentication methods. More... | |
QgsAuthMethodsMap | authMethodsMap (const QString &dataprovider=QString()) |
Gets available authentication methods mapped to their key. More... | |
QVariant | authSetting (const QString &key, const QVariant &defaultValue=QVariant(), bool decrypt=false) |
authSetting get an authentication setting (retrieved as string and returned as QVariant( QString )) More... | |
QgsAuthMethodConfigsMap | availableAuthMethodConfigs (const QString &dataprovider=QString()) |
Gets mapping of authentication config ids and their base configs (not decrypted data) More... | |
bool | backupAuthenticationDatabase (QString *backuppath=nullptr) |
Close connection to current authentication database and back it up. More... | |
const QMap< QString, QPair< QgsAuthCertUtils::CaCertSource, QSslCertificate > > | caCertsCache () |
caCertsCache get all CA certs mapped to their sha1 from cache. More... | |
const QSslCertificate | certAuthority (const QString &id) |
Gets a certificate authority by id (sha hash) More... | |
const QList< QSslCertificate > | certIdentities () |
certIdentities get certificate identities More... | |
const QSslCertificate | certIdentity (const QString &id) |
certIdentity get a certificate identity by id (sha hash) More... | |
const QPair< QSslCertificate, QSslKey > | certIdentityBundle (const QString &id) |
Gets a certificate identity bundle by id (sha hash). More... | |
const QStringList | certIdentityBundleToPem (const QString &id) |
certIdentityBundleToPem get a certificate identity bundle by id (sha hash) returned as PEM text More... | |
QStringList | certIdentityIds () const |
certIdentityIds get list of certificate identity ids from database More... | |
QgsAuthCertUtils::CertTrustPolicy | certificateTrustPolicy (const QSslCertificate &cert) |
certificateTrustPolicy get trust policy for a particular certificate cert More... | |
const QMap< QgsAuthCertUtils::CertTrustPolicy, QStringList > | certTrustCache () |
certTrustCache get cache of certificate sha1s, per trust policy More... | |
QgsAuthCertUtils::CertTrustPolicy | certTrustPolicy (const QSslCertificate &cert) |
certTrustPolicy get whether certificate cert is trusted by user More... | |
void | clearMasterPassword () |
Clear supplied master password. More... | |
QgsAuthMethod * | configAuthMethod (const QString &authcfg) |
Gets authentication method from the config/provider cache. More... | |
QString | configAuthMethodKey (const QString &authcfg) const |
Gets key of authentication method associated with config ID. More... | |
QString | configIdRegex () const |
Returns the regular expression for authcfg=.{7} key/value token for authentication ids. More... | |
QStringList | configIds () const |
Gets list of authentication ids from database. More... | |
bool | configIdUnique (const QString &id) const |
Verify if provided authentication id is unique. More... | |
const QList< QSslCertificate > | databaseCAs () |
databaseCAs get database-stored certificate authorities More... | |
QgsAuthCertUtils::CertTrustPolicy | defaultCertTrustPolicy () |
Gets the default certificate trust policy preferred by user. More... | |
const QString | disabledMessage () const |
Standard message for when QCA's qca-ossl plugin is missing and system is disabled. More... | |
void | dumpIgnoredSslErrorsCache_ () |
Utility function to dump the cache for debug purposes. More... | |
bool | eraseAuthenticationDatabase (bool backup, QString *backuppath=nullptr) |
Erase all rows from all tables in authentication database. More... | |
bool | existsAuthSetting (const QString &key) |
Check if an authentication setting exists. More... | |
bool | existsCertAuthority (const QSslCertificate &cert) |
Check if a certificate authority exists. More... | |
bool | existsCertIdentity (const QString &id) |
Check if a certificate identity exists. More... | |
bool | existsSslCertCustomConfig (const QString &id, const QString &hostport) |
Check if SSL certificate custom config exists. More... | |
bool | exportAuthenticationConfigsToXml (const QString &filename, const QStringList &authcfgs, const QString &password=QString()) |
Export authentication configurations to an XML file. More... | |
const QList< QSslCertificate > | extraFileCAs () |
extraFileCAs extra file-based certificate authorities More... | |
bool | hasConfigId (const QString &txt) const |
Returns whether a string includes an authcfg ID token. More... | |
QHash< QString, QSet< QSslError::SslError > > | ignoredSslErrorCache () |
ignoredSslErrorCache Get ignored SSL error cache, keyed with cert/connection's sha:host:port. More... | |
bool | importAuthenticationConfigsFromXml (const QString &filename, const QString &password=QString(), bool overwrite=false) |
Import authentication configurations from an XML file. More... | |
bool | init (const QString &pluginPath=QString(), const QString &authDatabasePath=QString()) |
init initialize QCA, prioritize qca-ossl plugin and optionally set up the authentication database More... | |
bool | initSslCaches () |
Initialize various SSL authentication caches. More... | |
bool | isDisabled () const |
Whether QCA has the qca-ossl plugin, which a base run-time requirement. More... | |
bool | loadAuthenticationConfig (const QString &authcfg, QgsAuthMethodConfig &mconfig, bool full=false) |
Load an authentication config from the database into subclass. More... | |
const QMap< QString, QSslCertificate > | mappedDatabaseCAs () |
mappedDatabaseCAs get sha1-mapped database-stored certificate authorities More... | |
bool | masterPasswordHashInDatabase () const |
Verify a password hash existing in authentication database. More... | |
bool | masterPasswordIsSet () const |
Whether master password has be input and verified, i.e. authentication database is accessible. More... | |
bool | masterPasswordSame (const QString &pass) const |
Check whether supplied password is the same as the one already set. More... | |
bool | passwordHelperDelete () |
Delete master password from wallet. More... | |
bool | passwordHelperEnabled () const |
Password helper enabled getter. More... | |
const QString | passwordHelperErrorMessage () |
Error message getter. More... | |
bool | passwordHelperLoggingEnabled () const |
Password helper logging enabled getter. More... | |
bool | passwordHelperSync () |
Store the password manager into the wallet. More... | |
bool | rebuildCaCertsCache () |
Rebuild certificate authority cache. More... | |
bool | rebuildCertTrustCache () |
Rebuild certificate authority cache. More... | |
bool | rebuildIgnoredSslErrorCache () |
Rebuild ignoredSSL error cache. More... | |
bool | rebuildTrustedCaCertsCache () |
Rebuild trusted certificate authorities cache. More... | |
bool | registerCoreAuthMethods () |
Instantiate and register existing C++ core authentication methods from plugins. More... | |
bool | removeAllAuthenticationConfigs () |
Clear all authentication configs from table in database and from provider caches. More... | |
bool | removeAuthenticationConfig (const QString &authcfg) |
Remove an authentication config in the database. More... | |
bool | removeAuthSetting (const QString &key) |
Remove an authentication setting. More... | |
bool | removeCertAuthority (const QSslCertificate &cert) |
Remove a certificate authority. More... | |
bool | removeCertIdentity (const QString &id) |
Remove a certificate identity. More... | |
bool | removeCertTrustPolicies (const QList< QSslCertificate > &certs) |
Remove a group certificate authorities. More... | |
bool | removeCertTrustPolicy (const QSslCertificate &cert) |
Remove a certificate authority. More... | |
bool | removeSslCertCustomConfig (const QString &id, const QString &hostport) |
Remove an SSL certificate custom config. More... | |
bool | resetMasterPassword (const QString &newpass, const QString &oldpass, bool keepbackup, QString *backuppath=nullptr) |
Reset the master password to a new one, then re-encrypt all previous configs in a new database file, optionally backup curren database. More... | |
bool | scheduledAuthDatabaseErase () |
Whether there is a scheduled opitonal erase of authentication database. More... | |
bool | setDefaultCertTrustPolicy (QgsAuthCertUtils::CertTrustPolicy policy) |
Sets the default certificate trust policy preferred by user. More... | |
bool | setMasterPassword (bool verify=false) |
Main call to initially set or continually check master password is set. More... | |
bool | setMasterPassword (const QString &pass, bool verify=false) |
Overloaded call to reset master password or set it initially without user interaction. More... | |
void | setPasswordHelperEnabled (bool enabled) |
Password helper enabled setter. More... | |
void | setPasswordHelperLoggingEnabled (bool enabled) |
Password helper logging enabled setter. More... | |
void | setScheduledAuthDatabaseErase (bool scheduleErase) |
Schedule an optional erase of authentication database, starting when mutex is lockable. More... | |
void | setScheduledAuthDatabaseEraseRequestEmitted (bool emitted) |
Re-emit a signal to schedule an optional erase of authentication database. More... | |
const QgsAuthConfigSslServer | sslCertCustomConfig (const QString &id, const QString &hostport) |
sslCertCustomConfig get an SSL certificate custom config by id (sha hash) and hostport (host:port) More... | |
const QgsAuthConfigSslServer | sslCertCustomConfigByHost (const QString &hostport) |
sslCertCustomConfigByHost get an SSL certificate custom config by hostport (host:port) More... | |
const QList< QgsAuthConfigSslServer > | sslCertCustomConfigs () |
sslCertCustomConfigs get SSL certificate custom configs More... | |
bool | storeAuthenticationConfig (QgsAuthMethodConfig &mconfig, bool overwrite=false) |
Store an authentication config in the database. More... | |
bool | storeAuthSetting (const QString &key, const QVariant &value, bool encrypt=false) |
Store an authentication setting (stored as string via QVariant( value ).toString() ) More... | |
bool | storeCertAuthorities (const QList< QSslCertificate > &certs) |
Store multiple certificate authorities. More... | |
bool | storeCertAuthority (const QSslCertificate &cert) |
Store a certificate authority. More... | |
bool | storeCertIdentity (const QSslCertificate &cert, const QSslKey &key) |
Store a certificate identity. More... | |
bool | storeCertTrustPolicy (const QSslCertificate &cert, QgsAuthCertUtils::CertTrustPolicy policy) |
Store user trust value for a certificate. More... | |
bool | storeSslCertCustomConfig (const QgsAuthConfigSslServer &config) |
Store an SSL certificate custom config. More... | |
QgsAuthMethod::Expansions | supportedAuthMethodExpansions (const QString &authcfg) |
Gets supported authentication method expansion(s), e.g. More... | |
const QList< QSslCertificate > | systemRootCAs () |
systemRootCAs get root system certificate authorities More... | |
const QList< QSslCertificate > | trustedCaCerts (bool includeinvalid=false) |
trustedCaCerts get list of all trusted CA certificates More... | |
const QList< QSslCertificate > | trustedCaCertsCache () |
trustedCaCertsCache cache of trusted certificate authorities, ready for network connections More... | |
const QByteArray | trustedCaCertsPemText () |
trustedCaCertsPemText get concatenated string of all trusted CA certificates More... | |
const QString | uniqueConfigId () const |
Gets a unique generated 7-character string to assign to as config id. More... | |
const QList< QSslCertificate > | untrustedCaCerts (QList< QSslCertificate > trustedCAs=QList< QSslCertificate >()) |
untrustedCaCerts get list of untrusted certificate authorities More... | |
bool | updateAuthenticationConfig (const QgsAuthMethodConfig &config) |
Update an authentication config in the database. More... | |
void | updateConfigAuthMethods () |
Sync the confg/authentication method cache with what is in database. More... | |
bool | updateDataSourceUriItems (QStringList &connectionItems, const QString &authcfg, const QString &dataprovider=QString()) |
Provider call to update a QgsDataSourceUri with an authentication config. More... | |
bool | updateIgnoredSslErrorsCache (const QString &shahostport, const QList< QSslError > &errors) |
Update ignored SSL error cache with possible ignored SSL errors, using sha:host:port key. More... | |
bool | updateIgnoredSslErrorsCacheFromConfig (const QgsAuthConfigSslServer &config) |
Update ignored SSL error cache with possible ignored SSL errors, using server config. More... | |
bool | updateNetworkProxy (QNetworkProxy &proxy, const QString &authcfg, const QString &dataprovider=QString()) |
Provider call to update a QNetworkProxy with an authentication config. More... | |
bool | updateNetworkReply (QNetworkReply *reply, const QString &authcfg, const QString &dataprovider=QString()) |
Provider call to update a QNetworkReply with an authentication config (used to skip known SSL errors, etc.) More... | |
bool | updateNetworkRequest (QNetworkRequest &request, const QString &authcfg, const QString &dataprovider=QString()) |
Provider call to update a QNetworkRequest with an authentication config. More... | |
bool | verifyMasterPassword (const QString &compare=QString()) |
Verify the supplied master password against any existing hash in authentication database. More... | |
Static Public Attributes | |
static const QString | AUTH_MAN_TAG = QObject::tr( "Authentication Manager" ) |
The display name of the Authentication Manager. More... | |
static const QString | AUTH_PASSWORD_HELPER_DISPLAY_NAME |
The display name of the password helper (platform dependent) More... | |
Protected Member Functions | |
QgsAuthManager () | |
Static Protected Member Functions | |
static QgsAuthManager * | instance () |
Enforce singleton pattern. More... | |
Friends | |
class | QgsApplication |
Singleton offering an interface to manage the authentication configuration database and to utilize configurations through various authentication method plugins.
QgsAuthManager should not usually be directly created, but rather accessed through QgsApplication::authManager().
Definition at line 68 of file qgsauthmanager.h.
Message log level (mirrors that of QgsMessageLog, so it can also output there)
Enumerator | |
---|---|
INFO | |
WARNING | |
CRITICAL |
Definition at line 75 of file qgsauthmanager.h.
|
override |
Definition at line 3148 of file qgsauthmanager.cpp.
|
explicitprotected |
Definition at line 103 of file qgsauthmanager.cpp.
|
signal |
Emitted when the authentication db is significantly changed, e.g. large record removal, erased, etc.
|
inline |
Name of the authentication database table that stores configs.
Definition at line 99 of file qgsauthmanager.h.
QSqlDatabase QgsAuthManager::authDatabaseConnection | ( | ) | const |
Sets up the application instance of the authentication database connection.
Definition at line 116 of file qgsauthmanager.cpp.
|
signal |
Emitted when a user has indicated they may want to erase the authentication db.
|
inline |
Name of the authentication database table that stores server exceptions/configs.
Definition at line 102 of file qgsauthmanager.h.
|
inline |
The standard authentication database file in ~/.qgis3/ or defined location.
Definition at line 115 of file qgsauthmanager.h.
|
inline |
Simple text tag describing authentication system for message logs.
Definition at line 198 of file qgsauthmanager.h.
QgsAuthMethod * QgsAuthManager::authMethod | ( | const QString & | authMethodKey | ) |
Gets authentication method from the config/provider cache via its key.
authMethodKey | Authentication method key |
Definition at line 1028 of file qgsauthmanager.cpp.
QWidget * QgsAuthManager::authMethodEditWidget | ( | const QString & | authMethodKey, |
QWidget * | parent | ||
) |
Gets authentication method edit widget via its key.
authMethodKey | Authentication method key |
parent | Parent widget |
Definition at line 1061 of file qgsauthmanager.cpp.
QStringList QgsAuthManager::authMethodsKeys | ( | const QString & | dataprovider = QString() | ) |
Gets keys of supported authentication methods.
Definition at line 1023 of file qgsauthmanager.cpp.
QgsAuthMethodsMap QgsAuthManager::authMethodsMap | ( | const QString & | dataprovider = QString() | ) |
Gets available authentication methods mapped to their key.
dataprovider | Provider key filter, returning only methods that support a particular provider |
Definition at line 1039 of file qgsauthmanager.cpp.
QVariant QgsAuthManager::authSetting | ( | const QString & | key, |
const QVariant & | defaultValue = QVariant() , |
||
bool | decrypt = false |
||
) |
authSetting get an authentication setting (retrieved as string and returned as QVariant( QString ))
key | setting key |
defaultValue | |
decrypt | if the value needs decrypted |
Definition at line 1724 of file qgsauthmanager.cpp.
QgsAuthMethodConfigsMap QgsAuthManager::availableAuthMethodConfigs | ( | const QString & | dataprovider = QString() | ) |
Gets mapping of authentication config ids and their base configs (not decrypted data)
Definition at line 924 of file qgsauthmanager.cpp.
bool QgsAuthManager::backupAuthenticationDatabase | ( | QString * | backuppath = nullptr | ) |
Close connection to current authentication database and back it up.
Definition at line 1464 of file qgsauthmanager.cpp.
|
inline |
caCertsCache get all CA certs mapped to their sha1 from cache.
Definition at line 573 of file qgsauthmanager.h.
const QSslCertificate QgsAuthManager::certAuthority | ( | const QString & | id | ) |
Gets a certificate authority by id (sha hash)
certAuthority get a certificate authority by id (sha hash)
id | sha hash |
Definition at line 2578 of file qgsauthmanager.cpp.
const QList< QSslCertificate > QgsAuthManager::certIdentities | ( | ) |
certIdentities get certificate identities
Definition at line 1993 of file qgsauthmanager.cpp.
const QSslCertificate QgsAuthManager::certIdentity | ( | const QString & | id | ) |
certIdentity get a certificate identity by id (sha hash)
id | sha hash of the cert |
Definition at line 1893 of file qgsauthmanager.cpp.
const QPair< QSslCertificate, QSslKey > QgsAuthManager::certIdentityBundle | ( | const QString & | id | ) |
Gets a certificate identity bundle by id (sha hash).
id | sha shash |
Definition at line 1927 of file qgsauthmanager.cpp.
const QStringList QgsAuthManager::certIdentityBundleToPem | ( | const QString & | id | ) |
certIdentityBundleToPem get a certificate identity bundle by id (sha hash) returned as PEM text
id | sha hash |
Definition at line 1982 of file qgsauthmanager.cpp.
QStringList QgsAuthManager::certIdentityIds | ( | ) | const |
certIdentityIds get list of certificate identity ids from database
Definition at line 2015 of file qgsauthmanager.cpp.
QgsAuthCertUtils::CertTrustPolicy QgsAuthManager::certificateTrustPolicy | ( | const QSslCertificate & | cert | ) |
certificateTrustPolicy get trust policy for a particular certificate cert
cert |
Definition at line 2890 of file qgsauthmanager.cpp.
|
inline |
certTrustCache get cache of certificate sha1s, per trust policy
Definition at line 617 of file qgsauthmanager.h.
QgsAuthCertUtils::CertTrustPolicy QgsAuthManager::certTrustPolicy | ( | const QSslCertificate & | cert | ) |
certTrustPolicy get whether certificate cert is trusted by user
cert |
Definition at line 2804 of file qgsauthmanager.cpp.
|
slot |
Clear all authentication configs from authentication method caches.
Definition at line 3060 of file qgsauthmanager.cpp.
|
slot |
Clear an authentication config from its associated authentication method cache.
Definition at line 3072 of file qgsauthmanager.cpp.
|
inline |
Clear supplied master password.
Definition at line 149 of file qgsauthmanager.h.
QgsAuthMethod * QgsAuthManager::configAuthMethod | ( | const QString & | authcfg | ) |
Gets authentication method from the config/provider cache.
authcfg | Authentication config id |
Definition at line 998 of file qgsauthmanager.cpp.
QString QgsAuthManager::configAuthMethodKey | ( | const QString & | authcfg | ) | const |
Gets key of authentication method associated with config ID.
authcfg |
Definition at line 1014 of file qgsauthmanager.cpp.
|
inline |
Returns the regular expression for authcfg=.{7} key/value token for authentication ids.
Definition at line 268 of file qgsauthmanager.h.
QStringList QgsAuthManager::configIds | ( | ) | const |
Gets list of authentication ids from database.
Definition at line 3522 of file qgsauthmanager.cpp.
bool QgsAuthManager::configIdUnique | ( | const QString & | id | ) | const |
Verify if provided authentication id is unique.
id | Id to check |
Definition at line 902 of file qgsauthmanager.cpp.
const QList< QSslCertificate > QgsAuthManager::databaseCAs | ( | ) |
databaseCAs get database-stored certificate authorities
Definition at line 2722 of file qgsauthmanager.cpp.
QgsAuthCertUtils::CertTrustPolicy QgsAuthManager::defaultCertTrustPolicy | ( | ) |
Gets the default certificate trust policy preferred by user.
Definition at line 2925 of file qgsauthmanager.cpp.
const QString QgsAuthManager::disabledMessage | ( | ) | const |
Standard message for when QCA's qca-ossl plugin is missing and system is disabled.
Definition at line 495 of file qgsauthmanager.cpp.
void QgsAuthManager::dumpIgnoredSslErrorsCache_ | ( | ) |
Utility function to dump the cache for debug purposes.
Definition at line 2366 of file qgsauthmanager.cpp.
bool QgsAuthManager::eraseAuthenticationDatabase | ( | bool | backup, |
QString * | backuppath = nullptr |
||
) |
Erase all rows from all tables in authentication database.
backup | Whether to backup of current database |
backuppath | Where the backup is locate |
Definition at line 1500 of file qgsauthmanager.cpp.
bool QgsAuthManager::existsAuthSetting | ( | const QString & | key | ) |
Check if an authentication setting exists.
Definition at line 1767 of file qgsauthmanager.cpp.
bool QgsAuthManager::existsCertAuthority | ( | const QSslCertificate & | cert | ) |
Check if a certificate authority exists.
Definition at line 2612 of file qgsauthmanager.cpp.
bool QgsAuthManager::existsCertIdentity | ( | const QString & | id | ) |
Check if a certificate identity exists.
Definition at line 2041 of file qgsauthmanager.cpp.
bool QgsAuthManager::existsSslCertCustomConfig | ( | const QString & | id, |
const QString & | hostport | ||
) |
Check if SSL certificate custom config exists.
Definition at line 2289 of file qgsauthmanager.cpp.
bool QgsAuthManager::exportAuthenticationConfigsToXml | ( | const QString & | filename, |
const QStringList & | authcfgs, | ||
const QString & | password = QString() |
||
) |
Export authentication configurations to an XML file.
filename | The file path to save the XML content to |
authcfgs | The list of configuration IDs to export |
password | A password string to encrypt the XML content |
Definition at line 1333 of file qgsauthmanager.cpp.
const QList< QSslCertificate > QgsAuthManager::extraFileCAs | ( | ) |
extraFileCAs extra file-based certificate authorities
Definition at line 2685 of file qgsauthmanager.cpp.
bool QgsAuthManager::hasConfigId | ( | const QString & | txt | ) | const |
Returns whether a string includes an authcfg ID token.
txt | String to check |
Definition at line 918 of file qgsauthmanager.cpp.
|
inline |
ignoredSslErrorCache Get ignored SSL error cache, keyed with cert/connection's sha:host:port.
Definition at line 502 of file qgsauthmanager.h.
bool QgsAuthManager::importAuthenticationConfigsFromXml | ( | const QString & | filename, |
const QString & | password = QString() , |
||
bool | overwrite = false |
||
) |
Import authentication configurations from an XML file.
filename | The file path from which the XML content will be read |
password | A password string to decrypt the XML content |
overwrite | If set to true , pre-existing authentication configurations will be overwritten |
Definition at line 1392 of file qgsauthmanager.cpp.
bool QgsAuthManager::init | ( | const QString & | pluginPath = QString() , |
const QString & | authDatabasePath = QString() |
||
) |
init initialize QCA, prioritize qca-ossl plugin and optionally set up the authentication database
pluginPath | the plugin path |
authDatabasePath | the authentication DB path |
true
on success Definition at line 179 of file qgsauthmanager.cpp.
bool QgsAuthManager::initSslCaches | ( | ) |
Initialize various SSL authentication caches.
Definition at line 1831 of file qgsauthmanager.cpp.
|
staticprotected |
Enforce singleton pattern.
Definition at line 91 of file qgsauthmanager.cpp.
bool QgsAuthManager::isDisabled | ( | ) | const |
Whether QCA has the qca-ossl plugin, which a base run-time requirement.
Definition at line 486 of file qgsauthmanager.cpp.
bool QgsAuthManager::loadAuthenticationConfig | ( | const QString & | authcfg, |
QgsAuthMethodConfig & | mconfig, | ||
bool | full = false |
||
) |
Load an authentication config from the database into subclass.
authcfg | Associated authentication config id |
mconfig | Subclassed config to load into |
full | Whether to decrypt and populate all sensitive data in subclass |
Definition at line 1232 of file qgsauthmanager.cpp.
const QMap< QString, QSslCertificate > QgsAuthManager::mappedDatabaseCAs | ( | ) |
mappedDatabaseCAs get sha1-mapped database-stored certificate authorities
Definition at line 2744 of file qgsauthmanager.cpp.
bool QgsAuthManager::masterPasswordHashInDatabase | ( | ) | const |
Verify a password hash existing in authentication database.
Definition at line 3428 of file qgsauthmanager.cpp.
bool QgsAuthManager::masterPasswordIsSet | ( | ) | const |
Whether master password has be input and verified, i.e. authentication database is accessible.
Definition at line 651 of file qgsauthmanager.cpp.
bool QgsAuthManager::masterPasswordSame | ( | const QString & | pass | ) | const |
Check whether supplied password is the same as the one already set.
pass | Password to verify |
Definition at line 656 of file qgsauthmanager.cpp.
|
signal |
Emitted when a password has been verify (or not)
verified | The state of password's verification |
|
signal |
Custom logging signal to relay to console output and QgsMessageLog.
message | Message to send |
tag | Associated tag (title) |
level | Message log level |
bool QgsAuthManager::passwordHelperDelete | ( | ) |
Delete master password from wallet.
Definition at line 3188 of file qgsauthmanager.cpp.
bool QgsAuthManager::passwordHelperEnabled | ( | ) | const |
Password helper enabled getter.
Definition at line 3295 of file qgsauthmanager.cpp.
|
inline |
Error message getter.
Definition at line 660 of file qgsauthmanager.h.
|
signal |
Signals emitted on password helper failure, mainly used in the tests to exit main application loop.
bool QgsAuthManager::passwordHelperLoggingEnabled | ( | ) | const |
Password helper logging enabled getter.
Definition at line 3312 of file qgsauthmanager.cpp.
|
signal |
Custom logging signal to inform the user about master password <-> password manager interactions.
message | Message to send |
tag | Associated tag (title) |
level | Message log level |
|
signal |
Signals emitted on password helper success, mainly used in the tests to exit main application loop.
bool QgsAuthManager::passwordHelperSync | ( | ) |
Store the password manager into the wallet.
Definition at line 3045 of file qgsauthmanager.cpp.
bool QgsAuthManager::rebuildCaCertsCache | ( | ) |
Rebuild certificate authority cache.
Definition at line 2750 of file qgsauthmanager.cpp.
bool QgsAuthManager::rebuildCertTrustCache | ( | ) |
Rebuild certificate authority cache.
Definition at line 2936 of file qgsauthmanager.cpp.
bool QgsAuthManager::rebuildIgnoredSslErrorCache | ( | ) |
Rebuild ignoredSSL error cache.
Definition at line 2463 of file qgsauthmanager.cpp.
bool QgsAuthManager::rebuildTrustedCaCertsCache | ( | ) |
Rebuild trusted certificate authorities cache.
Definition at line 3030 of file qgsauthmanager.cpp.
bool QgsAuthManager::registerCoreAuthMethods | ( | ) |
Instantiate and register existing C++ core authentication methods from plugins.
Definition at line 835 of file qgsauthmanager.cpp.
bool QgsAuthManager::removeAllAuthenticationConfigs | ( | ) |
Clear all authentication configs from table in database and from provider caches.
Definition at line 1443 of file qgsauthmanager.cpp.
bool QgsAuthManager::removeAuthenticationConfig | ( | const QString & | authcfg | ) |
Remove an authentication config in the database.
authcfg | Associated authentication config id |
Definition at line 1300 of file qgsauthmanager.cpp.
bool QgsAuthManager::removeAuthSetting | ( | const QString & | key | ) |
Remove an authentication setting.
Definition at line 1800 of file qgsauthmanager.cpp.
bool QgsAuthManager::removeCertAuthority | ( | const QSslCertificate & | cert | ) |
Remove a certificate authority.
Definition at line 2650 of file qgsauthmanager.cpp.
bool QgsAuthManager::removeCertIdentity | ( | const QString & | id | ) |
Remove a certificate identity.
Definition at line 2074 of file qgsauthmanager.cpp.
bool QgsAuthManager::removeCertTrustPolicies | ( | const QList< QSslCertificate > & | certs | ) |
Remove a group certificate authorities.
Definition at line 2842 of file qgsauthmanager.cpp.
bool QgsAuthManager::removeCertTrustPolicy | ( | const QSslCertificate & | cert | ) |
Remove a certificate authority.
Definition at line 2859 of file qgsauthmanager.cpp.
bool QgsAuthManager::removeSslCertCustomConfig | ( | const QString & | id, |
const QString & | hostport | ||
) |
Remove an SSL certificate custom config.
Definition at line 2327 of file qgsauthmanager.cpp.
bool QgsAuthManager::resetMasterPassword | ( | const QString & | newpass, |
const QString & | oldpass, | ||
bool | keepbackup, | ||
QString * | backuppath = nullptr |
||
) |
Reset the master password to a new one, then re-encrypt all previous configs in a new database file, optionally backup curren database.
newpass | New master password to replace existing |
oldpass | Current master password to replace existing |
keepbackup | Whether to keep the generated backup of current database |
backuppath | Where the backup is located, if kept |
Definition at line 661 of file qgsauthmanager.cpp.
|
inline |
Whether there is a scheduled opitonal erase of authentication database.
Definition at line 171 of file qgsauthmanager.h.
bool QgsAuthManager::setDefaultCertTrustPolicy | ( | QgsAuthCertUtils::CertTrustPolicy | policy | ) |
Sets the default certificate trust policy preferred by user.
Definition at line 2914 of file qgsauthmanager.cpp.
bool QgsAuthManager::setMasterPassword | ( | bool | verify = false | ) |
Main call to initially set or continually check master password is set.
verify | Whether password's hash was saved in authentication database |
Definition at line 500 of file qgsauthmanager.cpp.
bool QgsAuthManager::setMasterPassword | ( | const QString & | pass, |
bool | verify = false |
||
) |
Overloaded call to reset master password or set it initially without user interaction.
pass | Password to use |
verify | Whether password's hash was saved in authentication database |
Definition at line 532 of file qgsauthmanager.cpp.
void QgsAuthManager::setPasswordHelperEnabled | ( | bool | enabled | ) |
Password helper enabled setter.
Definition at line 3302 of file qgsauthmanager.cpp.
void QgsAuthManager::setPasswordHelperLoggingEnabled | ( | bool | enabled | ) |
Password helper logging enabled setter.
Definition at line 3319 of file qgsauthmanager.cpp.
void QgsAuthManager::setScheduledAuthDatabaseErase | ( | bool | scheduleErase | ) |
Schedule an optional erase of authentication database, starting when mutex is lockable.
Definition at line 808 of file qgsauthmanager.cpp.
|
inline |
Re-emit a signal to schedule an optional erase of authentication database.
emitted | Setting to false will cause signal to be emitted by the schedule timer. Setting to true will stop any emitting, but will not stop the schedule timer. |
Definition at line 195 of file qgsauthmanager.h.
const QgsAuthConfigSslServer QgsAuthManager::sslCertCustomConfig | ( | const QString & | id, |
const QString & | hostport | ||
) |
sslCertCustomConfig get an SSL certificate custom config by id (sha hash) and hostport (host:port)
id | sha hash |
hostport | string host:port |
Definition at line 2146 of file qgsauthmanager.cpp.
const QgsAuthConfigSslServer QgsAuthManager::sslCertCustomConfigByHost | ( | const QString & | hostport | ) |
sslCertCustomConfigByHost get an SSL certificate custom config by hostport (host:port)
hostport | host:port |
Definition at line 2188 of file qgsauthmanager.cpp.
const QList< QgsAuthConfigSslServer > QgsAuthManager::sslCertCustomConfigs | ( | ) |
sslCertCustomConfigs get SSL certificate custom configs
Definition at line 2262 of file qgsauthmanager.cpp.
bool QgsAuthManager::storeAuthenticationConfig | ( | QgsAuthMethodConfig & | mconfig, |
bool | overwrite = false |
||
) |
Store an authentication config in the database.
mconfig | Associated authentication config id |
overwrite | If set to true , pre-existing authentication configurations will be overwritten |
Definition at line 1079 of file qgsauthmanager.cpp.
bool QgsAuthManager::storeAuthSetting | ( | const QString & | key, |
const QVariant & | value, | ||
bool | encrypt = false |
||
) |
Store an authentication setting (stored as string via QVariant( value ).toString() )
Definition at line 1683 of file qgsauthmanager.cpp.
bool QgsAuthManager::storeCertAuthorities | ( | const QList< QSslCertificate > & | certs | ) |
Store multiple certificate authorities.
Definition at line 2525 of file qgsauthmanager.cpp.
bool QgsAuthManager::storeCertAuthority | ( | const QSslCertificate & | cert | ) |
Store a certificate authority.
Definition at line 2542 of file qgsauthmanager.cpp.
bool QgsAuthManager::storeCertIdentity | ( | const QSslCertificate & | cert, |
const QSslKey & | key | ||
) |
Store a certificate identity.
Definition at line 1849 of file qgsauthmanager.cpp.
bool QgsAuthManager::storeCertTrustPolicy | ( | const QSslCertificate & | cert, |
QgsAuthCertUtils::CertTrustPolicy | policy | ||
) |
Store user trust value for a certificate.
Definition at line 2765 of file qgsauthmanager.cpp.
bool QgsAuthManager::storeSslCertCustomConfig | ( | const QgsAuthConfigSslServer & | config | ) |
Store an SSL certificate custom config.
Definition at line 2102 of file qgsauthmanager.cpp.
QgsAuthMethod::Expansions QgsAuthManager::supportedAuthMethodExpansions | ( | const QString & | authcfg | ) |
Gets supported authentication method expansion(s), e.g.
NetworkRequest | DataSourceURI, as flags
authcfg |
Definition at line 1066 of file qgsauthmanager.cpp.
const QList< QSslCertificate > QgsAuthManager::systemRootCAs | ( | ) |
systemRootCAs get root system certificate authorities
Definition at line 2680 of file qgsauthmanager.cpp.
const QList< QSslCertificate > QgsAuthManager::trustedCaCerts | ( | bool | includeinvalid = false | ) |
trustedCaCerts get list of all trusted CA certificates
includeinvalid | whether invalid certs needs to be returned |
Definition at line 2970 of file qgsauthmanager.cpp.
|
inline |
trustedCaCertsCache cache of trusted certificate authorities, ready for network connections
Definition at line 645 of file qgsauthmanager.h.
const QByteArray QgsAuthManager::trustedCaCertsPemText | ( | ) |
trustedCaCertsPemText get concatenated string of all trusted CA certificates
Definition at line 3039 of file qgsauthmanager.cpp.
const QString QgsAuthManager::uniqueConfigId | ( | ) | const |
Gets a unique generated 7-character string to assign to as config id.
Definition at line 851 of file qgsauthmanager.cpp.
const QList< QSslCertificate > QgsAuthManager::untrustedCaCerts | ( | QList< QSslCertificate > | trustedCAs = QList<QSslCertificate>() | ) |
untrustedCaCerts get list of untrusted certificate authorities
Definition at line 3004 of file qgsauthmanager.cpp.
bool QgsAuthManager::updateAuthenticationConfig | ( | const QgsAuthMethodConfig & | config | ) |
Update an authentication config in the database.
config | Associated authentication config id |
Definition at line 1161 of file qgsauthmanager.cpp.
void QgsAuthManager::updateConfigAuthMethods | ( | ) |
Sync the confg/authentication method cache with what is in database.
Definition at line 969 of file qgsauthmanager.cpp.
bool QgsAuthManager::updateDataSourceUriItems | ( | QStringList & | connectionItems, |
const QString & | authcfg, | ||
const QString & | dataprovider = QString() |
||
) |
Provider call to update a QgsDataSourceUri with an authentication config.
connectionItems | The connection items, e.g. username=myname, of QgsDataSourceUri |
authcfg | Associated authentication config id |
dataprovider | Provider key filter, offering logic branching in authentication method |
Definition at line 1631 of file qgsauthmanager.cpp.
bool QgsAuthManager::updateIgnoredSslErrorsCache | ( | const QString & | shahostport, |
const QList< QSslError > & | errors | ||
) |
Update ignored SSL error cache with possible ignored SSL errors, using sha:host:port key.
Definition at line 2419 of file qgsauthmanager.cpp.
bool QgsAuthManager::updateIgnoredSslErrorsCacheFromConfig | ( | const QgsAuthConfigSslServer & | config | ) |
Update ignored SSL error cache with possible ignored SSL errors, using server config.
Definition at line 2390 of file qgsauthmanager.cpp.
bool QgsAuthManager::updateNetworkProxy | ( | QNetworkProxy & | proxy, |
const QString & | authcfg, | ||
const QString & | dataprovider = QString() |
||
) |
Provider call to update a QNetworkProxy with an authentication config.
proxy | the QNetworkProxy |
authcfg | Associated authentication config id |
dataprovider | Provider key filter, offering logic branching in authentication method |
Definition at line 1657 of file qgsauthmanager.cpp.
bool QgsAuthManager::updateNetworkReply | ( | QNetworkReply * | reply, |
const QString & | authcfg, | ||
const QString & | dataprovider = QString() |
||
) |
Provider call to update a QNetworkReply with an authentication config (used to skip known SSL errors, etc.)
reply | The QNetworkReply |
authcfg | Associated authentication config id |
dataprovider | Provider key filter, offering logic branching in authentication method |
Definition at line 1605 of file qgsauthmanager.cpp.
bool QgsAuthManager::updateNetworkRequest | ( | QNetworkRequest & | request, |
const QString & | authcfg, | ||
const QString & | dataprovider = QString() |
||
) |
Provider call to update a QNetworkRequest with an authentication config.
request | The QNetworkRequest |
authcfg | Associated authentication config id |
dataprovider | Provider key filter, offering logic branching in authentication method |
Definition at line 1580 of file qgsauthmanager.cpp.
bool QgsAuthManager::verifyMasterPassword | ( | const QString & | compare = QString() | ) |
Verify the supplied master password against any existing hash in authentication database.
compare | Password to compare against |
Definition at line 557 of file qgsauthmanager.cpp.
|
friend |
Definition at line 945 of file qgsauthmanager.h.
|
static |
The display name of the Authentication Manager.
Definition at line 702 of file qgsauthmanager.h.
|
static |
The display name of the password helper (platform dependent)
Definition at line 699 of file qgsauthmanager.h.