QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
QgsAuthMethod Class Referenceabstract

Abstract base class for authentication method plugins. More...

#include <qgsauthmethod.h>

Inheritance diagram for QgsAuthMethod:
Inheritance graph
[legend]

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

Public Member Functions

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

Protected Member Functions

 QgsAuthMethod ()
 Construct a default authentication method.
 
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)
 

Static Protected Member Functions

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

Protected Attributes

QStringList mDataProviders
 
QgsAuthMethod::Expansions mExpansions = QgsAuthMethod::Expansions()
 
QRecursiveMutex mMutex
 
int mVersion = 0
 

Detailed Description

Abstract base class for authentication method plugins.

Definition at line 38 of file qgsauthmethod.h.

Member Enumeration Documentation

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

Note
When adding an 'update' member function, also add the corresponding Expansion flag.
These flags will be added to as new update points are added
Enumerator
NetworkRequest 
NetworkReply 
DataSourceUri 
GenericDataSourceUri 
NetworkProxy 
All 

Definition at line 52 of file qgsauthmethod.h.

Constructor & Destructor Documentation

◆ QgsAuthMethod()

QgsAuthMethod::QgsAuthMethod ( )
explicitprotected

Construct a default authentication method.

Note
Non-public since this is an abstract base class

Definition at line 27 of file qgsauthmethod.cpp.

Member Function Documentation

◆ authMethodTag()

static QString QgsAuthMethod::authMethodTag ( )
inlinestaticprotected

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

Definition at line 192 of file qgsauthmethod.h.

◆ clearCachedConfig()

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

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.

◆ description()

virtual QString QgsAuthMethod::description ( ) const
pure virtual

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

◆ displayDescription()

virtual QString QgsAuthMethod::displayDescription ( ) const
pure virtual

Translatable display version of the 'description()'.

◆ key()

virtual QString QgsAuthMethod::key ( ) const
pure virtual

A non-translated short name representing the auth method.

◆ setDataProviders()

void QgsAuthMethod::setDataProviders ( const QStringList &  dataproviders)
inlineprotected

Sets list of data providers this auth method supports.

Definition at line 200 of file qgsauthmethod.h.

◆ setExpansions()

void QgsAuthMethod::setExpansions ( QgsAuthMethod::Expansions  expansions)
inlineprotected

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

Definition at line 198 of file qgsauthmethod.h.

◆ setVersion()

void QgsAuthMethod::setVersion ( int  version)
inlineprotected

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

Definition at line 195 of file qgsauthmethod.h.

◆ supportedDataProviders()

QStringList QgsAuthMethod::supportedDataProviders ( ) const
inline

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.

Definition at line 99 of file qgsauthmethod.h.

◆ supportedExpansions()

QgsAuthMethod::Expansions QgsAuthMethod::supportedExpansions ( ) const
inline

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

Definition at line 93 of file qgsauthmethod.h.

◆ updateDataSourceUriItems()

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

Update data source connection items with authentication components.

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

Definition at line 143 of file qgsauthmethod.h.

◆ updateMethodConfig()

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

Update an authentication configuration in place.

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

◆ updateNetworkProxy()

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

Update proxy settings with authentication components.

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

Definition at line 160 of file qgsauthmethod.h.

◆ updateNetworkReply()

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

Update a network reply with authentication components.

Parameters
replyThe network reply object to update
authcfgAuthentication configuration ID
dataproviderTextual key for a data provider, e.g. 'postgres', that allows for custom updater code specific to the provider
Returns
Whether the update succeeded

Definition at line 126 of file qgsauthmethod.h.

◆ updateNetworkRequest()

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

Update a network request with authentication components.

Parameters
requestThe network request to update
authcfgAuthentication configuration ID
dataproviderTextual key for a data provider, e.g. 'postgres', that allows for custom updater code specific to the provider
Returns
Whether the update succeeded

Definition at line 109 of file qgsauthmethod.h.

◆ version()

int QgsAuthMethod::version ( ) const
inline

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

Definition at line 74 of file qgsauthmethod.h.

Member Data Documentation

◆ mDataProviders

QStringList QgsAuthMethod::mDataProviders
protected

Definition at line 203 of file qgsauthmethod.h.

◆ mExpansions

QgsAuthMethod::Expansions QgsAuthMethod::mExpansions = QgsAuthMethod::Expansions()
protected

Definition at line 202 of file qgsauthmethod.h.

◆ mMutex

QRecursiveMutex QgsAuthMethod::mMutex
protected

Definition at line 205 of file qgsauthmethod.h.

◆ mVersion

int QgsAuthMethod::mVersion = 0
protected

Definition at line 204 of file qgsauthmethod.h.


The documentation for this class was generated from the following files: