Class: QgsAuthMethod

class qgis.core.QgsAuthMethod

Bases: PyQt5.QtCore.QObject

Construct a default authentication method

Note

Non-public since this is an abstract base class

Abstract base class for authentication method plugins

Methods

authMethodTag

Tag signifying that this is an authentcation method (e.g.

childEvent

clearCachedConfig

Clear any cached configuration.

connectNotify

customEvent

description

A non-translated short description representing the auth method for use in debug output and About dialog

disconnectNotify

displayDescription

Translatable display version of the ‘description()

isSignalConnected

key

A non-translated short name representing the auth method

receivers

sender

senderSignalIndex

setDataProviders

Sets list of data providers this auth method supports

setExpansions

Sets the support expansions (points in providers where the authentication is injected) of the auth method

setVersion

Sets the version of the auth method (useful for future upgrading)

supportedDataProviders

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.

supportedExpansions

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

timerEvent

updateDataSourceUriItems

Update data source connection items with authentication components

updateMethodConfig

Update an authentication configuration in place

updateNetworkProxy

Update proxy settings with authentication components

updateNetworkReply

Update a network reply with authentication components

updateNetworkRequest

Update a network request with authentication components

version

Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg

Attributes

All

DataSourceUri

GenericDataSourceUri

NetworkProxy

NetworkReply

NetworkRequest

All = 31
DataSourceUri = 4
class Expansion

Bases: int

class Expansions

Bases: sip.wrapper

QgsAuthMethod.Expansions(Union[QgsAuthMethod.Expansions, QgsAuthMethod.Expansion]) QgsAuthMethod.Expansions(QgsAuthMethod.Expansions)

GenericDataSourceUri = 8
NetworkProxy = 22
NetworkReply = 2
NetworkRequest = 1
authMethodTag() → str

Tag signifying that this is an authentcation method (e.g. for use as title in message log panel output)

Return type

str

childEvent(self, QChildEvent)
clearCachedConfig(self, authcfg: str)

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

Note

It is highly recommended that a cache of authentication components (per requested authcfg) be implemented, to avoid excessive queries on the auth database. Such a cache could be as simple as a QHash or QMap of authcfg -> QgsAuthMethodConfig. See ‘Basic’ auth method plugin for example.

Parameters

authcfg (str) –

connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
description(self) → str

A non-translated short description representing the auth method for use in debug output and About dialog

Return type

str

disconnectNotify(self, QMetaMethod)
displayDescription(self) → str

Translatable display version of the ‘description()

Return type

str

isSignalConnected(self, QMetaMethod) → bool
key(self) → str

A non-translated short name representing the auth method

Return type

str

receivers(self, PYQT_SIGNAL) → int
sender(self) → QObject
senderSignalIndex(self) → int
setDataProviders(self, dataproviders: Iterable[str])

Sets list of data providers this auth method supports

Parameters

dataproviders (Iterable[str]) –

setExpansions(self, expansions: Union[QgsAuthMethod.Expansions, QgsAuthMethod.Expansion])

Sets the support expansions (points in providers where the authentication is injected) of the auth method

Parameters

expansions (Union[QgsAuthMethod.Expansions) –

setVersion(self, version: int)

Sets the version of the auth method (useful for future upgrading)

Parameters

version (int) –

supportedDataProviders(self) → List[str]

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.

Return type

List[str]

supportedExpansions(self)QgsAuthMethod.Expansions

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

Note

These should directly correlate to existing ‘update*()’ member functions

Return type

QgsAuthMethod.Expansions

timerEvent(self, QTimerEvent)
updateDataSourceUriItems(self, connectionItems: Iterable[str], authcfg: str, dataprovider: str = '') → bool

Update data source connection items with authentication components

Parameters
  • connectionItems (Iterable[str]) – QStringlist of ‘key=value’ pairs, as utilized in QgsDataSourceUri.connectionInfo()

  • authcfg (str) – Authentication configuration ID

  • dataprovider (str = '') – Textual key for a data provider, e.g. ‘postgres’, that allows for custom updater code specific to the provider

Return type

bool

Returns

Whether the update succeeded

updateMethodConfig(self, mconfig: QgsAuthMethodConfig)

Update an authentication configuration in place

Note

Useful for updating previously stored authcfgs, when an authentication method has been significantly updated

Parameters

mconfig (QgsAuthMethodConfig) –

updateNetworkProxy(self, proxy: QNetworkProxy, authcfg: str, dataprovider: str = '') → bool

Update proxy settings with authentication components

Parameters
  • proxy (QNetworkProxy) –

  • authcfg (str) – Authentication configuration ID

  • dataprovider (str = '') – Textual key for a data provider, e.g. ‘proxy’, that allows for custom updater code specific to the provider

Return type

bool

Returns

Whether the update succeeded

updateNetworkReply(self, reply: QNetworkReply, authcfg: str, dataprovider: str = '') → bool

Update a network reply with authentication components

Parameters
  • reply (QNetworkReply) – The network reply object to update

  • authcfg (str) – Authentication configuration ID

  • dataprovider (str = '') – Textual key for a data provider, e.g. ‘postgres’, that allows for custom updater code specific to the provider

Return type

bool

Returns

Whether the update succeeded

updateNetworkRequest(self, request: QNetworkRequest, authcfg: str, dataprovider: str = '') → bool

Update a network request with authentication components

Parameters
  • request (QNetworkRequest) – The network request to update

  • authcfg (str) – Authentication configuration ID

  • dataprovider (str = '') – Textual key for a data provider, e.g. ‘postgres’, that allows for custom updater code specific to the provider

Return type

bool

Returns

Whether the update succeeded

version(self) → int

Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg

Return type

int