Class: QgsAuthSettingsWidget

class qgis.gui.QgsAuthSettingsWidget(parent: QWidget = None, configId: str = '', username: str = '', password: str = '', dataprovider: str = '')

Bases: PyQt5.QtWidgets.QWidget

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

Parameters:
  • parent – Parent widget
  • configId – authentication configuration id
  • username
  • password
  • dataprovider – The key of the calling layer provider, if applicable

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.

New in version 3.0: Enums

Methods

actionEvent
btnConvertToEncryptedIsEnabled convertButtonEnabled, mainly useful for unit tests
changeEvent
childEvent
closeEvent
configId configId
configurationTabIsSelected configurationTabIsSelected
connectNotify
contextMenuEvent
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
create
customEvent
dataprovider dataprovider
destroy
disconnectNotify
dragEnterEvent
dragLeaveEvent
dragMoveEvent
dropEvent
enterEvent
event
focusInEvent
focusNextChild
focusNextPrevChild
focusOutEvent
focusPreviousChild
formattedWarning warning text message based upon where credentials are stored
hideEvent
initPainter
inputMethodEvent
isSignalConnected
keyPressEvent
keyReleaseEvent
leaveEvent
metric
mouseDoubleClickEvent
mouseMoveEvent
mousePressEvent
mouseReleaseEvent
moveEvent
nativeEvent
paintEvent
password password
receivers
resizeEvent
sender
senderSignalIndex
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 setStorePasswordCheched 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
sharedPainter
showEvent
showStoreCheckboxes showStoreCheckboxes show the “Store” checkboxes for basic auth.
storePasswordIsChecked storePassword
storeUsernameIsChecked storeUsername
tabletEvent
timerEvent
updateMicroFocus
username username
wheelEvent

Signals

Attributes

ProjectFile
UserSettings
ProjectFile = 0
UserSettings = 1
class WarningType

Bases: int

baseClass

alias of QgsAuthSettingsWidget

actionEvent()
btnConvertToEncryptedIsEnabled(self) → bool

convertButtonEnabled, mainly useful for unit tests

Returns:True if the convert button is enabled
changeEvent()
childEvent()
closeEvent()
configId(self) → str

configId

Returns:authentication configuration id
configurationTabIsSelected(self) → bool

configurationTabIsSelected

Returns:True if the configuration tab is the currently selected tab
connectNotify()
contextMenuEvent()
convertToEncrypted(self) → bool

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

Returns:return True on success
create()
customEvent()
dataprovider(self) → str

dataprovider

Returns:the data provider key used to filter compatible authentication configurations
destroy()
disconnectNotify()
dragEnterEvent()
dragLeaveEvent()
dragMoveEvent()
dropEvent()
enterEvent()
event()
focusInEvent()
focusNextChild()
focusNextPrevChild()
focusOutEvent()
focusPreviousChild()
formattedWarning(warning: QgsAuthSettingsWidget.WarningType) → str

warning text message based upon where credentials are stored

Parameters:warning – enum of warning type
Returns:pre-formatted warning text
hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
password(self) → str

password

Returns:basic authentication password
receivers()
resizeEvent()
sender()
senderSignalIndex()
setBasicText(self, basicText: str)

setBasicText set the text of the warning label

Parameters:basicText – the text of the basic tab label
setConfigId(self, configId: str)

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

setDataprovider(self, dataprovider: str)

setDataprovider set the data provider key for filtering compatible authentication configurations

Parameters:dataprovider – data provider key
setPassword(self, password: str)

setPassword set the password

Parameters:password – the password
setStorePasswordChecked(self, checked: bool)

setStorePasswordCheched check the “Store” checkbox for the password

Parameters:checked
setStoreUsernameChecked(self, checked: bool)

setStoreUsernameChecked check the “Store” checkbox for the username

Parameters:checked
setUsername(self, username: str)

setUsername set the username

Parameters:username – the user name
setWarningText(self, warningText: str)

setWarningText set the text of the warning label

Parameters:warningText – the text of the warning label
sharedPainter()
showEvent()
showStoreCheckboxes(self, enabled: bool)

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
storePasswordIsChecked(self) → bool

storePassword

Returns:True if “Store” checkbox for the password is checked
storeUsernameIsChecked(self) → bool

storeUsername

Returns:True if “Store” checkbox for the username is checked
tabletEvent()
timerEvent()
updateMicroFocus()
username(self) → str

username

Returns:basic authentication username
wheelEvent()