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

Methods

btnConvertToEncryptedIsEnabled

convertButtonEnabled, mainly useful for unit tests

configId

configId

configurationTabIsSelected

configurationTabIsSelected

convertToEncrypted

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

dataprovider

dataprovider

password

password

removeBasicSettings

Removes the basic authentication tab from the widget.

setBasicText

setBasicText set the text of the warning label

setConfigId

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

setDataprovider

setDataprovider set the data provider key for filtering compatible authentication configurations

setPassword

setPassword set the password

setStorePasswordChecked

setStorePasswordChecked check the "Store" checkbox for the password

setStoreUsernameChecked

setStoreUsernameChecked check the "Store" checkbox for the username

setUsername

setUsername set the username

setWarningText

setWarningText set the text of the warning label

showStoreCheckboxes

showStoreCheckboxes show the "Store" checkboxes for basic auth.

storePasswordIsChecked

storePassword

storeUsernameIsChecked

storeUsername

username

username

Static Methods

formattedWarning

warning text message based upon where credentials are stored

Signals

configIdChanged

Emitted when the auth configuration ID selected in the dialog is changed.

passwordChanged

Emitted when the plain text password defined in the dialog is changed.

usernameChanged

Emitted when the plain text username defined in the dialog is changed.

Attributes

ProjectFile

UserSettings

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(None) None
Return type:

str

Returns:

authentication configuration id

signal configIdChanged[source]

Emitted when the auth configuration ID selected in the dialog is changed.

Added in version 3.22.

configurationTabIsSelected(self) bool[source]
configurationTabIsSelected(None) None
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(None) None
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(None) None
Return type:

str

Returns:

basic authentication password

signal passwordChanged[source]

Emitted when the plain text password defined in the dialog is changed.

Added in version 3.22.

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(None) None
Return type:

str

Returns:

basic authentication username

signal usernameChanged[source]

Emitted when the plain text username defined in the dialog is changed.

Added in version 3.22.