Class: QgsAuthSettingsWidget

class qgis.gui.QgsAuthSettingsWidget

Bases: PyQt5.QtWidgets.QWidget

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.

QgsAuthSettingsWidget(parent: QWidget = None, configId: str = ‘’, username: str = ‘’, password: str = ‘’, dataprovider: str = ‘’) Create a dialog for setting an associated authentication config, either from existing configs, or creating/removing them from auth database

Parameters
ProjectFile = 0
UserSettings = 1
class WarningType

Bases: int

baseClass

alias of qgis._gui.QgsAuthSettingsWidget

actionEvent(self, QActionEvent)
btnConvertToEncryptedIsEnabled(self) bool

convertButtonEnabled, mainly useful for unit tests

Return type

bool

Returns

True if the convert button is enabled

changeEvent(self, QEvent)
childEvent(self, QChildEvent)
closeEvent(self, QCloseEvent)
configId(self) str
configId(None) None
Return type

str

Returns

authentication configuration id

configIdChanged

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

New in version 3.22: [signal]

configurationTabIsSelected(self) bool
configurationTabIsSelected(None) None
Return type

bool

Returns

True if the configuration tab is the currently selected tab

connectNotify(self, QMetaMethod)
contextMenuEvent(self, QContextMenuEvent)
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(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
customEvent(self, QEvent)
dataprovider(self) str
dataprovider(None) None
Return type

str

Returns

the data provider key used to filter compatible authentication configurations

destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
enterEvent(self, QEvent)
event(self, QEvent) bool
focusInEvent(self, QFocusEvent)
focusNextChild(self) bool
focusNextPrevChild(self, bool) bool
focusOutEvent(self, QFocusEvent)
focusPreviousChild(self) bool
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(self, QHideEvent)
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
isSignalConnected(self, QMetaMethod) bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
leaveEvent(self, QEvent)
metric(self, QPaintDevice.PaintDeviceMetric) int
mouseDoubleClickEvent(self, QMouseEvent)
mouseMoveEvent(self, QMouseEvent)
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
moveEvent(self, QMoveEvent)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) Tuple[bool, int]
paintEvent(self, QPaintEvent)
password(self) str
password(None) None
Return type

str

Returns

basic authentication password

passwordChanged

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

New in version 3.22: [signal]

receivers(self, PYQT_SIGNAL) int
resizeEvent(self, QResizeEvent)
sender(self) QObject
senderSignalIndex(self) int
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(self) QPainter
showEvent(self, QShowEvent)
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(self, QTabletEvent)
timerEvent(self, QTimerEvent)
updateMicroFocus(self)
username(self) str
username(None) None
Return type

str

Returns

basic authentication username

usernameChanged

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

New in version 3.22: [signal]

wheelEvent(self, QWheelEvent)