Class: QgsAuthSettingsWidget

Widget for entering authentication credentials both in the form username/password and by using QGIS Authentication Database and its authentication configurations.

The widget also offers the functionality to convert username/password credentials to an authentication configuration.

Class Hierarchy

Inheritance diagram of qgis.gui.QgsAuthSettingsWidget

Base classes

QWidget

QObject

QPaintDevice

class qgis.gui.QgsAuthSettingsWidget[source]

Bases: QWidget

__init__(parent: QWidget | None = None, configId: str | None = '', username: str | None = '', password: str | None = '', dataprovider: str | None = '')

Create a dialog for setting an associated authentication config, either from existing configs, or creating/removing them from auth database

Parameters:
  • parent (Optional[QWidget] = None) – Parent widget

  • configId (Optional[str] = '') – authentication configuration id

  • username (Optional[str] = '')

  • password (Optional[str] = '')

  • dataprovider (Optional[str] = '') – The key of the calling layer provider, if applicable

ProjectFile = 0
UserSettings = 1
class WarningType

Bases: int

btnConvertToEncryptedIsEnabled(self) bool[source]

convertButtonEnabled, mainly useful for unit tests

Return type:

bool

Returns:

True if the convert button is enabled

configId(self) str[source]
configId()
Return type:

str

Returns:

authentication configuration id

signal configIdChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

configurationTabIsSelected(self) bool[source]
configurationTabIsSelected()
Return type:

bool

Returns:

True if the configuration tab is the currently selected tab

convertToEncrypted(self) bool[source]

convertToEncrypted is called when the convert to encrypted button is clicked and it creates a Basic authentication configuration from username and password specified in the Basic tab

Return type:

bool

Returns:

return True on success

dataprovider(self) str[source]
dataprovider()
Return type:

str

Returns:

the data provider key used to filter compatible authentication configurations

static formattedWarning(warning: QgsAuthSettingsWidget.WarningType) str[source]

warning text message based upon where credentials are stored

Parameters:

warning (QgsAuthSettingsWidget.WarningType) – enum of warning type

Return type:

str

Returns:

pre-formatted warning text

password(self) str[source]
password()
Return type:

str

Returns:

basic authentication password

signal passwordChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

removeBasicSettings(self)[source]

Removes the basic authentication tab from the widget.

Added in version 3.42.

setBasicText(self, basicText: str | None)[source]

setBasicText set the text of the warning label

Parameters:

basicText (Optional[str]) – the text of the basic tab label

setConfigId(self, configId: str | None)[source]

setConfigId set the authentication configuration id param configId the authentication configuration id

Parameters:

configId (Optional[str])

setDataprovider(self, dataprovider: str | None)[source]

setDataprovider set the data provider key for filtering compatible authentication configurations

Parameters:

dataprovider (Optional[str]) – data provider key

setPassword(self, password: str | None)[source]

setPassword set the password

Parameters:

password (Optional[str]) – the password

setStorePasswordChecked(self, checked: bool)[source]

setStorePasswordChecked check the “Store” checkbox for the password

Parameters:

checked (bool)

setStoreUsernameChecked(self, checked: bool)[source]

setStoreUsernameChecked check the “Store” checkbox for the username

Parameters:

checked (bool)

setUsername(self, username: str | None)[source]

setUsername set the username

Parameters:

username (Optional[str]) – the user name

setWarningText(self, warningText: str | None)[source]

setWarningText set the text of the warning label

Parameters:

warningText (Optional[str]) – the text of the warning label

showStoreCheckboxes(self, enabled: bool)[source]

showStoreCheckboxes show the “Store” checkboxes for basic auth. Some connection configurations allow the user to enter credentials for testing the connection without storing them in the project. “Store” checkboxes are disabled by default.

Parameters:

enabled (bool)

storePasswordIsChecked(self) bool[source]
Returns:

True if “Store” checkbox for the password is checked

storeUsernameIsChecked(self) bool[source]
Returns:

True if “Store” checkbox for the username is checked

username(self) str[source]
username()
Return type:

str

Returns:

basic authentication username

signal usernameChanged[source]

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.