Class: QgsAuthMethodConfig

class qgis.core.QgsAuthMethodConfig(method: str = '', version: int = 0)

Bases: sip.wrapper

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)

QgsAuthMethodConfig(QgsAuthMethodConfig)

Configuration storage class for authentication method configurations

Enums

Methods

clearConfigMap Clear all configs
config Returns a config’s value
configList Returns a config’s list of values
configMap Gets extended configuration, mapped to key/value pairs of QStrings
configString The extended configuration, as stored and retrieved from the authentication database
hasConfig Whether a config key exists in config map
id Gets ‘authcfg’ 7-character alphanumeric ID of the config
isValid Whether the configuration is valid
loadConfigString Load existing extended configuration
method Textual key of the associated authentication method
name Gets name of configuration
removeConfig Remove a config from map
setConfig Set a single config value per key in the map
setConfigList Set a multiple config values per key in the map
setConfigMap Set extended configuration map
setId Sets auth config ID
setMethod
setName Sets name of configuration
setUri
setVersion Sets version of the configuration
uri A URI to auto-select a config when connecting to a resource
uriToResource 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
version Gets version of the configuration

Signals

Attributes

clearConfigMap(self)

Clear all configs

config(self, key: str, defaultvalue: str = '') → str

Returns a config’s value

Parameters:
  • key – Config key
  • defaultvalue – Default value, if key not found
configList(self, key: str) → List[str]

Returns a config’s list of values

Parameters:key
configMap(self) → Dict[str, str]

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

configString(self) → str

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

hasConfig(self, key: str) → bool

Whether a config key exists in config map

Parameters:key
id(self) → str

Gets ‘authcfg’ 7-character alphanumeric ID of the config

Note

This is set by QgsAuthManager when the config is initially stored

isValid(self, validateid: bool = False) → bool

Whether the configuration is valid

Parameters:validateid – Additionally verify the auth config ID is not empty
loadConfigString(self, configstr: str)

Load existing extended configuration

Parameters:configstr – Configuration string to load
method(self) → str

Textual key of the associated authentication method

name(self) → str

Gets name of configuration

removeConfig(self, key: str) → int

Remove a config from map

Parameters:key – Config to remove
Returns:Number of keys removed (should always be 1 or 0)
setConfig(self, key: str, value: str)

Set a single config value per key in the map

Note

if key exists, it is replaced

Parameters:
  • key – Config key
  • value – Config value
setConfigList(self, key: str, value: Iterable[str])

Set a multiple config values per key in the map

Note

if key exists, it is replaced

Parameters:
  • key – Config key
  • value – Config value
setConfigMap(self, map: Dict[str, str])

Set extended configuration map

Parameters:map – Map to set
setId(self, id: str)

Sets auth config ID

setMethod(self, method: str)
setName(self, name: str)

Sets name of configuration

setUri(self, uri: str)
setVersion(self, version: int)

Sets version of the configuration

uri(self) → str

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

uriToResource(accessurl: str, resource: str, withpath: bool = 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

Note

Essentially strips the URL query variables, and by default, strips the path as well

Parameters:
  • accessurl – A URL to process
  • resource – Output variable for result
  • withpath – Whether to include the URI’s path in output
version(self) → int

Gets version of the configuration