QgsAuthMethod class

Abstract base class for authentication method plugins.

Public types

enum Expansion { NetworkRequest = 0x1, NetworkReply = 0x2, DataSourceUri = 0x4, GenericDataSourceUri = 0x8, NetworkProxy = 0x16, All = NetworkRequest | NetworkReply | DataSourceUri | GenericDataSourceUri | NetworkProxy }
Flags that represent the update points (where authentication configurations are expanded) supported by an authentication method.

Constructors, destructors, conversion operators

QgsAuthMethod() protected explicit
Construct a default authentication method.

Public functions

void clearCachedConfig(const QString& authcfg) pure virtual
Clear any cached configuration.
auto description() const -> QString pure virtual
A non-translated short description representing the auth method for use in debug output and About dialog.
auto displayDescription() const -> QString pure virtual
Translatable display version of the 'description()'.
auto key() const -> QString pure virtual
A non-translated short name representing the auth method.
auto supportedDataProviders() const -> QStringList
The data providers that the method supports, allowing for filtering out authcfgs that are not applicable to a given provider, or where the updating code is not currently implemented.
auto supportedExpansions() const -> QgsAuthMethod::Expansions
Flags that represent the update points (where authentication configurations are expanded) supported by an authentication method.
auto updateDataSourceUriItems(QStringList& connectionItems, const QString& authcfg, const QString& dataprovider = QString()) -> bool virtual
Update data source connection items with authentication components.
void updateMethodConfig(QgsAuthMethodConfig& mconfig) pure virtual
Update an authentication configuration in place.
auto updateNetworkProxy(QNetworkProxy& proxy, const QString& authcfg, const QString& dataprovider = QString()) -> bool virtual
Update proxy settings with authentication components.
auto updateNetworkReply(QNetworkReply* reply, const QString& authcfg, const QString& dataprovider = QString()) -> bool virtual
Update a network reply with authentication components.
auto updateNetworkRequest(QNetworkRequest& request, const QString& authcfg, const QString& dataprovider = QString()) -> bool virtual
Update a network request with authentication components.
auto version() const -> int
Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg.

Protected static functions

static auto authMethodTag() -> QString
Tag signifying that this is an authentcation method (e.g. for use as title in message log panel output)

Protected functions

void setDataProviders(const QStringList& dataproviders)
Sets list of data providers this auth method supports.
void setExpansions(QgsAuthMethod::Expansions expansions)
Sets the support expansions (points in providers where the authentication is injected) of the auth method.
void setVersion(int version)
Sets the version of the auth method (useful for future upgrading)

Enum documentation

enum QgsAuthMethod::Expansion

Flags that represent the update points (where authentication configurations are expanded) supported by an authentication method.

These equate to the 'update*()' virtual functions below, and allow for update point code to skip calling an unused update by a method, because the base virtual function will always return true, giving a false impression an update occurred.

Function documentation

QgsAuthMethod::QgsAuthMethod() explicit protected

Construct a default authentication method.

void QgsAuthMethod::clearCachedConfig(const QString& authcfg) pure virtual

Clear any cached configuration.

Called when the QgsAuthManager deletes an authentication configuration (authcfg).

QgsAuthMethod::Expansions QgsAuthMethod::supportedExpansions() const

Flags that represent the update points (where authentication configurations are expanded) supported by an authentication method.

bool QgsAuthMethod::updateDataSourceUriItems(QStringList& connectionItems, const QString& authcfg, const QString& dataprovider = QString()) virtual

Update data source connection items with authentication components.

Parameters
connectionItems QStringlist of 'key=value' pairs, as utilized in QgsDataSourceUri::connectionInfo()
authcfg Authentication configuration ID
dataprovider Textual key for a data provider, e.g. 'postgres', that allows for custom updater code specific to the provider
Returns Whether the update succeeded

void QgsAuthMethod::updateMethodConfig(QgsAuthMethodConfig& mconfig) pure virtual

Update an authentication configuration in place.

bool QgsAuthMethod::updateNetworkProxy(QNetworkProxy& proxy, const QString& authcfg, const QString& dataprovider = QString()) virtual

Update proxy settings with authentication components.

Parameters
proxy
authcfg Authentication configuration ID
dataprovider Textual key for a data provider, e.g. 'proxy', that allows for custom updater code specific to the provider
Returns Whether the update succeeded

bool QgsAuthMethod::updateNetworkReply(QNetworkReply* reply, const QString& authcfg, const QString& dataprovider = QString()) virtual

Update a network reply with authentication components.

Parameters
reply The network reply object to update
authcfg Authentication configuration ID
dataprovider Textual key for a data provider, e.g. 'postgres', that allows for custom updater code specific to the provider
Returns Whether the update succeeded

bool QgsAuthMethod::updateNetworkRequest(QNetworkRequest& request, const QString& authcfg, const QString& dataprovider = QString()) virtual

Update a network request with authentication components.

Parameters
request The network request to update
authcfg Authentication configuration ID
dataprovider Textual key for a data provider, e.g. 'postgres', that allows for custom updater code specific to the provider
Returns Whether the update succeeded