QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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,
  All = NetworkRequest | NetworkReply | DataSourceURI | GenericDataSourceURI
}
 Flags that represent the update points (where authentication configurations are expanded) supported by an authentication method. More...
 

Public Member Functions

virtual ~QgsAuthMethod ()
 
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 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...
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
 QObject (QObject *parent, const char *name)
 
virtual ~QObject ()
 
bool blockSignals (bool block)
 
QObjectchild (const char *objName, const char *inheritsClass, bool recursiveSearch) const
 
const QObjectList & children () const
 
const char * className () const
 
bool connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const QObject *receiver, const char *method)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method)
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QByteArraydynamicPropertyNames () const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name) const
 
QList< T > findChildren (const QRegExp &regExp) const
 
QList< T > findChildren (const QString &name) const
 
bool inherits (const char *className) const
 
void insertChild (QObject *object)
 
void installEventFilter (QObject *filterObj)
 
bool isA (const char *className) const
 
bool isWidgetType () const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
const char * name () const
 
const char * name (const char *defaultName) const
 
QString objectName () const
 
QObjectparent () const
 
QVariant property (const char *name) const
 
void removeChild (QObject *object)
 
void removeEventFilter (QObject *obj)
 
void setName (const char *name)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval)
 
QThreadthread () const
 

Protected Member Functions

 QgsAuthMethod ()
 Construct a default authentication method. More...
 
void setDataProviders (const QStringList &dataproviders)
 Set list of data providers this auth method supports. More...
 
void setExpansions (const QgsAuthMethod::Expansions &expansions)
 Set the support expansions (points in providers where the authentication is injected) of the auth method. More...
 
void setVersion (int version)
 Set the version of the auth method (useful for future upgrading) More...
 
- Protected Member Functions inherited from QObject
bool checkConnectArgs (const char *signal, const QObject *object, const char *method)
 
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const char *signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const char *signal)
 
int receivers (const char *signal) const
 
QObjectsender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Static Protected Member Functions

static QString authMethodTag ()
 Tag signifying that this is an authentcation method (e.g. More...
 
- Static Protected Member Functions inherited from QObject
QByteArray normalizeSignalSlot (const char *signalSlot)
 

Protected Attributes

QStringList mDataProviders
 
QgsAuthMethod::Expansions mExpansions
 
int mVersion
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Abstract base class for authentication method plugins.

Definition at line 33 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 funtion 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 
All 

Definition at line 46 of file qgsauthmethod.h.

Constructor & Destructor Documentation

◆ ~QgsAuthMethod()

virtual QgsAuthMethod::~QgsAuthMethod ( )
inlinevirtual

Definition at line 57 of file qgsauthmethod.h.

◆ QgsAuthMethod()

QgsAuthMethod::QgsAuthMethod ( )
inlineexplicitprotected

Construct a default authentication method.

Note
Non-public since this is an abstract base class

Definition at line 147 of file qgsauthmethod.h.

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

Set list of data providers this auth method supports.

Definition at line 162 of file qgsauthmethod.h.

◆ setExpansions()

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

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

Definition at line 160 of file qgsauthmethod.h.

◆ setVersion()

void QgsAuthMethod::setVersion ( int  version)
inlineprotected

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

Definition at line 157 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 80 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 75 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 121 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

◆ 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 105 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 89 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 69 of file qgsauthmethod.h.

Member Data Documentation

◆ mDataProviders

QStringList QgsAuthMethod::mDataProviders
protected

Definition at line 165 of file qgsauthmethod.h.

◆ mExpansions

QgsAuthMethod::Expansions QgsAuthMethod::mExpansions
protected

Definition at line 164 of file qgsauthmethod.h.

◆ mVersion

int QgsAuthMethod::mVersion
protected

Definition at line 166 of file qgsauthmethod.h.


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