Class: QgsAuthMethodConfig¶
-
class
qgis.core.
QgsAuthMethodConfig
(method: str = '', version: int = 0)¶ Bases:
sip.wrapper
Construct a configuration for an authentication method
- Parameters
method (str = '') – Textual key of the authentication method
version (int = 0) – Version of the configuration (for updating previously saved configs later on)
QgsAuthMethodConfig(
QgsAuthMethodConfig
)Configuration storage class for authentication method configurations
Methods
Clear all configs
Returns a config’s value
Returns a config’s list of values
Gets extended configuration, mapped to key/value pairs of QStrings
The extended configuration, as stored and retrieved from the authentication database
Whether a config key exists in config map
Gets ‘authcfg’ 7-character alphanumeric ID of the config
Whether the configuration is valid
Load existing extended configuration
Textual key of the associated authentication method
Gets name of configuration
Remove a config from map
Set a single config value per key in the map
Set a multiple config values per key in the map
Set extended configuration map
Sets auth config ID
- param method
Sets name of configuration
- param uri
Sets version of the configuration
A URI to auto-select a config when connecting to a resource
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
Gets version of the configuration
-
clearConfigMap
(self)¶ Clear all configs
-
config
(self, key: str, defaultvalue: str = '') → str¶ Returns a config’s value
- Parameters
key (str) – Config key
defaultvalue (str = '') – Default value, if key not found
- Return type
str
-
configList
(self, key: str) → List[str]¶ Returns a config’s list of values
- Parameters
key (str) –
- Return type
List[str]
-
configMap
(self) → Dict[str, str]¶ Gets extended configuration, mapped to key/value pairs of QStrings
- Return type
Dict[str, str]
-
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- Return type
str
-
hasConfig
(self, key: str) → bool¶ Whether a config key exists in config map
- Parameters
key (str) –
- Return type
bool
-
id
(self) → str¶ Gets ‘authcfg’ 7-character alphanumeric ID of the config
Note
This is set by
QgsAuthManager
when the config is initially stored- Return type
str
-
isValid
(self, validateid: bool = False) → bool¶ Whether the configuration is valid
- Parameters
validateid (bool = False) – Additionally verify the auth config ID is not empty
- Return type
bool
-
loadConfigString
(self, configstr: str)¶ Load existing extended configuration
- Parameters
configstr (str) – Configuration string to load
-
method
(self) → str¶ Textual key of the associated authentication method
- Return type
str
-
name
(self) → str¶ Gets name of configuration
- Return type
str
-
removeConfig
(self, key: str) → int¶ Remove a config from map
- Parameters
key (str) – Config to remove
- Return type
int
- 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 (str) – Config key
value (str) – 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 (str) – Config key
value (Iterable[str]) – Config value
-
setConfigMap
(self, map: Dict[str, str])¶ Set extended configuration map
- Parameters
map (Dict[str) – Map to set
-
setId
(self, id: str)¶ Sets auth config ID
- Parameters
id (str) –
-
setMethod
(self, method: str)¶ - Parameters
method (str) –
-
setName
(self, name: str)¶ Sets name of configuration
- Parameters
name (str) –
-
setUri
(self, uri: str)¶ - Parameters
uri (str) –
-
setVersion
(self, version: int)¶ Sets version of the configuration
- Parameters
version (int) –
-
uri
(self) → str¶ A URI to auto-select a config when connecting to a resource
- Return type
str
-
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 (str) – A URL to process
resource (str) – Output variable for result
withpath (bool = False) – Whether to include the URI’s path in output
- Return type
bool
-
version
(self) → int¶ Gets version of the configuration
- Return type
int