Class: QgsAuthMethod¶
- class qgis.core.QgsAuthMethod¶
Bases:
PyQt5.QtCore.QObject
Abstract base class for authentication method plugins
QgsAuthMethod() Construct a default authentication method
Note
Non-public since this is an abstract base class
Methods
Tag signifying that this is an authentcation method (e.g. for use as title in message log panel output).
Clear any cached configuration.
A non-translated short description representing the auth method for use in debug output and About dialog
Translatable display version of the '
description()
'Constructs the configuration for the authentication method
A non-translated short name representing the auth method
Sets list of data providers this auth method supports
Sets the support expansions (points in providers where the authentication is injected) of the auth method
Sets the version of the auth method (useful for future upgrading)
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.
Flags that represent the update points (where authentication configurations are expanded) supported by an authentication method.
Update data source connection items with authentication components
Update an authentication configuration in place
Update proxy settings with authentication components
Update a network reply with authentication components
Update a network request with authentication components
Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg
Attributes
- All = 31¶
- DataSourceUri = 4¶
- class Expansion¶
Bases:
int
- class Expansions¶
- class Expansions(Union[QgsAuthMethod.Expansions, QgsAuthMethod.Expansion])
- class Expansions(QgsAuthMethod.Expansions)
Bases:
sip.wrapper
- 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
- editWidget(self, parent: QWidget) QWidget ¶
Constructs the configuration for the authentication method
New in version 3.22.
- Parameters:
parent (QWidget) –
- Return type:
QWidget
- 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: 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:
- 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