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

Protected Member Functions

 QgsAuthMethod ()
 Construct a default authentication method. More...
 
void setDataProviders (const QStringList &dataproviders)
 Sets list of data providers this auth method supports. More...
 
void setExpansions (QgsAuthMethod::Expansions expansions)
 Sets the support expansions (points in providers where the authentication is injected) of the auth method. More...
 
void setVersion (int version)
 Sets the version of the auth method (useful for future upgrading) More...
 

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

Protected Attributes

QStringList mDataProviders
 
QgsAuthMethod::Expansions mExpansions
 
QMutex mMutex
 
int mVersion = 0
 

Detailed Description

Abstract base class for authentication method plugins.

Definition at line 36 of file qgsauthmethod.h.

Member Enumeration Documentation

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 50 of file qgsauthmethod.h.

Constructor & Destructor Documentation

QgsAuthMethod::QgsAuthMethod ( )
inlineexplicitprotected

Construct a default authentication method.

Note
Non-public since this is an abstract base class

Definition at line 175 of file qgsauthmethod.h.

Member Function Documentation

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 183 of file qgsauthmethod.h.

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.
virtual QString QgsAuthMethod::description ( ) const
pure virtual

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

virtual QString QgsAuthMethod::displayDescription ( ) const
pure virtual

Translatable display version of the 'description()'.

virtual QString QgsAuthMethod::key ( ) const
pure virtual

A non-translated short name representing the auth method.

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

Sets list of data providers this auth method supports.

Definition at line 191 of file qgsauthmethod.h.

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 189 of file qgsauthmethod.h.

void QgsAuthMethod::setVersion ( int  version)
inlineprotected

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

Definition at line 186 of file qgsauthmethod.h.

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 85 of file qgsauthmethod.h.

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 79 of file qgsauthmethod.h.

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 129 of file qgsauthmethod.h.

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
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 146 of file qgsauthmethod.h.

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 112 of file qgsauthmethod.h.

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 95 of file qgsauthmethod.h.

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 72 of file qgsauthmethod.h.

Member Data Documentation

QStringList QgsAuthMethod::mDataProviders
protected

Definition at line 194 of file qgsauthmethod.h.

QgsAuthMethod::Expansions QgsAuthMethod::mExpansions
protected

Definition at line 193 of file qgsauthmethod.h.

QMutex QgsAuthMethod::mMutex
protected

Definition at line 196 of file qgsauthmethod.h.

int QgsAuthMethod::mVersion = 0
protected

Definition at line 195 of file qgsauthmethod.h.


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