QgsAuthMethodConfig class

Configuration storage class for authentication method configurations.

Public static functions

static auto uriToResource(const QString& accessurl, QString* resource, bool withpath = false) -> bool
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.

Constructors, destructors, conversion operators

QgsAuthMethodConfig(const QString& method = QString(), int version = 0)
Construct a configuration for an authentication method.

Public functions

void clearConfigMap()
Clear all configs.
auto config(const QString& key, const QString& defaultvalue = QString()) const -> QString
Returns a config's value.
auto configList(const QString& key) const -> QStringList
Returns a config's list of values.
auto configMap() const -> QgsStringMap
Gets extended configuration, mapped to key/value pairs of QStrings.
auto configString() const -> const QString
The extended configuration, as stored and retrieved from the authentication database.
auto hasConfig(const QString& key) const -> bool
Whether a config key exists in config map.
auto id() const -> const QString
Gets 'authcfg' 7-character alphanumeric ID of the config.
auto isValid(bool validateid = false) const -> bool
Whether the configuration is valid.
void loadConfigString(const QString& configstr)
Load existing extended configuration.
auto method() const -> QString
Textual key of the associated authentication method.
auto name() const -> const QString
Gets name of configuration.
auto operator!=(const QgsAuthMethodConfig& other) const -> bool
Operator used to compare configs' inequality.
auto operator==(const QgsAuthMethodConfig& other) const -> bool
Operator used to compare configs' equality.
auto removeConfig(const QString& key) -> int
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 setName(const QString& name)
Sets name of configuration.
void setVersion(int version)
Sets version of the configuration.
auto uri() const -> const QString
A URI to auto-select a config when connecting to a resource.
auto version() const -> int
Gets version of the configuration.

Function documentation

static bool QgsAuthMethodConfig::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.

Parameters
accessurl A URL to process
resource Output variable for result
withpath Whether to include the URI's path in output

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

Construct a configuration for an authentication method.

Parameters
method Textual key of the authentication method
version Version of the configuration (for updating previously saved configs later on)

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

Returns a config's value.

Parameters
key Config key
defaultvalue Default value, if key not found

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

Returns a config's list of values.

Parameters
key

const QString QgsAuthMethodConfig::configString() const

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

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

Whether a config key exists in config map.

Parameters
key

const QString QgsAuthMethodConfig::id() const

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

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

Whether the configuration is valid.

Parameters
validateid Additionally verify the auth config ID is not empty

void QgsAuthMethodConfig::loadConfigString(const QString& configstr)

Load existing extended configuration.

Parameters
configstr Configuration string to load

int QgsAuthMethodConfig::removeConfig(const QString& key)

Remove a config from map.

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

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

Set a single config value per key in the map.

Parameters
key Config key
value Config value

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

Set a multiple config values per key in the map.

Parameters
key Config key
value Config value

void QgsAuthMethodConfig::setConfigMap(const QgsStringMap& map)

Set extended configuration map.

Parameters
map Map to set