QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsAuthMethodConfig Class Reference

Configuration storage class for authentication method configurations. More...

#include <qgsauthconfig.h>

Public Member Functions

 QgsAuthMethodConfig (const QString &method=QString(), int version=0)
 Construct a configuration for an authentication method.
 
void clearConfigMap ()
 Clear all configs.
 
QString config (const QString &key, const QString &defaultvalue=QString()) const
 Returns a config's value.
 
QStringList configList (const QString &key) const
 Returns a config's list of values.
 
QgsStringMap configMap () const
 Gets extended configuration, mapped to key/value pairs of QStrings.
 
const QString configString () const
 The extended configuration, as stored and retrieved from the authentication database.
 
bool hasConfig (const QString &key) const
 Whether a config key exists in config map.
 
const QString id () const
 Gets 'authcfg' 7-character alphanumeric ID of the config.
 
bool isValid (bool validateid=false) const
 Whether the configuration is valid.
 
void loadConfigString (const QString &configstr)
 Load existing extended configuration.
 
QString method () const
 Textual key of the associated authentication method.
 
const QString name () const
 Gets name of configuration.
 
bool operator!= (const QgsAuthMethodConfig &other) const
 Operator used to compare configs' inequality.
 
bool operator== (const QgsAuthMethodConfig &other) const
 Operator used to compare configs' equality.
 
bool readXml (const QDomElement &element)
 from a DOM element.
 
int removeConfig (const QString &key)
 Remove a config from map.
 
void setConfig (const QString &key, const QString &value)
 Set a single config value per key in the map.
 
void setConfigList (const QString &key, const QStringList &value)
 Set a multiple config values per key in the map.
 
void setConfigMap (const QgsStringMap &map)
 Set extended configuration map.
 
void setId (const QString &id)
 Sets auth config ID.
 
void setMethod (const QString &method)
 
void setName (const QString &name)
 Sets name of configuration.
 
void setUri (const QString &uri)
 
void setVersion (int version)
 Sets version of the configuration.
 
const QString uri () const
 A URI to auto-select a config when connecting to a resource.
 
int version () const
 Gets version of the configuration.
 
bool writeXml (QDomElement &parentElement, QDomDocument &document)
 Stores the configuration in a DOM.
 

Static Public Member Functions

static bool uriToResource (const QString &accessurl, QString *resource, bool withpath=false)
 A utility function for generating a resource from a URL to be compared against the config's uri() for auto-selecting authentication configs to use.
 

Detailed Description

Configuration storage class for authentication method configurations.

Definition at line 41 of file qgsauthconfig.h.

Constructor & Destructor Documentation

◆ QgsAuthMethodConfig()

QgsAuthMethodConfig::QgsAuthMethodConfig ( const QString &  method = QString(),
int  version = 0 
)

Construct a configuration for an authentication method.

Parameters
methodTextual key of the authentication method
versionVersion of the configuration (for updating previously saved configs later on)

Definition at line 40 of file qgsauthconfig.cpp.

Member Function Documentation

◆ clearConfigMap()

void QgsAuthMethodConfig::clearConfigMap ( )
inline

Clear all configs.

Definition at line 156 of file qgsauthconfig.h.

◆ config()

QString QgsAuthMethodConfig::config ( const QString &  key,
const QString &  defaultvalue = QString() 
) const

Returns a config's value.

Parameters
keyConfig key
defaultvalueDefault value, if key not found

Definition at line 128 of file qgsauthconfig.cpp.

◆ configList()

QStringList QgsAuthMethodConfig::configList ( const QString &  key) const

Returns a config's list of values.

Parameters
key

Definition at line 133 of file qgsauthconfig.cpp.

◆ configMap()

QgsStringMap QgsAuthMethodConfig::configMap ( ) const
inline

Gets extended configuration, mapped to key/value pairs of QStrings.

Definition at line 105 of file qgsauthconfig.h.

◆ configString()

const QString QgsAuthMethodConfig::configString ( ) const

The extended configuration, as stored and retrieved from the authentication database.

Note
This is an internal construct used by QgsAuthManager that should generally not be set by client code

Definition at line 76 of file qgsauthconfig.cpp.

◆ hasConfig()

bool QgsAuthMethodConfig::hasConfig ( const QString &  key) const

Whether a config key exists in config map.

Parameters
key

Definition at line 138 of file qgsauthconfig.cpp.

◆ id()

const QString QgsAuthMethodConfig::id ( ) const
inline

Gets 'authcfg' 7-character alphanumeric ID of the config.

Note
This is set by QgsAuthManager when the config is initially stored

Definition at line 64 of file qgsauthconfig.h.

◆ isValid()

bool QgsAuthMethodConfig::isValid ( bool  validateid = false) const

Whether the configuration is valid.

Parameters
validateidAdditionally verify the auth config ID is not empty

Definition at line 65 of file qgsauthconfig.cpp.

◆ loadConfigString()

void QgsAuthMethodConfig::loadConfigString ( const QString &  configstr)

Load existing extended configuration.

Parameters
configstrConfiguration string to load

Definition at line 88 of file qgsauthconfig.cpp.

◆ method()

QString QgsAuthMethodConfig::method ( ) const
inline

Textual key of the associated authentication method.

Definition at line 78 of file qgsauthconfig.h.

◆ name()

const QString QgsAuthMethodConfig::name ( ) const
inline

Gets name of configuration.

Definition at line 69 of file qgsauthconfig.h.

◆ operator!=()

bool QgsAuthMethodConfig::operator!= ( const QgsAuthMethodConfig other) const

Operator used to compare configs' inequality.

Definition at line 60 of file qgsauthconfig.cpp.

◆ operator==()

bool QgsAuthMethodConfig::operator== ( const QgsAuthMethodConfig other) const

Operator used to compare configs' equality.

Definition at line 50 of file qgsauthconfig.cpp.

◆ readXml()

bool QgsAuthMethodConfig::readXml ( const QDomElement &  element)

from a DOM element.

Parameters
elementis the DOM node corresponding to item (e.g. 'LayoutItem' element)
Since
QGIS 3.20

Definition at line 182 of file qgsauthconfig.cpp.

◆ removeConfig()

int QgsAuthMethodConfig::removeConfig ( const QString &  key)

Remove a config from map.

Parameters
keyConfig to remove
Returns
Number of keys removed (should always be 1 or 0)

Definition at line 123 of file qgsauthconfig.cpp.

◆ setConfig()

void QgsAuthMethodConfig::setConfig ( const QString &  key,
const QString &  value 
)

Set a single config value per key in the map.

Note
if key exists, it is replaced
Parameters
keyConfig key
valueConfig value

Definition at line 113 of file qgsauthconfig.cpp.

◆ setConfigList()

void QgsAuthMethodConfig::setConfigList ( const QString &  key,
const QStringList &  value 
)

Set a multiple config values per key in the map.

Note
if key exists, it is replaced
Parameters
keyConfig key
valueConfig value

Definition at line 118 of file qgsauthconfig.cpp.

◆ setConfigMap()

void QgsAuthMethodConfig::setConfigMap ( const QgsStringMap map)
inline

Set extended configuration map.

Parameters
mapMap to set

Definition at line 111 of file qgsauthconfig.h.

◆ setId()

void QgsAuthMethodConfig::setId ( const QString &  id)
inline

Sets auth config ID.

Definition at line 66 of file qgsauthconfig.h.

◆ setMethod()

void QgsAuthMethodConfig::setMethod ( const QString &  method)
inline

Definition at line 79 of file qgsauthconfig.h.

◆ setName()

void QgsAuthMethodConfig::setName ( const QString &  name)
inline

Sets name of configuration.

Definition at line 71 of file qgsauthconfig.h.

◆ setUri()

void QgsAuthMethodConfig::setUri ( const QString &  uri)
inline

Definition at line 75 of file qgsauthconfig.h.

◆ setVersion()

void QgsAuthMethodConfig::setVersion ( int  version)
inline

Sets version of the configuration.

Definition at line 84 of file qgsauthconfig.h.

◆ uri()

const QString QgsAuthMethodConfig::uri ( ) const
inline

A URI to auto-select a config when connecting to a resource.

Definition at line 74 of file qgsauthconfig.h.

◆ uriToResource()

bool QgsAuthMethodConfig::uriToResource ( const QString &  accessurl,
QString *  resource,
bool  withpath = false 
)
static

A utility function for generating a resource from a URL to be compared against the config's uri() for auto-selecting authentication configs to use.

Note
Essentially strips the URL query variables, and by default, strips the path as well
Parameters
accessurlA URL to process
resourceOutput variable for result
withpathWhether to include the URI's path in output

Definition at line 143 of file qgsauthconfig.cpp.

◆ version()

int QgsAuthMethodConfig::version ( ) const
inline

Gets version of the configuration.

Definition at line 82 of file qgsauthconfig.h.

◆ writeXml()

bool QgsAuthMethodConfig::writeXml ( QDomElement &  parentElement,
QDomDocument &  document 
)

Stores the configuration in a DOM.

Parameters
parentElementparent DOM element
documentDOM document
See also
readXml()
Since
QGIS 3.20

Definition at line 160 of file qgsauthconfig.cpp.


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