QGIS API Documentation  2.14.0-Essen
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsAuthManager Class Reference

Singleton offering an interface to manage the authentication configuration database and to utilize configurations through various authentication method plugins. More...

#include <qgsauthmanager.h>

Inheritance diagram for QgsAuthManager:
Inheritance graph
[legend]

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 () const
 Emitted when the authentication db is significantly changed, e.g. More...
 
void authDatabaseEraseRequested () const
 Emitted when a user has indicated they may want to erase the authentication db. More...
 
void masterPasswordVerified (bool verified) const
 Emitted when a password has been verify (or not) More...
 
void messageOut (const QString &message, const QString &tag=smAuthManTag, QgsAuthManager::MessageLevel level=INFO) const
 Custom logging signal to relay to console output and QgsMessageLog. More...
 

Public Member Functions

 ~QgsAuthManager ()
 
const QString authDbConfigTable () const
 Name of the authentication database table that stores configs. More...
 
QSqlDatabase authDbConnection () const
 Set up the application instance of the authentication database connection. More...
 
const QString authDbServersTable () const
 Name of the authentication database table that stores server exceptions/configs. More...
 
const QString authenticationDbPath () const
 The standard authentication database file in ~/.qgis2/ or defined location. More...
 
QString authManTag () const
 Simple text tag describing authentication system for message logs. More...
 
QgsAuthMethodauthMethod (const QString &authMethodKey)
 Get authentication method from the config/provider cache via its key. More...
 
QWidgetauthMethodEditWidget (const QString &authMethodKey, QWidget *parent)
 Get authentication method edit widget via its key. More...
 
QStringList authMethodsKeys (const QString &dataprovider=QString())
 Get keys of supported authentication methods. More...
 
QgsAuthMethodsMap authMethodsMap (const QString &dataprovider=QString())
 Get available authentication methods mapped to their key. More...
 
QgsAuthMethodConfigsMap availableAuthMethodConfigs (const QString &dataprovider=QString())
 Get 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...
 
void clearMasterPassword ()
 Clear supplied master password. More...
 
QgsAuthMethodconfigAuthMethod (const QString &authcfg)
 Get authentication method from the config/provider cache. More...
 
QString configAuthMethodKey (const QString &authcfg) const
 Get key of authentication method associated with config ID. More...
 
QString configIdRegex () const
 Return regular expression for authcfg=. More...
 
QStringList configIds () const
 Get list of authentication ids from database. More...
 
bool configIdUnique (const QString &id) const
 Verify if provided authentication id is unique. More...
 
QgsAuthCertUtils::CertTrustPolicy defaultCertTrustPolicy ()
 Get the default certificate trust policy perferred 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...
 
QVariant getAuthSetting (const QString &key, const QVariant &defaultValue=QVariant(), bool decrypt=false)
 Get an authentication setting (retrieved as string and returned as QVariant( QString )) More...
 
const QMap< QString, QPair< QgsAuthCertUtils::CaCertSource, QSslCertificate > > getCaCertsCache ()
 Get all CA certs mapped to their sha1 from cache. More...
 
const QSslCertificate getCertAuthority (const QString &id)
 Get a certificate authority by id (sha hash) More...
 
const QList< QSslCertificategetCertIdentities ()
 Get certificate identities. More...
 
const QSslCertificate getCertIdentity (const QString &id)
 Get a certificate identity by id (sha hash) More...
 
const QPair< QSslCertificate, QSslKeygetCertIdentityBundle (const QString &id)
 Get a certificate identity bundle by id (sha hash). More...
 
const QStringList getCertIdentityBundleToPem (const QString &id)
 Get a certificate identity bundle by id (sha hash) returned as PEM text. More...
 
QStringList getCertIdentityIds () const
 Get list of certificate identity ids from database. More...
 
QgsAuthCertUtils::CertTrustPolicy getCertificateTrustPolicy (const QSslCertificate &cert)
 Get trust policy for a particular certificate. More...
 
const QMap< QgsAuthCertUtils::CertTrustPolicy, QStringListgetCertTrustCache ()
 Get cache of certificate sha1s, per trust policy. More...
 
QgsAuthCertUtils::CertTrustPolicy getCertTrustPolicy (const QSslCertificate &cert)
 Get a whether certificate is trusted by user. More...
 
const QList< QSslCertificategetDatabaseCAs ()
 Get database-stored certificate authorities. More...
 
const QList< QSslCertificategetExtraFileCAs ()
 Get extra file-based certificate authorities. More...
 
QHash< QString, QSet< QSslError::SslError > > getIgnoredSslErrorCache ()
 Get ignored SSL error cache, keyed with cert/connection's sha:host:port. More...
 
const QMap< QString, QSslCertificategetMappedDatabaseCAs ()
 Get sha1-mapped database-stored certificate authorities. More...
 
const QgsAuthConfigSslServer getSslCertCustomConfig (const QString &id, const QString &hostport)
 Get an SSL certificate custom config by id (sha hash) and host:port. More...
 
const QgsAuthConfigSslServer getSslCertCustomConfigByHost (const QString &hostport)
 Get an SSL certificate custom config by host:port. More...
 
const QList< QgsAuthConfigSslServergetSslCertCustomConfigs ()
 Get SSL certificate custom configs. More...
 
const QList< QSslCertificategetSystemRootCAs ()
 Get root system certificate authorities. More...
 
const QList< QSslCertificategetTrustedCaCerts (bool includeinvalid=false)
 Get list of all trusted CA certificates. More...
 
const QList< QSslCertificategetTrustedCaCertsCache ()
 Get cache of trusted certificate authorities, ready for network connections. More...
 
const QByteArray getTrustedCaCertsPemText ()
 Get concatenated string of all trusted CA certificates. More...
 
const QList< QSslCertificategetUntrustedCaCerts (QList< QSslCertificate > trustedCAs=QList< QSslCertificate >())
 Get list of all untrusted CA certificates. More...
 
bool hasConfigId (const QString &txt) const
 Return whether a string includes an authcfg ID token. More...
 
bool init (const QString &pluginPath=QString::null)
 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...
 
bool masterPasswordHashInDb () const
 Verify a password hash existing in authentication database. More...
 
bool masterPasswordIsSet () const
 Whether master password has be input and verified, i.e. More...
 
bool masterPasswordSame (const QString &pass) const
 Check whether supplied password is the same as the one already set. More...
 
QMutexmutex ()
 Return pointer to mutex. 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 scheduledAuthDbErase ()
 Whether there is a scheduled opitonal erase of authentication database. More...
 
bool setDefaultCertTrustPolicy (QgsAuthCertUtils::CertTrustPolicy policy)
 Set the default certificate trust policy perferred 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 setScheduledAuthDbErase (bool scheduleErase)
 Schedule an optional erase of authentication database, starting when mutex is lockable. More...
 
void setScheduledAuthDbEraseRequestEmitted (bool emitted)
 Re-emit a signal to schedule an optional erase of authentication database. More...
 
bool storeAuthenticationConfig (QgsAuthMethodConfig &mconfig)
 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)
 Get supported authentication method expansion(s), e.g. More...
 
const QString uniqueConfigId () const
 Get a unique generated 7-character string to assign to as config id. 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 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::null)
 Verify the supplied master password against any existing hash in authentication database. More...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual  ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Static Public Member Functions

static QgsAuthManagerinstance ()
 Enforce singleton pattern. More...
 
- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Protected Member Functions

 QgsAuthManager ()
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Singleton offering an interface to manage the authentication configuration database and to utilize configurations through various authentication method plugins.

Definition at line 54 of file qgsauthmanager.h.

Member Enumeration Documentation

Message log level (mirrors that of QgsMessageLog, so it can also output there)

Enumerator
INFO 
WARNING 
CRITICAL 

Definition at line 62 of file qgsauthmanager.h.

Constructor & Destructor Documentation

QgsAuthManager::~QgsAuthManager ( )

Definition at line 2830 of file qgsauthmanager.cpp.

QgsAuthManager::QgsAuthManager ( )
explicitprotected

Definition at line 2809 of file qgsauthmanager.cpp.

Member Function Documentation

void QgsAuthManager::authDatabaseChanged ( ) const
signal

Emitted when the authentication db is significantly changed, e.g.

large record removal, erased, etc.

void QgsAuthManager::authDatabaseEraseRequested ( ) const
signal

Emitted when a user has indicated they may want to erase the authentication db.

const QString QgsAuthManager::authDbConfigTable ( ) const
inline

Name of the authentication database table that stores configs.

Definition at line 80 of file qgsauthmanager.h.

QSqlDatabase QgsAuthManager::authDbConnection ( ) const

Set up the application instance of the authentication database connection.

Definition at line 71 of file qgsauthmanager.cpp.

const QString QgsAuthManager::authDbServersTable ( ) const
inline

Name of the authentication database table that stores server exceptions/configs.

Definition at line 83 of file qgsauthmanager.h.

const QString QgsAuthManager::authenticationDbPath ( ) const
inline

The standard authentication database file in ~/.qgis2/ or defined location.

See also
QgsApplication::qgisAuthDbFilePath

Definition at line 97 of file qgsauthmanager.h.

QString QgsAuthManager::authManTag ( ) const
inline

Simple text tag describing authentication system for message logs.

Definition at line 171 of file qgsauthmanager.h.

QgsAuthMethod * QgsAuthManager::authMethod ( const QString authMethodKey)

Get authentication method from the config/provider cache via its key.

Parameters
authMethodKeyAuthentication method key

Definition at line 928 of file qgsauthmanager.cpp.

QWidget * QgsAuthManager::authMethodEditWidget ( const QString authMethodKey,
QWidget parent 
)

Get authentication method edit widget via its key.

Parameters
authMethodKeyAuthentication method key
parentParent widget

Definition at line 961 of file qgsauthmanager.cpp.

QStringList QgsAuthManager::authMethodsKeys ( const QString dataprovider = QString())

Get keys of supported authentication methods.

Definition at line 923 of file qgsauthmanager.cpp.

QgsAuthMethodsMap QgsAuthManager::authMethodsMap ( const QString dataprovider = QString())

Get available authentication methods mapped to their key.

Parameters
dataproviderProvider key filter, returning only methods that support a particular provider
Note
not available in Python bindings

Definition at line 939 of file qgsauthmanager.cpp.

QgsAuthMethodConfigsMap QgsAuthManager::availableAuthMethodConfigs ( const QString dataprovider = QString())

Get mapping of authentication config ids and their base configs (not decrypted data)

Definition at line 826 of file qgsauthmanager.cpp.

bool QgsAuthManager::backupAuthenticationDatabase ( QString backuppath = nullptr)

Close connection to current authentication database and back it up.

Returns
Path to backup

Definition at line 1243 of file qgsauthmanager.cpp.

void QgsAuthManager::clearAllCachedConfigs ( )
slot

Clear all authentication configs from authentication method caches.

Definition at line 2727 of file qgsauthmanager.cpp.

void QgsAuthManager::clearCachedConfig ( const QString authcfg)
slot

Clear an authentication config from its associated authentication method cache.

Definition at line 2738 of file qgsauthmanager.cpp.

void QgsAuthManager::clearMasterPassword ( )
inline

Clear supplied master password.

Note
This will not necessarily clear authenticated connections cached in network connection managers

Definition at line 127 of file qgsauthmanager.h.

QgsAuthMethod * QgsAuthManager::configAuthMethod ( const QString authcfg)

Get authentication method from the config/provider cache.

Parameters
authcfgAuthentication config id

Definition at line 898 of file qgsauthmanager.cpp.

QString QgsAuthManager::configAuthMethodKey ( const QString authcfg) const

Get key of authentication method associated with config ID.

Parameters
authcfg

Definition at line 914 of file qgsauthmanager.cpp.

QString QgsAuthManager::configIdRegex ( ) const
inline

Return regular expression for authcfg=.

{7} key/value token for authentication ids

Definition at line 241 of file qgsauthmanager.h.

QStringList QgsAuthManager::configIds ( ) const

Get list of authentication ids from database.

Definition at line 2980 of file qgsauthmanager.cpp.

bool QgsAuthManager::configIdUnique ( const QString id) const

Verify if provided authentication id is unique.

Parameters
idId to check

Definition at line 804 of file qgsauthmanager.cpp.

QgsAuthCertUtils::CertTrustPolicy QgsAuthManager::defaultCertTrustPolicy ( )

Get the default certificate trust policy perferred by user.

Definition at line 2597 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 412 of file qgsauthmanager.cpp.

void QgsAuthManager::dumpIgnoredSslErrorsCache_ ( )

Utility function to dump the cache for debug purposes.

Definition at line 2056 of file qgsauthmanager.cpp.

bool QgsAuthManager::eraseAuthenticationDatabase ( bool  backup,
QString backuppath = nullptr 
)

Erase all rows from all tables in authentication database.

Parameters
backupWhether to backup of current database
backuppathWhere the backup is locate
Returns
Whether operation succeeded

Definition at line 1278 of file qgsauthmanager.cpp.

bool QgsAuthManager::existsAuthSetting ( const QString key)

Check if an authentication setting exists.

Definition at line 1517 of file qgsauthmanager.cpp.

bool QgsAuthManager::existsCertAuthority ( const QSslCertificate cert)

Check if a certificate authority exists.

Definition at line 2295 of file qgsauthmanager.cpp.

bool QgsAuthManager::existsCertIdentity ( const QString id)

Check if a certificate identity exists.

Definition at line 1777 of file qgsauthmanager.cpp.

bool QgsAuthManager::existsSslCertCustomConfig ( const QString id,
const QString hostport 
)

Check if SSL certificate custom config exists.

Definition at line 1984 of file qgsauthmanager.cpp.

QVariant QgsAuthManager::getAuthSetting ( const QString key,
const QVariant defaultValue = QVariant(),
bool  decrypt = false 
)

Get an authentication setting (retrieved as string and returned as QVariant( QString ))

Definition at line 1475 of file qgsauthmanager.cpp.

const QMap<QString, QPair<QgsAuthCertUtils::CaCertSource , QSslCertificate> > QgsAuthManager::getCaCertsCache ( )
inline

Get all CA certs mapped to their sha1 from cache.

Note
not available in Python bindings

Definition at line 442 of file qgsauthmanager.h.

const QSslCertificate QgsAuthManager::getCertAuthority ( const QString id)

Get a certificate authority by id (sha hash)

Definition at line 2262 of file qgsauthmanager.cpp.

const QList< QSslCertificate > QgsAuthManager::getCertIdentities ( )

Get certificate identities.

Definition at line 1731 of file qgsauthmanager.cpp.

const QSslCertificate QgsAuthManager::getCertIdentity ( const QString id)

Get a certificate identity by id (sha hash)

Definition at line 1634 of file qgsauthmanager.cpp.

const QPair< QSslCertificate, QSslKey > QgsAuthManager::getCertIdentityBundle ( const QString id)

Get a certificate identity bundle by id (sha hash).

Note
not available in Python bindings

Definition at line 1667 of file qgsauthmanager.cpp.

const QStringList QgsAuthManager::getCertIdentityBundleToPem ( const QString id)

Get a certificate identity bundle by id (sha hash) returned as PEM text.

Definition at line 1721 of file qgsauthmanager.cpp.

QStringList QgsAuthManager::getCertIdentityIds ( ) const

Get list of certificate identity ids from database.

Definition at line 1752 of file qgsauthmanager.cpp.

QgsAuthCertUtils::CertTrustPolicy QgsAuthManager::getCertificateTrustPolicy ( const QSslCertificate cert)

Get trust policy for a particular certificate.

Definition at line 2564 of file qgsauthmanager.cpp.

const QMap<QgsAuthCertUtils::CertTrustPolicy, QStringList > QgsAuthManager::getCertTrustCache ( )
inline

Get cache of certificate sha1s, per trust policy.

Definition at line 474 of file qgsauthmanager.h.

QgsAuthCertUtils::CertTrustPolicy QgsAuthManager::getCertTrustPolicy ( const QSslCertificate cert)

Get a whether certificate is trusted by user.

Returns
DefaultTrust if certificate sha not in trust table, i.e. follows default trust policy

Definition at line 2481 of file qgsauthmanager.cpp.

const QList< QSslCertificate > QgsAuthManager::getDatabaseCAs ( )

Get database-stored certificate authorities.

Definition at line 2404 of file qgsauthmanager.cpp.

const QList< QSslCertificate > QgsAuthManager::getExtraFileCAs ( )

Get extra file-based certificate authorities.

Definition at line 2371 of file qgsauthmanager.cpp.

QHash<QString, QSet<QSslError::SslError> > QgsAuthManager::getIgnoredSslErrorCache ( )
inline

Get ignored SSL error cache, keyed with cert/connection's sha:host:port.

Note
not available in Python bindings

Definition at line 397 of file qgsauthmanager.h.

const QMap< QString, QSslCertificate > QgsAuthManager::getMappedDatabaseCAs ( )

Get sha1-mapped database-stored certificate authorities.

Definition at line 2425 of file qgsauthmanager.cpp.

const QgsAuthConfigSslServer QgsAuthManager::getSslCertCustomConfig ( const QString id,
const QString hostport 
)

Get an SSL certificate custom config by id (sha hash) and host:port.

Definition at line 1877 of file qgsauthmanager.cpp.

const QgsAuthConfigSslServer QgsAuthManager::getSslCertCustomConfigByHost ( const QString hostport)

Get an SSL certificate custom config by host:port.

Definition at line 1918 of file qgsauthmanager.cpp.

const QList< QgsAuthConfigSslServer > QgsAuthManager::getSslCertCustomConfigs ( )

Get SSL certificate custom configs.

Definition at line 1958 of file qgsauthmanager.cpp.

const QList< QSslCertificate > QgsAuthManager::getSystemRootCAs ( )

Get root system certificate authorities.

Definition at line 2361 of file qgsauthmanager.cpp.

const QList< QSslCertificate > QgsAuthManager::getTrustedCaCerts ( bool  includeinvalid = false)

Get list of all trusted CA certificates.

Definition at line 2640 of file qgsauthmanager.cpp.

const QList<QSslCertificate> QgsAuthManager::getTrustedCaCertsCache ( )
inline

Get cache of trusted certificate authorities, ready for network connections.

Definition at line 489 of file qgsauthmanager.h.

const QByteArray QgsAuthManager::getTrustedCaCertsPemText ( )

Get concatenated string of all trusted CA certificates.

Definition at line 2706 of file qgsauthmanager.cpp.

const QList< QSslCertificate > QgsAuthManager::getUntrustedCaCerts ( QList< QSslCertificate trustedCAs = QList<QSslCertificate>())

Get list of all untrusted CA certificates.

Definition at line 2673 of file qgsauthmanager.cpp.

bool QgsAuthManager::hasConfigId ( const QString txt) const

Return whether a string includes an authcfg ID token.

Parameters
txtString to check

Definition at line 820 of file qgsauthmanager.cpp.

bool QgsAuthManager::init ( const QString pluginPath = QString::null)

Initialize QCA, prioritize qca-ossl plugin and optionally set up the authentication database.

Definition at line 100 of file qgsauthmanager.cpp.

bool QgsAuthManager::initSslCaches ( )

Initialize various SSL authentication caches.

Definition at line 1579 of file qgsauthmanager.cpp.

QgsAuthManager * QgsAuthManager::instance ( )
static

Enforce singleton pattern.

Note
To set up the manager instance and initialize everything use QgsAuthManager::instance()->init()

Definition at line 62 of file qgsauthmanager.cpp.

bool QgsAuthManager::isDisabled ( ) const

Whether QCA has the qca-ossl plugin, which a base run-time requirement.

Definition at line 403 of file qgsauthmanager.cpp.

bool QgsAuthManager::loadAuthenticationConfig ( const QString authcfg,
QgsAuthMethodConfig mconfig,
bool  full = false 
)

Load an authentication config from the database into subclass.

Parameters
authcfgAssociated authentication config id
mconfigSubclassed config to load into
fullWhether to decrypt and populate all sensitive data in subclass
Returns
Whether operation succeeded

Definition at line 1125 of file qgsauthmanager.cpp.

bool QgsAuthManager::masterPasswordHashInDb ( ) const

Verify a password hash existing in authentication database.

Definition at line 2886 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 568 of file qgsauthmanager.cpp.

bool QgsAuthManager::masterPasswordSame ( const QString pass) const

Check whether supplied password is the same as the one already set.

Parameters
passPassword to verify

Definition at line 573 of file qgsauthmanager.cpp.

void QgsAuthManager::masterPasswordVerified ( bool  verified) const
signal

Emitted when a password has been verify (or not)

Parameters
verifiedThe state of password's verification
void QgsAuthManager::messageOut ( const QString message,
const QString tag = smAuthManTag,
QgsAuthManager::MessageLevel  level = INFO 
) const
signal

Custom logging signal to relay to console output and QgsMessageLog.

See also
QgsMessageLog
Parameters
messageMessage to send
tagAssociated tag (title)
levelMessage log level
QMutex* QgsAuthManager::mutex ( )
inline

Return pointer to mutex.

Definition at line 497 of file qgsauthmanager.h.

bool QgsAuthManager::rebuildCaCertsCache ( )

Rebuild certificate authority cache.

Definition at line 2430 of file qgsauthmanager.cpp.

bool QgsAuthManager::rebuildCertTrustCache ( )

Rebuild certificate authority cache.

Definition at line 2607 of file qgsauthmanager.cpp.

bool QgsAuthManager::rebuildIgnoredSslErrorCache ( )

Rebuild ignoredSSL error cache.

Definition at line 2150 of file qgsauthmanager.cpp.

bool QgsAuthManager::rebuildTrustedCaCertsCache ( )

Rebuild trusted certificate authorities cache.

Definition at line 2698 of file qgsauthmanager.cpp.

bool QgsAuthManager::registerCoreAuthMethods ( )

Instantiate and register existing C++ core authentication methods from plugins.

Definition at line 752 of file qgsauthmanager.cpp.

bool QgsAuthManager::removeAllAuthenticationConfigs ( )

Clear all authentication configs from table in database and from provider caches.

Returns
Whether operation succeeded

Definition at line 1223 of file qgsauthmanager.cpp.

bool QgsAuthManager::removeAuthenticationConfig ( const QString authcfg)

Remove an authentication config in the database.

Parameters
authcfgAssociated authentication config id
Returns
Whether operation succeeded

Definition at line 1191 of file qgsauthmanager.cpp.

bool QgsAuthManager::removeAuthSetting ( const QString key)

Remove an authentication setting.

Definition at line 1549 of file qgsauthmanager.cpp.

bool QgsAuthManager::removeCertAuthority ( const QSslCertificate cert)

Remove a certificate authority.

Definition at line 2332 of file qgsauthmanager.cpp.

bool QgsAuthManager::removeCertIdentity ( const QString id)

Remove a certificate identity.

Definition at line 1809 of file qgsauthmanager.cpp.

bool QgsAuthManager::removeCertTrustPolicies ( const QList< QSslCertificate > &  certs)

Remove a group certificate authorities.

Definition at line 2518 of file qgsauthmanager.cpp.

bool QgsAuthManager::removeCertTrustPolicy ( const QSslCertificate cert)

Remove a certificate authority.

Definition at line 2534 of file qgsauthmanager.cpp.

bool QgsAuthManager::removeSslCertCustomConfig ( const QString id,
const QString hostport 
)

Remove an SSL certificate custom config.

Definition at line 2021 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.

Parameters
newpassNew master password to replace existing
oldpassCurrent master password to replace existing
keepbackupWhether to keep the generated backup of current database
backuppathWhere the backup is located, if kept

Definition at line 578 of file qgsauthmanager.cpp.

bool QgsAuthManager::scheduledAuthDbErase ( )
inline

Whether there is a scheduled opitonal erase of authentication database.

Note
not available in Python bindings

Definition at line 146 of file qgsauthmanager.h.

bool QgsAuthManager::setDefaultCertTrustPolicy ( QgsAuthCertUtils::CertTrustPolicy  policy)

Set the default certificate trust policy perferred by user.

Definition at line 2587 of file qgsauthmanager.cpp.

bool QgsAuthManager::setMasterPassword ( bool  verify = false)

Main call to initially set or continually check master password is set.

Note
If it is not set, the user is asked for its input
Parameters
verifyWhether password's hash was saved in authentication database

Definition at line 417 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.

Note
Only use this in trusted reset functions, unit tests or user/app setup scripts!
Parameters
passPassword to use
verifyWhether password's hash was saved in authentication database

Definition at line 449 of file qgsauthmanager.cpp.

void QgsAuthManager::setScheduledAuthDbErase ( bool  scheduleErase)

Schedule an optional erase of authentication database, starting when mutex is lockable.

Note
When an erase is scheduled, any attempt to set the master password, e.g. password input dialog, is effectively cancelled. For example: In a GUI app, this keeps excess password input dialogs from popping up when a user has initiated an erase, from a password input dialog, because they forgot their password. The created schedule timer will emit a request to gain access to the user, through the given application, to prompt the erase operation (e.g. via a dialog); if no access to user interaction occurs wihtin 90 seconds, it cancels the schedule.
not available in Python bindings

Definition at line 725 of file qgsauthmanager.cpp.

void QgsAuthManager::setScheduledAuthDbEraseRequestEmitted ( bool  emitted)
inline

Re-emit a signal to schedule an optional erase of authentication database.

Note
This can be called from the slot connected to a previously emitted scheduling signal, so that the slot can ask for another emit later, if the slot noticies the current GUI processing state is not ready for interacting with the user, e.g. project is still loading
Parameters
emittedSetting 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 168 of file qgsauthmanager.h.

bool QgsAuthManager::storeAuthenticationConfig ( QgsAuthMethodConfig mconfig)

Store an authentication config in the database.

Parameters
mconfigAssociated authentication config id
Returns
Whether operation succeeded

Definition at line 979 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 1435 of file qgsauthmanager.cpp.

bool QgsAuthManager::storeCertAuthorities ( const QList< QSslCertificate > &  certs)

Store multiple certificate authorities.

Definition at line 2211 of file qgsauthmanager.cpp.

bool QgsAuthManager::storeCertAuthority ( const QSslCertificate cert)

Store a certificate authority.

Definition at line 2227 of file qgsauthmanager.cpp.

bool QgsAuthManager::storeCertIdentity ( const QSslCertificate cert,
const QSslKey key 
)

Store a certificate identity.

Definition at line 1591 of file qgsauthmanager.cpp.

bool QgsAuthManager::storeCertTrustPolicy ( const QSslCertificate cert,
QgsAuthCertUtils::CertTrustPolicy  policy 
)

Store user trust value for a certificate.

Definition at line 2443 of file qgsauthmanager.cpp.

bool QgsAuthManager::storeSslCertCustomConfig ( const QgsAuthConfigSslServer config)

Store an SSL certificate custom config.

Definition at line 1836 of file qgsauthmanager.cpp.

QgsAuthMethod::Expansions QgsAuthManager::supportedAuthMethodExpansions ( const QString authcfg)

Get supported authentication method expansion(s), e.g.

NetworkRequest | DataSourceURI, as flags

Parameters
authcfg

Definition at line 966 of file qgsauthmanager.cpp.

const QString QgsAuthManager::uniqueConfigId ( ) const

Get a unique generated 7-character string to assign to as config id.

Definition at line 767 of file qgsauthmanager.cpp.

bool QgsAuthManager::updateAuthenticationConfig ( const QgsAuthMethodConfig config)

Update an authentication config in the database.

Parameters
configAssociated authentication config id
Returns
Whether operation succeeded

Definition at line 1055 of file qgsauthmanager.cpp.

void QgsAuthManager::updateConfigAuthMethods ( )

Sync the confg/authentication method cache with what is in database.

Definition at line 870 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.

Parameters
connectionItemsThe connection items, e.g. username=myname, of QgsDataSourceURI
authcfgAssociated authentication config id
dataproviderProvider key filter, offering logic branching in authentication method
Returns
Whether operation succeeded

Definition at line 1409 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 2107 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 2079 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.)

Parameters
replyThe QNetworkReply
authcfgAssociated authentication config id
dataproviderProvider key filter, offering logic branching in authentication method
Returns
Whether operation succeeded

Definition at line 1383 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.

Parameters
requestThe QNetworkRequest
authcfgAssociated authentication config id
dataproviderProvider key filter, offering logic branching in authentication method
Returns
Whether operation succeeded

Definition at line 1357 of file qgsauthmanager.cpp.

bool QgsAuthManager::verifyMasterPassword ( const QString compare = QString::null)

Verify the supplied master password against any existing hash in authentication database.

Note
Do not emit verification signals when only comparing
Parameters
comparePassword to compare against

Definition at line 474 of file qgsauthmanager.cpp.


The documentation for this class was generated from the following files: