24     const QString &configId,
    25     const QString &username,
    26     const QString &password,
    27     const QString &dataprovider )
    29   , mDataprovider( dataprovider )
    32   txtPassword->setText( password );
    33   txtUserName->setText( username );
    34   if ( ! dataprovider.isEmpty( ) )
    36     mAuthConfigSelect->setDataProviderKey( dataprovider );
    38   if ( ! configId.isEmpty( ) )
    40     mAuthConfigSelect->setConfigId( configId );
    51   updateConvertBtnState();
    56   lblWarning->setText( warningText );
    61   lblBasic->setText( basicText );
    63   lblBasic->setVisible( ! basicText.isEmpty() );
    68   return txtUserName->text();
    73   txtUserName->setText( username );
    79   return txtPassword->text();
    84   txtPassword->setText( password );
    90   mAuthConfigSelect->setConfigId( configId );
    97   mAuthConfigSelect->setDataProviderKey( dataprovider );
   102   return mDataprovider;
   107   QString out = tr( 
"<div>Warning: credentials stored as plain text in %1.</div>" );
   111       return out.arg( tr( 
"project file" ) );
   113       return out.arg( tr( 
"user settings" ) );
   120   return mAuthConfigSelect->configId();
   125   return btnConvertToEncrypted->isEnabled( );
   132     cbStorePassword->show();
   133     cbStoreUsername->show();
   137     cbStorePassword->hide();
   138     cbStoreUsername->hide();
   144   cbStoreUsername->setChecked( checked );
   149   cbStorePassword->setChecked( checked );
   154   return cbStorePassword->isChecked( );
   159   return cbStoreUsername->isChecked( );
   164   return tabAuth->currentIndex( ) == tabAuth->indexOf( tabConfigurations );
   169   tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
   171   config.
setName( tr( 
"Converted config %1" ).arg( QDateTime::currentDateTime().toString( ) ) );
   172   config.
setConfig( QStringLiteral( 
"username" ), txtUserName->text() );
   173   config.
setConfig( QStringLiteral( 
"password" ), txtPassword->text() );
   176     mAuthConfigSelect->showMessage( tr( 
"Couldn't create a Basic authentication configuration!" ) );
   181     txtUserName->setText( QString( ) );
   182     txtPassword->setText( QString( ) );
   183     mAuthConfigSelect->setConfigId( config.
id( ) );
   191   updateConvertBtnState();
   197   updateConvertBtnState();
   200 void QgsAuthSettingsWidget::updateConvertBtnState()
   202   btnConvertToEncrypted->setEnabled( ! txtUserName->text().isEmpty() || ! txtPassword->text().isEmpty() );
   205 void QgsAuthSettingsWidget::updateSelectedTab()
   207   if ( ! mAuthConfigSelect->configId().isEmpty( ) )
   209     tabAuth->setCurrentIndex( tabAuth->indexOf( tabConfigurations ) );
   211   else if ( !( txtUserName->text( ).isEmpty() && txtPassword->text( ).isEmpty( ) ) )
   213     tabAuth->setCurrentIndex( tabAuth->indexOf( tabBasic ) );
 
void setConfig(const QString &key, const QString &value)
Set a single config value per key in the map. 
 
Configuration storage class for authentication method configurations. 
 
static QgsAuthManager * authManager()
Returns the application's authentication manager instance. 
 
bool storeAuthenticationConfig(QgsAuthMethodConfig &mconfig)
Store an authentication config in the database. 
 
void setName(const QString &name)
Sets name of configuration. 
 
const QString id() const
Gets 'authcfg' 7-character alphanumeric ID of the config.