Subgroup: Auth

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.
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 Set list of data providers this auth method supports
setExpansions Set the support expansions (points in providers where the authentication is injected) of the auth method
setVersion Set 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

Signals

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)

childEvent()
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.

connectNotify()
customEvent()
description(self) → str

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

disconnectNotify()
displayDescription(self) → str

Translatable display version of the ‘description()’

isSignalConnected()
key(self) → str

A non-translated short name representing the auth method

receivers()
sender()
senderSignalIndex()
setDataProviders(self, dataproviders: Iterable[str])

Set list of data providers this auth method supports

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

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

setVersion(self, version: int)

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

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.

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

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

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
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

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

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
updateNetworkReply(self, reply: QNetworkReply, authcfg: str, dataprovider: str = '') → bool

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
updateNetworkRequest(self, request: QNetworkRequest, authcfg: str, dataprovider: str = '') → bool

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
version(self) → int

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