QGIS API Documentation 3.41.0-Master (d5b93354e9c)
|
Abstract class that defines the interface for all authentication configuration storage implementations. More...
#include <qgsauthconfigurationstorage.h>
Classes | |
struct | MasterPasswordConfig |
Structure that holds the (encrypted) master password elements. More... | |
struct | SettingParameter |
Storage configuration setting parameter. More... | |
Signals | |
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. | |
Public Member Functions | |
QgsAuthConfigurationStorage (const QMap< QString, QVariant > &settings) | |
Creates a new authentication configuration storage. | |
virtual | ~QgsAuthConfigurationStorage () |
virtual QgsAuthMethodConfigsMap | authMethodConfigs (const QStringList &allowedMethods=QStringList()) const =0 |
Returns a mapping of authentication configurations available from this storage. | |
virtual QgsAuthMethodConfigsMap | authMethodConfigsWithPayload () const =0 |
Returns a mapping of authentication configurations available from this storage. | |
virtual bool | authSettingExists (const QString &key) const =0 |
Check if an authentication setting exists in the storage. | |
virtual const QList< QSslCertificate > | caCerts () const =0 |
Returns the list of CA certificates in the storage. | |
virtual const QMap< QString, QgsAuthCertUtils::CertTrustPolicy > | caCertsPolicy () const =0 |
Returns the map of CA certificates hashes in the storages and their trust policy. | |
Qgis::AuthConfigurationStorageCapabilities | capabilities () const |
Returns the capabilities of the storage. | |
virtual bool | certAuthorityExists (const QSslCertificate &cert) const =0 |
Check if a certificate authority exists. | |
virtual QStringList | certAuthorityIds () const =0 |
Returns the list of certificate authority IDs in the storage. | |
virtual const QList< QSslCertificate > | certIdentities () const =0 |
certIdentities get certificate identities | |
virtual bool | certIdentityExists (const QString &id) const =0 |
Check if the certificate identity exists. | |
virtual QStringList | certIdentityIds () const =0 |
certIdentityIds get list of certificate identity ids from database | |
virtual bool | certTrustPolicyExists (const QSslCertificate &cert) const =0 |
Check if certificate trust policy exists. | |
virtual bool | clearMasterPasswords ()=0 |
Remove all master passwords from the database. | |
virtual bool | clearMethodConfigs ()=0 |
Remove all authentications configurations from the storage. | |
virtual QString | description () const =0 |
Returns a human readable localized description of the storage implementation (e.g. | |
virtual bool | erase ()=0 |
Completely erase the storage removing all configurations/certs/settings etc. | |
virtual QString | id () const =0 |
Returns the unique identifier of the storage object. | |
virtual bool | initialize () |
Initializes 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 bool | isReady () const =0 |
Returns true is the storage is ready to be used. | |
virtual QString | lastError () const |
Returns the last error message. | |
virtual QString | loadAuthSetting (const QString &key) const =0 |
Load an authentication setting from the storage. | |
virtual const QSslCertificate | loadCertAuthority (const QString &id) const =0 |
certAuthority get a certificate authority by id (sha hash) | |
virtual const QSslCertificate | loadCertIdentity (const QString &id) const =0 |
certIdentity get a certificate identity by id (sha hash) | |
virtual const QPair< QSslCertificate, QString > | loadCertIdentityBundle (const QString &id) const =0 |
Returns a certificate identity bundle by id (sha hash). | |
virtual QgsAuthCertUtils::CertTrustPolicy | loadCertTrustPolicy (const QSslCertificate &cert) const =0 |
Load certificate trust policy. | |
virtual QgsAuthMethodConfig | loadMethodConfig (const QString &id, QString &payload, bool full=false) const =0 |
Load an authentication configuration from the database. | |
virtual const QgsAuthConfigSslServer | loadSslCertCustomConfig (const QString &id, const QString &hostport) const =0 |
Loads an SSL certificate custom config by id (sha hash) and hostport (host:port) | |
virtual const QgsAuthConfigSslServer | loadSslCertCustomConfigByHost (const QString &hostport) const =0 |
Loads an SSL certificate custom config by hostport (host:port) | |
virtual const QList< QgsAuthConfigurationStorage::MasterPasswordConfig > | masterPasswords () const =0 |
Returns the list of (encrypted) master passwords stored in the database. | |
virtual bool | methodConfigExists (const QString &id) const =0 |
Check if an authentication configuration exists in the storage. | |
virtual QString | name () const =0 |
Returns a human readable localized short name of the storage implementation (e.g "SQLite"). | |
virtual bool | removeAuthSetting (const QString &key)=0 |
Remove an authentication setting from the storage. | |
virtual bool | removeCertAuthority (const QSslCertificate &cert)=0 |
Remove a certificate authority. | |
virtual bool | removeCertIdentity (const QSslCertificate &cert)=0 |
Remove a certificate identity from the storage. | |
virtual bool | removeCertIdentity (const QString &id)=0 |
Remove a certificate identity from the storage. | |
virtual bool | removeCertTrustPolicy (const QSslCertificate &cert)=0 |
Remove certificate trust policy. | |
virtual bool | removeMethodConfig (const QString &id)=0 |
Removes the authentication configuration with the specified id. | |
virtual bool | removeSslCertCustomConfig (const QString &id, const QString &hostport)=0 |
Remove an SSL certificate custom config. | |
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. | |
virtual QList< QgsAuthConfigurationStorage::SettingParameter > | settingsParameters () const =0 |
Returns a list of the settings accepted by the storage. | |
virtual bool | sslCertCustomConfigExists (const QString &id, const QString &hostport)=0 |
Check if SSL certificate custom config exists. | |
virtual QStringList | sslCertCustomConfigIds () const =0 |
Returns the list of SSL certificate custom config ids. | |
virtual const QList< QgsAuthConfigSslServer > | sslCertCustomConfigs () const =0 |
sslCertCustomConfigs get SSL certificate custom configs | |
virtual bool | storeAuthSetting (const QString &key, const QString &value)=0 |
Store an authentication setting in the storage. | |
virtual bool | storeCertAuthority (const QSslCertificate &cert)=0 |
Store a certificate authority. | |
virtual bool | storeCertIdentity (const QSslCertificate &cert, const QString &keyPem)=0 |
Store a certificate identity in the storage. | |
virtual bool | storeCertTrustPolicy (const QSslCertificate &cert, QgsAuthCertUtils::CertTrustPolicy policy)=0 |
Store certificate trust policy. | |
virtual bool | storeMasterPassword (const QgsAuthConfigurationStorage::MasterPasswordConfig &config)=0 |
Store a master password in the database. | |
virtual bool | storeMethodConfig (const QgsAuthMethodConfig &config, const QString &payload)=0 |
Store an authentication config in the database. | |
virtual bool | storeSslCertCustomConfig (const QgsAuthConfigSslServer &config)=0 |
Store an SSL certificate custom config. | |
virtual QString | type () const =0 |
Returns the type of the storage implementation. | |
Protected Member Functions | |
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 | |
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. | |
Abstract class that defines the interface for all authentication configuration storage implementations.
Definition at line 36 of file qgsauthconfigurationstorage.h.
QgsAuthConfigurationStorage::QgsAuthConfigurationStorage | ( | const QMap< QString, QVariant > & | settings | ) |
Creates a new authentication configuration storage.
settings | Implementation-specific configuration settings. |
Definition at line 19 of file qgsauthconfigurationstorage.cpp.
|
inlinevirtual |
Definition at line 68 of file qgsauthconfigurationstorage.h.
|
pure virtual |
Returns a mapping of authentication configurations available from this storage.
allowedMethods | Optional filter to return only configurations for specific authentication methods. |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Returns a mapping of authentication configurations available from this storage.
The encrypted payload is added to the configuration as "encrypted_payload" key.
QgsNotSupportedException | if the operation is not supported by the storage |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Check if an authentication setting exists in the storage.
key | Setting key. |
true
if the setting exists, false
otherwise. QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
signal |
Emitted when the storage auth settings table was changed.
|
pure virtual |
Returns the list of CA certificates in the storage.
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Returns the map of CA certificates hashes in the storages and their trust policy.
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
Qgis::AuthConfigurationStorageCapabilities QgsAuthConfigurationStorage::capabilities | ( | ) | const |
Returns the capabilities of the storage.
Definition at line 76 of file qgsauthconfigurationstorage.cpp.
|
signal |
Emitted when the storage cert authority table was changed.
|
pure virtual |
Check if a certificate authority exists.
cert | Certificate authority |
true
if the certificate authority exists, false
otherwise QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Returns the list of certificate authority IDs in the storage.
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
certIdentities get certificate identities
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
signal |
Emitted when the storage cert identity table was changed.
|
pure virtual |
Check if the certificate identity exists.
id | Certificate identity id |
true
if the certificate identity exists, false
otherwise QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
certIdentityIds get list of certificate identity ids from database
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Check if certificate trust policy exists.
cert | Certificate |
true
if the certificate trust policy exists, false
otherwise QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
protected |
Utility to check capability and throw QgsNotSupportedException if not supported.
Definition at line 118 of file qgsauthconfigurationstorage.cpp.
|
pure virtual |
Remove all master passwords from the database.
true
if operation succeeded QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Remove all authentications configurations from the storage.
true
if authentications configurations were removed, false
otherwise. QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
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.
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Completely erase the storage removing all configurations/certs/settings etc.
true
if storage was completely erased, false
if any error occurred. QgsNotSupportedException | if the operation is not supported by the storage (e.g. the storage is read-only). |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
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).
Implemented in QgsAuthConfigurationStorageDb.
|
inlinevirtual |
Initializes the storage.
true
if the storage was successfully initialized, false
otherwise. If the storage is already initialized, this method does nothing and returns true
.true
. This method is called by the authentication manager when the storage is added to the manager. Reimplemented in QgsAuthConfigurationStorageDb.
Definition at line 103 of file qgsauthconfigurationstorage.h.
bool QgsAuthConfigurationStorage::isEnabled | ( | ) | const |
Returns true
if the storage is enabled.
Definition at line 92 of file qgsauthconfigurationstorage.cpp.
bool QgsAuthConfigurationStorage::isEncrypted | ( | ) | const |
Returns true
if the storage is encrypted.
Definition at line 102 of file qgsauthconfigurationstorage.cpp.
|
virtual |
Returns true
if the storage is read-only, false
otherwise.
Definition at line 65 of file qgsauthconfigurationstorage.cpp.
|
pure virtual |
Returns true
is the storage is ready to be used.
Implemented in QgsAuthConfigurationStorageDb.
|
virtual |
Returns the last error message.
Definition at line 71 of file qgsauthconfigurationstorage.cpp.
|
pure virtual |
Load an authentication setting from the storage.
key | Setting key. |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
certAuthority get a certificate authority by id (sha hash)
id | sha hash |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
certIdentity get a certificate identity by id (sha hash)
id | sha hash of the cert |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Returns a certificate identity bundle by id (sha hash).
id | sha shash |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Load certificate trust policy.
cert | Certificate |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Load an authentication configuration from the database.
id | Configuration id. |
payload | (possibly encrypted) payload. |
full | If true , the full configuration is loaded and the (possibly encrypted) payload is populated, otherwise only the configuration metadata is loaded. |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Loads an SSL certificate custom config by id (sha hash) and hostport (host:port)
id | sha hash |
hostport | string host:port |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Loads an SSL certificate custom config by hostport (host:port)
hostport | host:port |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
protectedvirtual |
Returns the logger tag for the storage.
The default implementation returns the literal "Auth storage" followed by the storage name.
Definition at line 113 of file qgsauthconfigurationstorage.cpp.
|
signal |
Emitted when the storage master password table was changed.
|
pure virtual |
Returns the list of (encrypted) master passwords stored in the database.
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
signal |
Custom logging signal to relay to console output and QgsMessageLog.
message | Message to send |
tag | Associated tag (title) |
level | Message log level |
|
signal |
Emitted when the storage method config table was changed.
|
pure virtual |
Check if an authentication configuration exists in the storage.
id | Configuration id. |
true
if the configuration exists, false
otherwise. QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
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.
Implemented in QgsAuthConfigurationStorageDb.
|
signal |
Emitted when the storage read-only status was changed.
|
pure virtual |
Remove an authentication setting from the storage.
key | Setting key. |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Remove a certificate authority.
cert | Certificate authority |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Remove a certificate identity from the storage.
cert | Certificate. |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Remove a certificate identity from the storage.
id | Certificate identity id |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Remove certificate trust policy.
cert | Certificate |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Removes the authentication configuration with the specified id.
true
if the configuration was removed, false
otherwise. QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Remove an SSL certificate custom config.
id | sha hash |
hostport | host:port |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
protected |
Set the capabilities of the storage to capabilities.
Definition at line 81 of file qgsauthconfigurationstorage.cpp.
void QgsAuthConfigurationStorage::setEnabled | ( | bool | enabled | ) |
Set the storage enabled status to enabled.
Definition at line 97 of file qgsauthconfigurationstorage.cpp.
|
protected |
Set the last error message to error with message level level.
Definition at line 86 of file qgsauthconfigurationstorage.cpp.
|
virtual |
Utility method to unset all editing capabilities.
Definition at line 56 of file qgsauthconfigurationstorage.cpp.
QMap< QString, QVariant > QgsAuthConfigurationStorage::settings | ( | ) | const |
Returns the settings of the storage.
Definition at line 107 of file qgsauthconfigurationstorage.cpp.
|
pure virtual |
Returns a list of the settings accepted by the storage.
Implemented in QgsAuthConfigurationStorageDb.
|
signal |
Emitted when the storage ssl cert custom config table was changed.
|
pure virtual |
Check if SSL certificate custom config exists.
id | sha hash |
hostport | host:port |
true
if the SSL certificate custom config exists, false
otherwise QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Returns the list of SSL certificate custom config ids.
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
sslCertCustomConfigs get SSL certificate custom configs
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
signal |
Emitted when the storage ssl cert trust policy table was changed.
|
signal |
Emitted when the storage was updated.
id | The storage id |
|
pure virtual |
Store an authentication setting in the storage.
key | Setting key. |
value | Setting value. |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Store a certificate authority.
cert | Certificate authority |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Store a certificate identity in the storage.
cert | Certificate. |
keyPem | SSL key in PEM format. |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Store certificate trust policy.
cert | Certificate |
policy | Trust policy |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Store a master password in the database.
config | Master password configuration. |
true
if operation succeeded QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Store an authentication config in the database.
config | Authentication configuration. |
payload | payload to store (possibly encrypted). |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
Store an SSL certificate custom config.
config | SSL certificate custom config |
QgsNotSupportedException | if the operation is not supported by the storage. |
Implemented in QgsAuthConfigurationStorageDb.
|
pure virtual |
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.
Implemented in QgsAuthConfigurationStorageDb.
|
protected |
Store the capabilities of the storage.
Definition at line 589 of file qgsauthconfigurationstorage.h.
|
protected |
Store the implementation-specific configuration.
Definition at line 584 of file qgsauthconfigurationstorage.h.
|
protected |
Store whether the storage is enabled.
Definition at line 604 of file qgsauthconfigurationstorage.h.
|
protected |
Store whether the storage is encrypted.
Definition at line 599 of file qgsauthconfigurationstorage.h.
|
protected |
Store whether the storage is read-only.
Definition at line 609 of file qgsauthconfigurationstorage.h.
|
mutableprotected |
Store the last error message.
Definition at line 594 of file qgsauthconfigurationstorage.h.