Class: 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 |
|
from a DOM element. |
|
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 |
|
Sets name of configuration |
|
Sets version of the configuration |
|
A URI to auto-select a config when connecting to a resource |
|
Gets version of the configuration |
|
Stores the configuration in a DOM |
Static Methods
A utility function for generating a resource from a URL to be compared against the config's |
- class qgis.core.QgsAuthMethodConfig[source]¶
Bases:
object
- __init__(method: str | None = '', version: int = 0)
Construct a configuration for an authentication method
- Parameters:
method (Optional[str] = '') – Textual key of the authentication method
version (int = 0) – Version of the configuration (for updating previously saved configs later on)
- __init__(a0: QgsAuthMethodConfig)
- Parameters:
a0 (QgsAuthMethodConfig)
- config(self, key: str | None, defaultvalue: str | None = '') str [source]¶
Returns a config’s value
- Parameters:
key (Optional[str]) – Config key
defaultvalue (Optional[str] = '') – Default value, if key not found
- Return type:
str
- configList(self, key: str | None) List[str] [source]¶
Returns a config’s list of values
- Parameters:
key (Optional[str])
- Return type:
List[str]
- configMap(self) Dict[str, str] [source]¶
Gets extended configuration, mapped to key/value pairs of QStrings
- Return type:
Dict[str, str]
- configString(self) str [source]¶
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 | None) bool [source]¶
Whether a config key exists in config map
- Parameters:
key (Optional[str])
- Return type:
bool
- id(self) str [source]¶
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 [source]¶
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 | None)[source]¶
Load existing extended configuration
- Parameters:
configstr (Optional[str]) – Configuration string to load
- readXml(self, element: QDomElement) bool [source]¶
from a DOM element.
- Parameters:
element (QDomElement) – is the DOM node corresponding to item (e.g. ‘LayoutItem’ element)
Added in version 3.20.
- Return type:
bool
- removeConfig(self, key: str | None) int [source]¶
Remove a config from map
- Parameters:
key (Optional[str]) – Config to remove
- Return type:
int
- Returns:
Number of keys removed (should always be 1 or 0)
- setConfig(self, key: str | None, value: str | None)[source]¶
Set a single config value per key in the map
Note
if key exists, it is replaced
- Parameters:
key (Optional[str]) – Config key
value (Optional[str]) – Config value
- setConfigList(self, key: str | None, value: Iterable[str | None])[source]¶
Set a multiple config values per key in the map
Note
if key exists, it is replaced
- Parameters:
key (Optional[str]) – Config key
value (Iterable[Optional[str]]) – Config value
- setConfigMap(self, map: Dict[str | None, str | None])[source]¶
Set extended configuration map
- Parameters:
map (Dict[Optional[str], Optional[str]]) – Map to set
- setName(self, name: str | None)[source]¶
Sets name of configuration
- Parameters:
name (Optional[str])
- uri(self) str [source]¶
A URI to auto-select a config when connecting to a resource
- Return type:
str
- static uriToResource(accessurl: str | None, resource: str | None | None, withpath: bool = False) bool [source]¶
A utility function for generating a resource from a URL to be compared against the config’s
uri()
for auto-selecting authentication configs to useNote
Essentially strips the URL query variables, and by default, strips the path as well
- Parameters:
accessurl (Optional[str]) – A URL to process
resource (Optional[Optional[str]]) – Output variable for result
withpath (bool = False) – Whether to include the URI’s path in output
- Return type:
bool