QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | List of all members
QgsAuthSettingsWidget Class Reference

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

#include <qgsauthsettingswidget.h>

Inheritance diagram for QgsAuthSettingsWidget:
Inheritance graph
[legend]

Public Types

enum  WarningType { ProjectFile , UserSettings }
 The WarningType enum is used to determine the text of the message shown to the user about the destination of the stored clear-text credentials from the "Basic" tab: depending on the provider or the settings, the credentials are stored in the user settings and/or in the project file. More...
 

Public Slots

bool 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 More...
 

Signals

void configIdChanged ()
 Emitted when the auth configuration ID selected in the dialog is changed. More...
 
void passwordChanged ()
 Emitted when the plain text password defined in the dialog is changed. More...
 
void usernameChanged ()
 Emitted when the plain text username defined in the dialog is changed. More...
 

Public Member Functions

 QgsAuthSettingsWidget (QWidget *parent=nullptr, const QString &configId=QString(), const QString &username=QString(), const QString &password=QString(), const QString &dataprovider=QString())
 Create a dialog for setting an associated authentication config, either from existing configs, or creating/removing them from auth database. More...
 
bool btnConvertToEncryptedIsEnabled () const
 convertButtonEnabled, mainly useful for unit tests More...
 
QString configId () const
 configId More...
 
bool configurationTabIsSelected ()
 configurationTabIsSelected More...
 
QString dataprovider () const
 dataprovider More...
 
QString password () const
 password More...
 
void setBasicText (const QString &basicText)
 setBasicText set the text of the warning label More...
 
void setConfigId (const QString &configId)
 setConfigId set the authentication configuration id param configId the authentication configuration id More...
 
void setDataprovider (const QString &dataprovider)
 setDataprovider set the data provider key for filtering compatible authentication configurations More...
 
void setPassword (const QString &password)
 setPassword set the password More...
 
void setStorePasswordChecked (bool checked)
 setStorePasswordChecked check the "Store" checkbox for the password More...
 
void setStoreUsernameChecked (bool checked)
 setStoreUsernameChecked check the "Store" checkbox for the username More...
 
void setUsername (const QString &username)
 setUsername set the username More...
 
void setWarningText (const QString &warningText)
 setWarningText set the text of the warning label More...
 
void showStoreCheckboxes (bool enabled)
 showStoreCheckboxes show the "Store" checkboxes for basic auth. More...
 
bool storePasswordIsChecked () const
 storePassword More...
 
bool storeUsernameIsChecked () const
 storeUsername More...
 
QString username () const
 username More...
 

Static Public Member Functions

static QString formattedWarning (WarningType warning)
 warning text message based upon where credentials are stored More...
 

Detailed Description

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.

Definition at line 35 of file qgsauthsettingswidget.h.

Member Enumeration Documentation

◆ WarningType

The WarningType enum is used to determine the text of the message shown to the user about the destination of the stored clear-text credentials from the "Basic" tab: depending on the provider or the settings, the credentials are stored in the user settings and/or in the project file.

Enumerator
ProjectFile 
UserSettings 

Definition at line 49 of file qgsauthsettingswidget.h.

Constructor & Destructor Documentation

◆ QgsAuthSettingsWidget()

QgsAuthSettingsWidget::QgsAuthSettingsWidget ( QWidget *  parent = nullptr,
const QString &  configId = QString(),
const QString &  username = QString(),
const QString &  password = QString(),
const QString &  dataprovider = QString() 
)
explicit

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

Parameters
parentParent widget
configIdauthentication configuration id
username
password
dataproviderThe key of the calling layer provider, if applicable

Definition at line 23 of file qgsauthsettingswidget.cpp.

Member Function Documentation

◆ btnConvertToEncryptedIsEnabled()

bool QgsAuthSettingsWidget::btnConvertToEncryptedIsEnabled ( ) const

convertButtonEnabled, mainly useful for unit tests

Returns
true if the convert button is enabled

Definition at line 125 of file qgsauthsettingswidget.cpp.

◆ configId()

QString QgsAuthSettingsWidget::configId ( ) const

configId

Returns
authentication configuration id

Definition at line 120 of file qgsauthsettingswidget.cpp.

◆ configIdChanged

void QgsAuthSettingsWidget::configIdChanged ( )
signal

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

Since
QGIS 3.22

◆ configurationTabIsSelected()

bool QgsAuthSettingsWidget::configurationTabIsSelected ( )

configurationTabIsSelected

Returns
true if the configuration tab is the currently selected tab

Definition at line 164 of file qgsauthsettingswidget.cpp.

◆ convertToEncrypted

bool QgsAuthSettingsWidget::convertToEncrypted ( )
slot

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

Definition at line 169 of file qgsauthsettingswidget.cpp.

◆ dataprovider()

QString QgsAuthSettingsWidget::dataprovider ( ) const

dataprovider

Returns
the data provider key used to filter compatible authentication configurations

Definition at line 102 of file qgsauthsettingswidget.cpp.

◆ formattedWarning()

QString QgsAuthSettingsWidget::formattedWarning ( WarningType  warning)
static

warning text message based upon where credentials are stored

Parameters
warningenum of warning type
Returns
pre-formatted warning text

Definition at line 107 of file qgsauthsettingswidget.cpp.

◆ password()

QString QgsAuthSettingsWidget::password ( ) const

password

Returns
basic authentication password

Definition at line 79 of file qgsauthsettingswidget.cpp.

◆ passwordChanged

void QgsAuthSettingsWidget::passwordChanged ( )
signal

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

Since
QGIS 3.22

◆ setBasicText()

void QgsAuthSettingsWidget::setBasicText ( const QString &  basicText)

setBasicText set the text of the warning label

Parameters
basicTextthe text of the basic tab label

Definition at line 61 of file qgsauthsettingswidget.cpp.

◆ setConfigId()

void QgsAuthSettingsWidget::setConfigId ( const QString &  configId)

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

Definition at line 90 of file qgsauthsettingswidget.cpp.

◆ setDataprovider()

void QgsAuthSettingsWidget::setDataprovider ( const QString &  dataprovider)

setDataprovider set the data provider key for filtering compatible authentication configurations

Parameters
dataproviderdata provider key

Definition at line 96 of file qgsauthsettingswidget.cpp.

◆ setPassword()

void QgsAuthSettingsWidget::setPassword ( const QString &  password)

setPassword set the password

Parameters
passwordthe password

Definition at line 84 of file qgsauthsettingswidget.cpp.

◆ setStorePasswordChecked()

void QgsAuthSettingsWidget::setStorePasswordChecked ( bool  checked)

setStorePasswordChecked check the "Store" checkbox for the password

Parameters
checked
See also
showStoreCheckboxes

Definition at line 149 of file qgsauthsettingswidget.cpp.

◆ setStoreUsernameChecked()

void QgsAuthSettingsWidget::setStoreUsernameChecked ( bool  checked)

setStoreUsernameChecked check the "Store" checkbox for the username

Parameters
checked
See also
showStoreCheckboxes

Definition at line 144 of file qgsauthsettingswidget.cpp.

◆ setUsername()

void QgsAuthSettingsWidget::setUsername ( const QString &  username)

setUsername set the username

Parameters
usernamethe user name

Definition at line 73 of file qgsauthsettingswidget.cpp.

◆ setWarningText()

void QgsAuthSettingsWidget::setWarningText ( const QString &  warningText)

setWarningText set the text of the warning label

Parameters
warningTextthe text of the warning label
See also
formattedWarning()

Definition at line 56 of file qgsauthsettingswidget.cpp.

◆ showStoreCheckboxes()

void QgsAuthSettingsWidget::showStoreCheckboxes ( bool  enabled)

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

Definition at line 130 of file qgsauthsettingswidget.cpp.

◆ storePasswordIsChecked()

bool QgsAuthSettingsWidget::storePasswordIsChecked ( ) const

storePassword

Returns
true if "Store" checkbox for the password is checked

Definition at line 154 of file qgsauthsettingswidget.cpp.

◆ storeUsernameIsChecked()

bool QgsAuthSettingsWidget::storeUsernameIsChecked ( ) const

storeUsername

Returns
true if "Store" checkbox for the username is checked

Definition at line 159 of file qgsauthsettingswidget.cpp.

◆ username()

QString QgsAuthSettingsWidget::username ( ) const

username

Returns
basic authentication username

Definition at line 68 of file qgsauthsettingswidget.cpp.

◆ usernameChanged

void QgsAuthSettingsWidget::usernameChanged ( )
signal

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

Since
QGIS 3.22

The documentation for this class was generated from the following files: