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 (QWidget = None) – Parent widget

  • configId (str = '') – authentication configuration id

  • username (str = '') –

  • password (str = '') –

  • dataprovider (str = '') – 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.

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

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

Return type

bool

Returns

true if the convert button is enabled

changeEvent()
childEvent()
closeEvent()
configId(self) → str

configId

Return type

str

Returns

authentication configuration id

configurationTabIsSelected(self) → bool

configurationTabIsSelected

Return type

bool

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

Return type

bool

Returns

return true on success

create()
customEvent()
dataprovider(self) → str

dataprovider

Return type

str

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 (QgsAuthSettingsWidget.WarningType) – enum of warning type

Return type

str

Returns

pre-formatted warning text

hideEvent()
initPainter()
inputMethodEvent()
isSignalConnected()
keyPressEvent()
keyReleaseEvent()
leaveEvent()
metric()
mouseDoubleClickEvent()
mouseMoveEvent()
mousePressEvent()
mouseReleaseEvent()
moveEvent()
nativeEvent()
paintEvent()
password(self) → str

password

Return type

str

Returns

basic authentication password

receivers()
resizeEvent()
sender()
senderSignalIndex()
setBasicText(self, basicText: str)

setBasicText set the text of the warning label

Parameters

basicText (str) – the text of the basic tab label

setConfigId(self, configId: str)

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

Parameters

configId (str) –

setDataprovider(self, dataprovider: str)

setDataprovider set the data provider key for filtering compatible authentication configurations

Parameters

dataprovider (str) – data provider key

setPassword(self, password: str)

setPassword set the password

Parameters

password (str) – the password

setStorePasswordChecked(self, checked: bool)

setStorePasswordCheched check the “Store” checkbox for the password

Parameters

checked (bool) –

setStoreUsernameChecked(self, checked: bool)

setStoreUsernameChecked check the “Store” checkbox for the username

Parameters

checked (bool) –

setUsername(self, username: str)

setUsername set the username

Parameters

username (str) – the user name

setWarningText(self, warningText: str)

setWarningText set the text of the warning label

Parameters

warningText (str) – 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 (bool) –

storePasswordIsChecked(self) → bool

storePassword

Return type

bool

Returns

true if “Store” checkbox for the password is checked

storeUsernameIsChecked(self) → bool

storeUsername

Return type

bool

Returns

true if “Store” checkbox for the username is checked

tabletEvent()
timerEvent()
updateMicroFocus()
username(self) → str

username

Return type

str

Returns

basic authentication username

wheelEvent()