Subgroup: Auth

Class: QgsAuthMethod

class qgis.core.QgsAuthMethod

Bases: PyQt5.QtCore.QObject

Abstract base class for authentication method plugins

Methods

authMethodTag Tag signifying that this is an authentcation method (e.g.
blockSignals
childEvent
children
clearCachedConfig Clear any cached configuration.
connectNotify
customEvent
deleteLater
description A non-translated short description representing the auth method for use in debug output and About dialog
disconnect
disconnectNotify
displayDescription Translatable display version of the ‘description()’
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
event
eventFilter
findChild findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject
findChildren findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]
inherits
installEventFilter
isSignalConnected
isWidgetType
isWindowType
key A non-translated short name representing the auth method
killTimer
metaObject
moveToThread
objectName
parent
property
pyqtConfigure Each keyword argument is either the name of a Qt property or a Qt signal.
receivers
removeEventFilter
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
setObjectName
setParent
setProperty
setVersion Set the version of the auth method (useful for future upgrading)
signalsBlocked
startTimer
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.
thread
timerEvent
tr
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
destroyed destroyed(self, QObject = None) [signal]
objectNameChanged objectNameChanged(self, str) [signal]
staticMetaObject
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