QGIS API Documentation 3.41.0-Master (cea29feecf2)
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
QgsAuthConfigurationStorageDb Class Reference

QSqlDatabase based implementation of QgsAuthConfigurationStorage. More...

#include <qgsauthconfigurationstoragedb.h>

Inheritance diagram for QgsAuthConfigurationStorageDb:
Inheritance graph
[legend]

Public Member Functions

 QgsAuthConfigurationStorageDb (const QMap< QString, QVariant > &settings)
 Creates a new QgsAuthConfigurationStorageDb instance from the specified settings.
 
 QgsAuthConfigurationStorageDb (const QString &uri)
 Creates a new QgsAuthConfigurationStorageDb instance from the specified uri.
 
 ~QgsAuthConfigurationStorageDb () override
 
QSqlDatabase authDatabaseConnection () const
 Returns the database connection used by this storage.
 
QgsAuthMethodConfigsMap authMethodConfigs (const QStringList &allowedMethods=QStringList()) const override
 Returns a mapping of authentication configurations available from this storage.
 
QgsAuthMethodConfigsMap authMethodConfigsWithPayload () const override
 Returns a mapping of authentication configurations available from this storage.
 
bool authSettingExists (const QString &key) const override
 Check if an authentication setting exists in the storage.
 
virtual QString authSettingsTableName () const
 Returns the name of the table used to store the auth settings.
 
const QList< QSslCertificate > caCerts () const override
 Returns the list of CA certificates in the storage.
 
const QMap< QString, QgsAuthCertUtils::CertTrustPolicycaCertsPolicy () const override
 Returns the map of CA certificates hashes in the storages and their trust policy.
 
bool certAuthorityExists (const QSslCertificate &cert) const override
 Check if a certificate authority exists.
 
QStringList certAuthorityIds () const override
 Returns the list of certificate authority IDs in the storage.
 
virtual QString certAuthorityTableName () const
 Returns the name of the table used to store the certificate authorities.
 
const QList< QSslCertificate > certIdentities () const override
 certIdentities get certificate identities
 
bool certIdentityExists (const QString &id) const override
 Check if the certificate identity exists.
 
QStringList certIdentityIds () const override
 certIdentityIds get list of certificate identity ids from database
 
virtual QString certIdentityTableName () const
 Returns the name of the table used to store the certificate identities.
 
bool certTrustPolicyExists (const QSslCertificate &cert) const override
 Check if certificate trust policy exists.
 
virtual QString certTrustPolicyTableName () const
 Returns the name of the table used to store the certificate trust policies.
 
bool clearMasterPasswords () override
 Remove all master passwords from the database.
 
bool clearMethodConfigs () override
 Remove all authentications configurations from the storage.
 
QString description () const override
 Returns a human readable localized description of the storage implementation (e.g.
 
bool erase () override
 Completely erase the storage removing all configurations/certs/settings etc.
 
QString id () const override
 Returns the unique identifier of the storage object.
 
bool initialize () override
 Initializes the storage.
 
bool isReady () const override
 Returns true is the storage is ready to be used.
 
QString loadAuthSetting (const QString &key) const override
 Load an authentication setting from the storage.
 
const QSslCertificate loadCertAuthority (const QString &id) const override
 certAuthority get a certificate authority by id (sha hash)
 
const QSslCertificate loadCertIdentity (const QString &id) const override
 certIdentity get a certificate identity by id (sha hash)
 
const QPair< QSslCertificate, QString > loadCertIdentityBundle (const QString &id) const override
 Returns a certificate identity bundle by id (sha hash).
 
QgsAuthCertUtils::CertTrustPolicy loadCertTrustPolicy (const QSslCertificate &cert) const override
 Load certificate trust policy.
 
QgsAuthMethodConfig loadMethodConfig (const QString &id, QString &payload, bool full=false) const override
 Load an authentication configuration from the database.
 
const QgsAuthConfigSslServer loadSslCertCustomConfig (const QString &id, const QString &hostport) const override
 Loads an SSL certificate custom config by id (sha hash) and hostport (host:port)
 
const QgsAuthConfigSslServer loadSslCertCustomConfigByHost (const QString &hostport) const override
 Loads an SSL certificate custom config by hostport (host:port)
 
const QList< QgsAuthConfigurationStorage::MasterPasswordConfigmasterPasswords () const override
 Returns the list of (encrypted) master passwords stored in the database.
 
virtual QString masterPasswordTableName () const
 Returns the name of the table used to store the master passwords.
 
bool methodConfigExists (const QString &id) const override
 Check if an authentication configuration exists in the storage.
 
virtual QString methodConfigTableName () const
 Returns the name of the table used to store the method configurations.
 
QString name () const override
 Returns a human readable localized short name of the storage implementation (e.g "SQLite").
 
virtual QString quotedQualifiedIdentifier (const QString &identifier, bool isIndex=false) const
 Returns the quoted identifier, prefixed with the schema (if not null), ready for the insertion into a SQL query.
 
bool removeAuthSetting (const QString &key) override
 Remove an authentication setting from the storage.
 
bool removeCertAuthority (const QSslCertificate &cert) override
 Remove a certificate authority.
 
bool removeCertIdentity (const QSslCertificate &cert) override
 Remove a certificate identity from the storage.
 
bool removeCertIdentity (const QString &id) override
 Remove a certificate identity from the storage.
 
bool removeCertTrustPolicy (const QSslCertificate &cert) override
 Remove certificate trust policy.
 
bool removeMethodConfig (const QString &id) override
 Removes the authentication configuration with the specified id.
 
bool removeSslCertCustomConfig (const QString &id, const QString &hostport) override
 Remove an SSL certificate custom config.
 
QList< QgsAuthConfigurationStorage::SettingParametersettingsParameters () const override
 Returns a list of the settings accepted by the storage.
 
bool sslCertCustomConfigExists (const QString &id, const QString &hostport) override
 Check if SSL certificate custom config exists.
 
QStringList sslCertCustomConfigIds () const override
 Returns the list of SSL certificate custom config ids.
 
const QList< QgsAuthConfigSslServersslCertCustomConfigs () const override
 sslCertCustomConfigs get SSL certificate custom configs
 
virtual QString sslCertCustomConfigTableName () const
 Returns the name of the table used to store the SSL custom configurations.
 
bool storeAuthSetting (const QString &key, const QString &value) override
 Store an authentication setting in the storage.
 
bool storeCertAuthority (const QSslCertificate &cert) override
 Store a certificate authority.
 
bool storeCertIdentity (const QSslCertificate &cert, const QString &keyPem) override
 Store a certificate identity in the storage.
 
bool storeCertTrustPolicy (const QSslCertificate &cert, QgsAuthCertUtils::CertTrustPolicy policy) override
 Store certificate trust policy.
 
bool storeMasterPassword (const QgsAuthConfigurationStorage::MasterPasswordConfig &config) override
 Store a master password in the database.
 
bool storeMethodConfig (const QgsAuthMethodConfig &mconfig, const QString &payload) override
 Store an authentication config in the database.
 
bool storeSslCertCustomConfig (const QgsAuthConfigSslServer &config) override
 Store an SSL certificate custom config.
 
virtual bool tableExists (const QString &table) const
 Returns true if the specified table exists in the database, false otherwise.
 
QString type () const override
 Returns the type of the storage implementation.
 
- Public Member Functions inherited from QgsAuthConfigurationStorage
 QgsAuthConfigurationStorage (const QMap< QString, QVariant > &settings)
 Creates a new authentication configuration storage.
 
virtual ~QgsAuthConfigurationStorage ()
 
Qgis::AuthConfigurationStorageCapabilities capabilities () const
 Returns the capabilities of the storage.
 
bool isEnabled () const
 Returns true if the storage is enabled.
 
bool isEncrypted () const
 Returns true if the storage is encrypted.
 
virtual bool isReadOnly () const
 Returns true if the storage is read-only, false otherwise.
 
virtual QString lastError () const
 Returns the last error message.
 
void setEnabled (bool enabled)
 Set the storage enabled status to enabled.
 
virtual void setReadOnly (bool readOnly)
 Utility method to unset all editing capabilities.
 
QMap< QString, QVariant > settings () const
 Returns the settings of the storage.
 

Protected Member Functions

bool authDbOpen () const
 Opens the connction to the database.
 
bool authDbQuery (QSqlQuery *query, const QString &sql=QString()) const
 Runs the specified query on the database.
 
bool authDbTransactionQuery (QSqlQuery *query)
 Executes the specified query on the database using a transaction.
 
virtual void checkCapabilities ()
 Checks the capabilities of the storage.
 
bool createCertTables ()
 Creates the certificate tables in the database.
 
bool createConfigTables ()
 Creates the configuration tables in the database.
 
- Protected Member Functions inherited from QgsAuthConfigurationStorage
void checkCapability (Qgis::AuthConfigurationStorageCapability capability) const
 Utility to check capability and throw QgsNotSupportedException if not supported.
 
virtual QString loggerTag () const
 Returns the logger tag for the storage.
 
void setCapabilities (Qgis::AuthConfigurationStorageCapabilities capabilities)
 Set the capabilities of the storage to capabilities.
 
void setError (const QString &error, Qgis::MessageLevel level=Qgis::MessageLevel::Critical)
 Set the last error message to error with message level level.
 

Protected Attributes

QString mConnectOptions
 
QString mDatabase
 
QString mDriver
 
QString mHost
 
QString mId
 
bool mIsReady = false
 
QRecursiveMutex mMutex
 
QString mPassword
 
int mPort
 
QString mUser
 
- Protected Attributes inherited from QgsAuthConfigurationStorage
Qgis::AuthConfigurationStorageCapabilities mCapabilities
 Store the capabilities of the storage.
 
QMap< QString, QVariant > mConfiguration
 Store the implementation-specific configuration.
 
bool mIsEnabled = true
 Store whether the storage is enabled.
 
bool mIsEncrypted = true
 Store whether the storage is encrypted.
 
bool mIsReadOnly = false
 Store whether the storage is read-only.
 
QString mLastError
 Store the last error message.
 

Additional Inherited Members

- Signals inherited from QgsAuthConfigurationStorage
void authSettingsChanged ()
 Emitted when the storage auth settings table was changed.
 
void certAuthorityChanged ()
 Emitted when the storage cert authority table was changed.
 
void certIdentityChanged ()
 Emitted when the storage cert identity table was changed.
 
void masterPasswordChanged ()
 Emitted when the storage master password table was changed.
 
void messageLog (const QString &message, const QString &tag=QStringLiteral("Authentication"), Qgis::MessageLevel level=Qgis::MessageLevel::Info)
 Custom logging signal to relay to console output and QgsMessageLog.
 
void methodConfigChanged ()
 Emitted when the storage method config table was changed.
 
void readOnlyChanged (bool readOnly)
 Emitted when the storage read-only status was changed.
 
void sslCertCustomConfigChanged ()
 Emitted when the storage ssl cert custom config table was changed.
 
void sslCertTrustPolicyChanged ()
 Emitted when the storage ssl cert trust policy table was changed.
 
void storageChanged (const QString &id)
 Emitted when the storage was updated.
 

Detailed Description

QSqlDatabase based implementation of QgsAuthConfigurationStorage.

Since
QGIS 3.40

Definition at line 32 of file qgsauthconfigurationstoragedb.h.

Constructor & Destructor Documentation

◆ QgsAuthConfigurationStorageDb() [1/2]

QgsAuthConfigurationStorageDb::QgsAuthConfigurationStorageDb ( const QMap< QString, QVariant > &  settings)

Creates a new QgsAuthConfigurationStorageDb instance from the specified settings.

Settings can contain the following keys:

Mandatory settings:

Optional settings:

Note
Even if this generic storage also works with a pre-existing SQLite DB, a convenience subclass QgsAuthConfigurationStorageSqlite is provided for SQLite DBs.

Definition at line 31 of file qgsauthconfigurationstoragedb.cpp.

◆ QgsAuthConfigurationStorageDb() [2/2]

QgsAuthConfigurationStorageDb::QgsAuthConfigurationStorageDb ( const QString &  uri)

Creates a new QgsAuthConfigurationStorageDb instance from the specified uri.

The URI should be in the format:

<DRIVER>://<USER>:<PASSWORD>@<HOST>:<PORT>/<DATABASE>[?OPTIONS]
Note
It is not possible to set the schema in the URI, pass SCHEMA=
<SCHEMA>
in the options instead.

Definition at line 48 of file qgsauthconfigurationstoragedb.cpp.

◆ ~QgsAuthConfigurationStorageDb()

QgsAuthConfigurationStorageDb::~QgsAuthConfigurationStorageDb ( )
override

Definition at line 53 of file qgsauthconfigurationstoragedb.cpp.

Member Function Documentation

◆ authDatabaseConnection()

QSqlDatabase QgsAuthConfigurationStorageDb::authDatabaseConnection ( ) const

Returns the database connection used by this storage.

Definition at line 65 of file qgsauthconfigurationstoragedb.cpp.

◆ authDbOpen()

bool QgsAuthConfigurationStorageDb::authDbOpen ( ) const
protected

Opens the connction to the database.

Returns
true if the connection was opened successfully, false otherwise.

Definition at line 143 of file qgsauthconfigurationstoragedb.cpp.

◆ authDbQuery()

bool QgsAuthConfigurationStorageDb::authDbQuery ( QSqlQuery *  query,
const QString &  sql = QString() 
) const
protected

Runs the specified query on the database.

Optional sql can be provided.

Returns
true if the query was executed successfully, false otherwise.

Definition at line 165 of file qgsauthconfigurationstoragedb.cpp.

◆ authDbTransactionQuery()

bool QgsAuthConfigurationStorageDb::authDbTransactionQuery ( QSqlQuery *  query)
protected

Executes the specified query on the database using a transaction.

Optional sql can be provided.

Returns
true if the query was executed successfully, false otherwise.

Definition at line 215 of file qgsauthconfigurationstoragedb.cpp.

◆ authMethodConfigs()

QgsAuthMethodConfigsMap QgsAuthConfigurationStorageDb::authMethodConfigs ( const QStringList &  allowedMethods = QStringList()) const
overridevirtual

Returns a mapping of authentication configurations available from this storage.

Parameters
allowedMethodsOptional filter to return only configurations for specific authentication methods.
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1703 of file qgsauthconfigurationstoragedb.cpp.

◆ authMethodConfigsWithPayload()

QgsAuthMethodConfigsMap QgsAuthConfigurationStorageDb::authMethodConfigsWithPayload ( ) const
overridevirtual

Returns a mapping of authentication configurations available from this storage.

The encrypted payload is added to the configuration as "encrypted_payload" key.

Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage
Note
This convenience method is used by the authentication manager to retrieve the configurations and check if it can decrypt all of them, it is faster than retrieve all the configurations one by one.

Implements QgsAuthConfigurationStorage.

Definition at line 1753 of file qgsauthconfigurationstoragedb.cpp.

◆ authSettingExists()

bool QgsAuthConfigurationStorageDb::authSettingExists ( const QString &  key) const
overridevirtual

Check if an authentication setting exists in the storage.

Parameters
keySetting key.
Returns
true if the setting exists, false otherwise.
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 2197 of file qgsauthconfigurationstoragedb.cpp.

◆ authSettingsTableName()

QString QgsAuthConfigurationStorageDb::authSettingsTableName ( ) const
virtual

Returns the name of the table used to store the auth settings.

Definition at line 1460 of file qgsauthconfigurationstoragedb.cpp.

◆ caCerts()

const QList< QSslCertificate > QgsAuthConfigurationStorageDb::caCerts ( ) const
overridevirtual

Returns the list of CA certificates in the storage.

Returns
list of CA certificates
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1138 of file qgsauthconfigurationstoragedb.cpp.

◆ caCertsPolicy()

const QMap< QString, QgsAuthCertUtils::CertTrustPolicy > QgsAuthConfigurationStorageDb::caCertsPolicy ( ) const
overridevirtual

Returns the map of CA certificates hashes in the storages and their trust policy.

Returns
map of CA certificates hashes and their trust policy
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1103 of file qgsauthconfigurationstoragedb.cpp.

◆ certAuthorityExists()

bool QgsAuthConfigurationStorageDb::certAuthorityExists ( const QSslCertificate &  cert) const
overridevirtual

Check if a certificate authority exists.

Parameters
certCertificate authority
Returns
true if the certificate authority exists, false otherwise
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1014 of file qgsauthconfigurationstoragedb.cpp.

◆ certAuthorityIds()

QStringList QgsAuthConfigurationStorageDb::certAuthorityIds ( ) const
overridevirtual

Returns the list of certificate authority IDs in the storage.

Returns
list of certificate authority IDs
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 894 of file qgsauthconfigurationstoragedb.cpp.

◆ certAuthorityTableName()

QString QgsAuthConfigurationStorageDb::certAuthorityTableName ( ) const
virtual

Returns the name of the table used to store the certificate authorities.

Definition at line 1475 of file qgsauthconfigurationstoragedb.cpp.

◆ certIdentities()

const QList< QSslCertificate > QgsAuthConfigurationStorageDb::certIdentities ( ) const
overridevirtual

certIdentities get certificate identities

Returns
list of certificates
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 460 of file qgsauthconfigurationstoragedb.cpp.

◆ certIdentityExists()

bool QgsAuthConfigurationStorageDb::certIdentityExists ( const QString &  id) const
overridevirtual

Check if the certificate identity exists.

Parameters
idCertificate identity id
Returns
true if the certificate identity exists, false otherwise
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 525 of file qgsauthconfigurationstoragedb.cpp.

◆ certIdentityIds()

QStringList QgsAuthConfigurationStorageDb::certIdentityIds ( ) const
overridevirtual

certIdentityIds get list of certificate identity ids from database

Returns
list of certificate ids
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 495 of file qgsauthconfigurationstoragedb.cpp.

◆ certIdentityTableName()

QString QgsAuthConfigurationStorageDb::certIdentityTableName ( ) const
virtual

Returns the name of the table used to store the certificate identities.

Definition at line 1465 of file qgsauthconfigurationstoragedb.cpp.

◆ certTrustPolicyExists()

bool QgsAuthConfigurationStorageDb::certTrustPolicyExists ( const QSslCertificate &  cert) const
overridevirtual

Check if certificate trust policy exists.

Parameters
certCertificate
Returns
true if the certificate trust policy exists, false otherwise
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1339 of file qgsauthconfigurationstoragedb.cpp.

◆ certTrustPolicyTableName()

QString QgsAuthConfigurationStorageDb::certTrustPolicyTableName ( ) const
virtual

Returns the name of the table used to store the certificate trust policies.

Definition at line 1480 of file qgsauthconfigurationstoragedb.cpp.

◆ checkCapabilities()

void QgsAuthConfigurationStorageDb::checkCapabilities ( )
protectedvirtual

Checks the capabilities of the storage.

Definition at line 1797 of file qgsauthconfigurationstoragedb.cpp.

◆ clearMasterPasswords()

bool QgsAuthConfigurationStorageDb::clearMasterPasswords ( )
overridevirtual

Remove all master passwords from the database.

Returns
true if operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1439 of file qgsauthconfigurationstoragedb.cpp.

◆ clearMethodConfigs()

bool QgsAuthConfigurationStorageDb::clearMethodConfigs ( )
overridevirtual

Remove all authentications configurations from the storage.

Returns
true if authentications configurations were removed, false otherwise.
Note
This method does not remove certificate and other assets.
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 2350 of file qgsauthconfigurationstoragedb.cpp.

◆ createCertTables()

bool QgsAuthConfigurationStorageDb::createCertTables ( )
protected

Creates the certificate tables in the database.

Returns
true if the tables were created successfully, false otherwise.

Definition at line 1597 of file qgsauthconfigurationstoragedb.cpp.

◆ createConfigTables()

bool QgsAuthConfigurationStorageDb::createConfigTables ( )
protected

Creates the configuration tables in the database.

Returns
true if the tables were created successfully, false otherwise.

Definition at line 1543 of file qgsauthconfigurationstoragedb.cpp.

◆ description()

QString QgsAuthConfigurationStorageDb::description ( ) const
overridevirtual

Returns a human readable localized description of the storage implementation (e.g.

"Store credentials in a local SQLite database"). This description is displayed to the user.

Implements QgsAuthConfigurationStorage.

Definition at line 1520 of file qgsauthconfigurationstoragedb.cpp.

◆ erase()

bool QgsAuthConfigurationStorageDb::erase ( )
overridevirtual

Completely erase the storage removing all configurations/certs/settings etc.

Returns
true if storage was completely erased, false if any error occurred.
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage (e.g. the storage is read-only).

Implements QgsAuthConfigurationStorage.

Definition at line 2363 of file qgsauthconfigurationstoragedb.cpp.

◆ id()

QString QgsAuthConfigurationStorageDb::id ( ) const
overridevirtual

Returns the unique identifier of the storage object.

The id is used to uniquely identify the storage object (e.g. the path or the connection URI to a storage configuration).

Implements QgsAuthConfigurationStorage.

Definition at line 1525 of file qgsauthconfigurationstoragedb.cpp.

◆ initialize()

bool QgsAuthConfigurationStorageDb::initialize ( )
overridevirtual

Initializes the storage.

Returns
true if the storage was successfully initialized, false otherwise. If the storage is already initialized, this method does nothing and returns true.
Note
The default implementation does nothing and returns true. This method is called by the authentication manager when the storage is added to the manager.

Reimplemented from QgsAuthConfigurationStorage.

Definition at line 236 of file qgsauthconfigurationstoragedb.cpp.

◆ isReady()

bool QgsAuthConfigurationStorageDb::isReady ( ) const
overridevirtual

Returns true is the storage is ready to be used.

Note
This method should be called after the initialize() method to check whether the initialization was properly completed.

Implements QgsAuthConfigurationStorage.

Definition at line 2387 of file qgsauthconfigurationstoragedb.cpp.

◆ loadAuthSetting()

QString QgsAuthConfigurationStorageDb::loadAuthSetting ( const QString &  key) const
overridevirtual

Load an authentication setting from the storage.

Parameters
keySetting key.
Returns
Setting value.
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 2127 of file qgsauthconfigurationstoragedb.cpp.

◆ loadCertAuthority()

const QSslCertificate QgsAuthConfigurationStorageDb::loadCertAuthority ( const QString &  id) const
overridevirtual

certAuthority get a certificate authority by id (sha hash)

Parameters
idsha hash
Returns
a (possibly empty) certificate
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 971 of file qgsauthconfigurationstoragedb.cpp.

◆ loadCertIdentity()

const QSslCertificate QgsAuthConfigurationStorageDb::loadCertIdentity ( const QString &  id) const
overridevirtual

certIdentity get a certificate identity by id (sha hash)

Parameters
idsha hash of the cert
Returns
the certificate
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 356 of file qgsauthconfigurationstoragedb.cpp.

◆ loadCertIdentityBundle()

const QPair< QSslCertificate, QString > QgsAuthConfigurationStorageDb::loadCertIdentityBundle ( const QString &  id) const
overridevirtual

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

Parameters
idsha shash
Returns
a pair with the certificate and its SSL key as an encrypted string
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 404 of file qgsauthconfigurationstoragedb.cpp.

◆ loadCertTrustPolicy()

QgsAuthCertUtils::CertTrustPolicy QgsAuthConfigurationStorageDb::loadCertTrustPolicy ( const QSslCertificate &  cert) const
overridevirtual

Load certificate trust policy.

Parameters
certCertificate
Returns
Trust policy
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1252 of file qgsauthconfigurationstoragedb.cpp.

◆ loadMethodConfig()

QgsAuthMethodConfig QgsAuthConfigurationStorageDb::loadMethodConfig ( const QString &  id,
QString &  payload,
bool  full = false 
) const
overridevirtual

Load an authentication configuration from the database.

Parameters
idConfiguration id.
payload(possibly encrypted) payload.
fullIf true, the full configuration is loaded and the (possibly encrypted) payload is populated, otherwise only the configuration metadata is loaded.
Returns
Authentication configuration metadata.
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1912 of file qgsauthconfigurationstoragedb.cpp.

◆ loadSslCertCustomConfig()

const QgsAuthConfigSslServer QgsAuthConfigurationStorageDb::loadSslCertCustomConfig ( const QString &  id,
const QString &  hostport 
) const
overridevirtual

Loads an SSL certificate custom config by id (sha hash) and hostport (host:port)

Parameters
idsha hash
hostportstring host:port
Returns
a SSL certificate custom config
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 680 of file qgsauthconfigurationstoragedb.cpp.

◆ loadSslCertCustomConfigByHost()

const QgsAuthConfigSslServer QgsAuthConfigurationStorageDb::loadSslCertCustomConfigByHost ( const QString &  hostport) const
overridevirtual

Loads an SSL certificate custom config by hostport (host:port)

Parameters
hostporthost:port
Returns
a SSL certificate custom config
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 726 of file qgsauthconfigurationstoragedb.cpp.

◆ masterPasswords()

const QList< QgsAuthConfigurationStorage::MasterPasswordConfig > QgsAuthConfigurationStorageDb::masterPasswords ( ) const
overridevirtual

Returns the list of (encrypted) master passwords stored in the database.

Returns
list of master passwords
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1379 of file qgsauthconfigurationstoragedb.cpp.

◆ masterPasswordTableName()

QString QgsAuthConfigurationStorageDb::masterPasswordTableName ( ) const
virtual

Returns the name of the table used to store the master passwords.

Definition at line 1485 of file qgsauthconfigurationstoragedb.cpp.

◆ methodConfigExists()

bool QgsAuthConfigurationStorageDb::methodConfigExists ( const QString &  id) const
overridevirtual

Check if an authentication configuration exists in the storage.

Parameters
idConfiguration id.
Returns
true if the configuration exists, false otherwise.
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 2057 of file qgsauthconfigurationstoragedb.cpp.

◆ methodConfigTableName()

QString QgsAuthConfigurationStorageDb::methodConfigTableName ( ) const
virtual

Returns the name of the table used to store the method configurations.

Definition at line 1455 of file qgsauthconfigurationstoragedb.cpp.

◆ name()

QString QgsAuthConfigurationStorageDb::name ( ) const
overridevirtual

Returns a human readable localized short name of the storage implementation (e.g "SQLite").

This name is displayed to the user and used to identify the storage implementation.

Implements QgsAuthConfigurationStorage.

Definition at line 1510 of file qgsauthconfigurationstoragedb.cpp.

◆ quotedQualifiedIdentifier()

QString QgsAuthConfigurationStorageDb::quotedQualifiedIdentifier ( const QString &  identifier,
bool  isIndex = false 
) const
virtual

Returns the quoted identifier, prefixed with the schema (if not null), ready for the insertion into a SQL query.

Parameters
identifierthe identifier to quote.
isIndexif true, the identifier is treated as an index name.

Definition at line 1490 of file qgsauthconfigurationstoragedb.cpp.

◆ removeAuthSetting()

bool QgsAuthConfigurationStorageDb::removeAuthSetting ( const QString &  key)
overridevirtual

Remove an authentication setting from the storage.

Parameters
keySetting key.
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 2163 of file qgsauthconfigurationstoragedb.cpp.

◆ removeCertAuthority()

bool QgsAuthConfigurationStorageDb::removeCertAuthority ( const QSslCertificate &  cert)
overridevirtual

Remove a certificate authority.

Parameters
certCertificate authority
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1060 of file qgsauthconfigurationstoragedb.cpp.

◆ removeCertIdentity() [1/2]

bool QgsAuthConfigurationStorageDb::removeCertIdentity ( const QSslCertificate &  cert)
overridevirtual

Remove a certificate identity from the storage.

Parameters
certCertificate.
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 328 of file qgsauthconfigurationstoragedb.cpp.

◆ removeCertIdentity() [2/2]

bool QgsAuthConfigurationStorageDb::removeCertIdentity ( const QString &  id)
overridevirtual

Remove a certificate identity from the storage.

Parameters
idCertificate identity id
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 565 of file qgsauthconfigurationstoragedb.cpp.

◆ removeCertTrustPolicy()

bool QgsAuthConfigurationStorageDb::removeCertTrustPolicy ( const QSslCertificate &  cert)
overridevirtual

Remove certificate trust policy.

Parameters
certCertificate
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1297 of file qgsauthconfigurationstoragedb.cpp.

◆ removeMethodConfig()

bool QgsAuthConfigurationStorageDb::removeMethodConfig ( const QString &  id)
overridevirtual

Removes the authentication configuration with the specified id.

Returns
true if the configuration was removed, false otherwise.
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 2023 of file qgsauthconfigurationstoragedb.cpp.

◆ removeSslCertCustomConfig()

bool QgsAuthConfigurationStorageDb::removeSslCertCustomConfig ( const QString &  id,
const QString &  hostport 
)
overridevirtual

Remove an SSL certificate custom config.

Parameters
idsha hash
hostporthost:port
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 851 of file qgsauthconfigurationstoragedb.cpp.

◆ settingsParameters()

QList< QgsAuthConfigurationStorage::SettingParameter > QgsAuthConfigurationStorageDb::settingsParameters ( ) const
overridevirtual

Returns a list of the settings accepted by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 267 of file qgsauthconfigurationstoragedb.cpp.

◆ sslCertCustomConfigExists()

bool QgsAuthConfigurationStorageDb::sslCertCustomConfigExists ( const QString &  id,
const QString &  hostport 
)
overridevirtual

Check if SSL certificate custom config exists.

Parameters
idsha hash
hostporthost:port
Returns
true if the SSL certificate custom config exists, false otherwise
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 805 of file qgsauthconfigurationstoragedb.cpp.

◆ sslCertCustomConfigIds()

QStringList QgsAuthConfigurationStorageDb::sslCertCustomConfigIds ( ) const
overridevirtual

Returns the list of SSL certificate custom config ids.

Returns
list of SSL certificate custom config ids
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 649 of file qgsauthconfigurationstoragedb.cpp.

◆ sslCertCustomConfigs()

const QList< QgsAuthConfigSslServer > QgsAuthConfigurationStorageDb::sslCertCustomConfigs ( ) const
overridevirtual

sslCertCustomConfigs get SSL certificate custom configs

Returns
list of SSL certificate custom config
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 770 of file qgsauthconfigurationstoragedb.cpp.

◆ sslCertCustomConfigTableName()

QString QgsAuthConfigurationStorageDb::sslCertCustomConfigTableName ( ) const
virtual

Returns the name of the table used to store the SSL custom configurations.

Definition at line 1470 of file qgsauthconfigurationstoragedb.cpp.

◆ storeAuthSetting()

bool QgsAuthConfigurationStorageDb::storeAuthSetting ( const QString &  key,
const QString &  value 
)
overridevirtual

Store an authentication setting in the storage.

Parameters
keySetting key.
valueSetting value.
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 2088 of file qgsauthconfigurationstoragedb.cpp.

◆ storeCertAuthority()

bool QgsAuthConfigurationStorageDb::storeCertAuthority ( const QSslCertificate &  cert)
overridevirtual

Store a certificate authority.

Parameters
certCertificate authority
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 924 of file qgsauthconfigurationstoragedb.cpp.

◆ storeCertIdentity()

bool QgsAuthConfigurationStorageDb::storeCertIdentity ( const QSslCertificate &  cert,
const QString &  keyPem 
)
overridevirtual

Store a certificate identity in the storage.

Parameters
certCertificate.
keyPemSSL key in PEM format.
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 284 of file qgsauthconfigurationstoragedb.cpp.

◆ storeCertTrustPolicy()

bool QgsAuthConfigurationStorageDb::storeCertTrustPolicy ( const QSslCertificate &  cert,
QgsAuthCertUtils::CertTrustPolicy  policy 
)
overridevirtual

Store certificate trust policy.

Parameters
certCertificate
policyTrust policy
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1178 of file qgsauthconfigurationstoragedb.cpp.

◆ storeMasterPassword()

bool QgsAuthConfigurationStorageDb::storeMasterPassword ( const QgsAuthConfigurationStorage::MasterPasswordConfig config)
overridevirtual

Store a master password in the database.

Parameters
configMaster password configuration.
Returns
true if operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1412 of file qgsauthconfigurationstoragedb.cpp.

◆ storeMethodConfig()

bool QgsAuthConfigurationStorageDb::storeMethodConfig ( const QgsAuthMethodConfig config,
const QString &  payload 
)
overridevirtual

Store an authentication config in the database.

Parameters
configAuthentication configuration.
payloadpayload to store (possibly encrypted).
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 1967 of file qgsauthconfigurationstoragedb.cpp.

◆ storeSslCertCustomConfig()

bool QgsAuthConfigurationStorageDb::storeSslCertCustomConfig ( const QgsAuthConfigSslServer config)
overridevirtual

Store an SSL certificate custom config.

Parameters
configSSL certificate custom config
Returns
Whether operation succeeded
Exceptions
QgsNotSupportedExceptionif the operation is not supported by the storage.

Implements QgsAuthConfigurationStorage.

Definition at line 599 of file qgsauthconfigurationstoragedb.cpp.

◆ tableExists()

bool QgsAuthConfigurationStorageDb::tableExists ( const QString &  table) const
virtual

Returns true if the specified table exists in the database, false otherwise.

Note
The schema is automatically prepended to the table name.

Definition at line 2298 of file qgsauthconfigurationstoragedb.cpp.

◆ type()

QString QgsAuthConfigurationStorageDb::type ( ) const
overridevirtual

Returns the type of the storage implementation.

The type is used to identify the storage implementation internally (e.g. "sqlite"). A valid type must be ASCII alphanumeric and contain no spaces.

Implements QgsAuthConfigurationStorage.

Definition at line 1515 of file qgsauthconfigurationstoragedb.cpp.

Member Data Documentation

◆ mConnectOptions

QString QgsAuthConfigurationStorageDb::mConnectOptions
protected

Definition at line 239 of file qgsauthconfigurationstoragedb.h.

◆ mDatabase

QString QgsAuthConfigurationStorageDb::mDatabase
protected

Definition at line 233 of file qgsauthconfigurationstoragedb.h.

◆ mDriver

QString QgsAuthConfigurationStorageDb::mDriver
protected

Definition at line 232 of file qgsauthconfigurationstoragedb.h.

◆ mHost

QString QgsAuthConfigurationStorageDb::mHost
protected

Definition at line 234 of file qgsauthconfigurationstoragedb.h.

◆ mId

QString QgsAuthConfigurationStorageDb::mId
mutableprotected

Definition at line 229 of file qgsauthconfigurationstoragedb.h.

◆ mIsReady

bool QgsAuthConfigurationStorageDb::mIsReady = false
protected

Definition at line 241 of file qgsauthconfigurationstoragedb.h.

◆ mMutex

QRecursiveMutex QgsAuthConfigurationStorageDb::mMutex
mutableprotected

Definition at line 243 of file qgsauthconfigurationstoragedb.h.

◆ mPassword

QString QgsAuthConfigurationStorageDb::mPassword
protected

Definition at line 236 of file qgsauthconfigurationstoragedb.h.

◆ mPort

int QgsAuthConfigurationStorageDb::mPort
protected

Definition at line 237 of file qgsauthconfigurationstoragedb.h.

◆ mUser

QString QgsAuthConfigurationStorageDb::mUser
protected

Definition at line 235 of file qgsauthconfigurationstoragedb.h.


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