QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsauthsslconfigwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsauthsslconfigwidget.cpp
3  ---------------------
4  begin : May 17, 2015
5  copyright : (C) 2015 by Boundless Spatial, Inc. USA
6  author : Larry Shaffer
7  email : lshaffer at boundlessgeo dot com
8  ***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #include "qgsauthsslconfigwidget.h"
18 #include "qgsauthcertificateinfo.h"
19 
20 #include <QDialogButtonBox>
21 #include <QPushButton>
22 #include <QSpinBox>
23 #include <QUrl>
24 
25 #include "qgsauthguiutils.h"
26 #include "qgsauthmanager.h"
27 #include "qgslogger.h"
28 #include "qgsapplication.h"
29 
30 
31 static void setItemBold_( QTreeWidgetItem *item )
32 {
33  item->setFirstColumnSpanned( true );
34  QFont secf( item->font( 0 ) );
35  secf.setBold( true );
36  item->setFont( 0, secf );
37 }
38 
39 static const QString configFoundText_() { return QObject::tr( "Configuration loaded from database" ); }
40 static const QString configNotFoundText_() { return QObject::tr( "Configuration not found in database" ); }
41 
43  const QSslCertificate &cert,
44  const QString &hostport,
45  const QList<QSslCertificate> &connectionCAs )
46  : QWidget( parent )
47  , mCert( nullptr )
48  , mConnectionCAs( connectionCAs )
49 {
50  if ( QgsApplication::authManager()->isDisabled() )
51  {
52  mDisabled = true;
53  mAuthNotifyLayout = new QVBoxLayout;
54  this->setLayout( mAuthNotifyLayout );
55  mAuthNotify = new QLabel( QgsApplication::authManager()->disabledMessage(), this );
56  mAuthNotifyLayout->addWidget( mAuthNotify );
57  }
58  else
59  {
60  setupUi( this );
61  connect( btnCertInfo, &QToolButton::clicked, this, &QgsAuthSslConfigWidget::btnCertInfo_clicked );
62 
63  connect( grpbxSslConfig, &QGroupBox::toggled, this, &QgsAuthSslConfigWidget::configEnabledChanged );
66 
67  setUpSslConfigTree();
68 
69  lblLoadedConfig->setVisible( false );
70  lblLoadedConfig->clear();
71 
72  connect( leHost, &QLineEdit::textChanged,
74 
75  if ( !cert.isNull() )
76  {
77  setSslCertificate( cert, hostport );
78  }
79  }
80 }
81 
83 {
84  if ( mDisabled )
85  {
86  return nullptr;
87  }
88  return grpbxCert;
89 }
90 
92 {
93  if ( mDisabled )
94  {
95  return nullptr;
96  }
97  return grpbxSslConfig;
98 }
99 
100 // private
101 QTreeWidgetItem *QgsAuthSslConfigWidget::addRootItem( const QString &label )
102 {
103  QTreeWidgetItem *item = new QTreeWidgetItem(
104  QStringList() << label,
105  static_cast<int>( ConfigParent ) );
106  setItemBold_( item );
107  item->setTextAlignment( 0, Qt::AlignVCenter );
108  item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
109  treeSslConfig->insertTopLevelItem( treeSslConfig->topLevelItemCount(), item );
110 
111  return item;
112 }
113 
114 void QgsAuthSslConfigWidget::setUpSslConfigTree()
115 {
116  treeSslConfig->setColumnCount( 1 );
117 
118  // add config field names
119  mProtocolItem = addRootItem( tr( "Protocol" ) );
120  mProtocolCmbBx = new QComboBox( treeSslConfig );
121  mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::SecureProtocols ),
122  static_cast<int>( QSsl::SecureProtocols ) );
123  mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::TlsV1SslV3 ),
124  static_cast<int>( QSsl::TlsV1SslV3 ) );
125  mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::TlsV1_0 ),
126  static_cast<int>( QSsl::TlsV1_0 ) );
127  mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::SslV3 ),
128  static_cast<int>( QSsl::SslV3 ) );
129  mProtocolCmbBx->addItem( QgsAuthCertUtils::getSslProtocolName( QSsl::SslV2 ),
130  static_cast<int>( QSsl::SslV2 ) );
131  mProtocolCmbBx->setMaximumWidth( 300 );
132  mProtocolCmbBx->setCurrentIndex( 0 );
133  QTreeWidgetItem *protocolitem = new QTreeWidgetItem(
134  mProtocolItem,
135  QStringList() << QString(),
136  static_cast<int>( ConfigItem ) );
137  protocolitem->setFlags( protocolitem->flags() & ~Qt::ItemIsSelectable );
138  treeSslConfig->setItemWidget( protocolitem, 0, mProtocolCmbBx );
139  mProtocolItem->setExpanded( true );
140 
141  mVerifyModeItem = addRootItem( tr( "Peer verification" ) );
142  mVerifyPeerCmbBx = new QComboBox( treeSslConfig );
143  mVerifyPeerCmbBx->addItem( tr( "Verify Peer Certs" ),
144  static_cast<int>( QSslSocket::VerifyPeer ) );
145  mVerifyPeerCmbBx->addItem( tr( "Do Not Verify Peer Certs" ),
146  static_cast<int>( QSslSocket::VerifyNone ) );
147  mVerifyPeerCmbBx->setMaximumWidth( 300 );
148  mVerifyPeerCmbBx->setCurrentIndex( 0 );
149  QTreeWidgetItem *peerverifycmbxitem = new QTreeWidgetItem(
150  mVerifyModeItem,
151  QStringList() << QString(),
152  static_cast<int>( ConfigItem ) );
153  peerverifycmbxitem->setFlags( peerverifycmbxitem->flags() & ~Qt::ItemIsSelectable );
154  treeSslConfig->setItemWidget( peerverifycmbxitem, 0, mVerifyPeerCmbBx );
155  mVerifyModeItem->setExpanded( true );
156 
157  mVerifyDepthItem = addRootItem( tr( "Peer verification depth (0 = complete cert chain)" ) );
158  mVerifyDepthSpnBx = new QSpinBox( treeSslConfig );
159  mVerifyDepthSpnBx->setMinimum( 0 );
160  mVerifyDepthSpnBx->setMaximum( 10 );
161  mVerifyDepthSpnBx->setMaximumWidth( 200 );
162  mVerifyDepthSpnBx->setAlignment( Qt::AlignHCenter );
163  QTreeWidgetItem *peerverifyspnbxitem = new QTreeWidgetItem(
164  mVerifyDepthItem,
165  QStringList() << QString(),
166  static_cast<int>( ConfigItem ) );
167  peerverifyspnbxitem->setFlags( peerverifyspnbxitem->flags() & ~Qt::ItemIsSelectable );
168  treeSslConfig->setItemWidget( peerverifyspnbxitem, 0, mVerifyDepthSpnBx );
169  mVerifyDepthItem->setExpanded( true );
170 
171  mIgnoreErrorsItem = addRootItem( tr( "Ignore errors" ) );
172 
173  QList<QPair<QSslError::SslError, QString> > errenums = QgsAuthCertUtils::sslErrorEnumStrings();
174  for ( int i = 0; i < errenums.size(); i++ )
175  {
176  QTreeWidgetItem *item = new QTreeWidgetItem(
177  mIgnoreErrorsItem,
178  QStringList() << errenums.at( i ).second,
179  static_cast<int>( ConfigItem ) );
180  item->setCheckState( 0, Qt::Unchecked );
181  item->setTextAlignment( 0, Qt::AlignVCenter );
182  item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
183  item->setData( 0, Qt::UserRole, errenums.at( i ).first );
184  }
185  mIgnoreErrorsItem->setExpanded( true );
186 }
187 
189 {
190  QgsAuthConfigSslServer config;
191  if ( mDisabled )
192  {
193  return config;
194  }
195  config.setSslCertificate( mCert );
196  config.setSslHostPort( leHost->text() );
197  config.setSslProtocol( sslProtocol() );
201  return config;
202 }
203 
205 {
206  if ( mDisabled )
207  {
208  return QSslCertificate();
209  }
210  return mCert;
211 }
212 
214 {
215  if ( mDisabled )
216  {
217  return QString();
218  }
219  return leHost->text();
220 }
221 
223 {
224  if ( mDisabled )
225  {
226  return;
227  }
228  if ( grpbxSslConfig->isCheckable() )
229  {
230  grpbxSslConfig->setChecked( enable );
231  }
232 }
233 
234 void QgsAuthSslConfigWidget::setSslCertificate( const QSslCertificate &cert, const QString &hostport )
235 {
236  if ( mDisabled )
237  {
238  return;
239  }
240  if ( cert.isNull() )
241  {
242  return;
243  }
244  mCert = cert;
245 
246  if ( !hostport.isEmpty() )
247  {
248  setSslHost( hostport );
249  }
250 
251  QString sha( QgsAuthCertUtils::shaHexForCert( cert ) );
252  QgsAuthConfigSslServer config(
253  QgsApplication::authManager()->sslCertCustomConfig( sha, hostport.isEmpty() ? sslHost() : hostport ) );
254 
255  emit certFoundInAuthDatabase( !config.isNull() );
256 
257  lblLoadedConfig->setVisible( true );
258  if ( !config.isNull() )
259  {
260  loadSslCustomConfig( config );
261  leCommonName->setStyleSheet( QgsAuthGuiUtils::greenTextStyleSheet() );
262  }
263  else
264  {
265  lblLoadedConfig->setText( configNotFoundText_() );
266  leCommonName->setText( QgsAuthCertUtils::resolvedCertName( mCert ) );
267  leCommonName->setStyleSheet( QgsAuthGuiUtils::orangeTextStyleSheet() );
268  }
269  validateHostPortText( leHost->text() );
270 }
271 
273 {
274  if ( mDisabled )
275  {
276  return;
277  }
279  if ( config.isNull() )
280  {
281  QgsDebugMsg( QStringLiteral( "Passed-in SSL custom config is null" ) );
282  return;
283  }
284 
285  QSslCertificate cert( config.sslCertificate() );
286  if ( cert.isNull() )
287  {
288  QgsDebugMsg( QStringLiteral( "SSL custom config's cert is null" ) );
289  return;
290  }
291 
292  enableSslCustomOptions( true );
293  mCert = cert;
294  leCommonName->setText( QgsAuthCertUtils::resolvedCertName( cert ) );
295  leHost->setText( config.sslHostPort() );
297  setSslProtocol( config.sslProtocol() );
299 
300  lblLoadedConfig->setVisible( true );
301  lblLoadedConfig->setText( configFoundText_() );
302 }
303 
305 {
306  if ( mDisabled )
307  {
308  return;
309  }
310  if ( !QgsApplication::authManager()->storeSslCertCustomConfig( sslCustomConfig() ) )
311  {
312  QgsDebugMsg( QStringLiteral( "SSL custom config FAILED to store in authentication database" ) );
313  }
314 }
315 
317 {
318  if ( mDisabled )
319  {
320  return;
321  }
322  mCert.clear();
323  mConnectionCAs.clear();
324  leCommonName->clear();
325  leCommonName->setStyleSheet( QString() );
326  leHost->clear();
327 
328  lblLoadedConfig->setVisible( false );
329  lblLoadedConfig->clear();
333  enableSslCustomOptions( false );
334 }
335 
337 {
338  if ( mDisabled )
339  {
340  return QSsl::UnknownProtocol;
341  }
342  return ( QSsl::SslProtocol )mProtocolCmbBx->currentData().toInt();
343 }
344 
345 void QgsAuthSslConfigWidget::setSslProtocol( QSsl::SslProtocol protocol )
346 {
347  if ( mDisabled )
348  {
349  return;
350  }
351  int indx( mProtocolCmbBx->findData( static_cast<int>( protocol ) ) );
352  mProtocolCmbBx->setCurrentIndex( indx );
353 }
354 
356 {
357  if ( mDisabled )
358  {
359  return;
360  }
361  mProtocolCmbBx->setCurrentIndex( 0 );
362 }
363 
364 void QgsAuthSslConfigWidget::appendSslIgnoreErrors( const QList<QSslError> &errors )
365 {
366  if ( mDisabled )
367  {
368  return;
369  }
370  enableSslCustomOptions( true );
371 
372  QList<QSslError::SslError> errenums;
373  const auto constErrors = errors;
374  for ( const QSslError &err : constErrors )
375  {
376  errenums << err.error();
377  }
378 
379  for ( int i = 0; i < mIgnoreErrorsItem->childCount(); i++ )
380  {
381  QTreeWidgetItem *item( mIgnoreErrorsItem->child( i ) );
382  if ( errenums.contains( ( QSslError::SslError )item->data( 0, Qt::UserRole ).toInt() ) )
383  {
384  item->setCheckState( 0, Qt::Checked );
385  }
386  }
387 }
388 
389 void QgsAuthSslConfigWidget::setSslIgnoreErrorEnums( const QList<QSslError::SslError> &errorenums )
390 {
391  if ( mDisabled )
392  {
393  return;
394  }
395  QList<QSslError> errors;
396  const auto constErrorenums = errorenums;
397  for ( QSslError::SslError errorenum : constErrorenums )
398  {
399  errors << QSslError( errorenum );
400  }
401  setSslIgnoreErrors( errors );
402 }
403 
404 void QgsAuthSslConfigWidget::setSslIgnoreErrors( const QList<QSslError> &errors )
405 {
406  if ( mDisabled )
407  {
408  return;
409  }
410  if ( errors.isEmpty() )
411  {
412  return;
413  }
414 
415  enableSslCustomOptions( true );
416 
417  QList<QSslError::SslError> errenums;
418  const auto constErrors = errors;
419  for ( const QSslError &err : constErrors )
420  {
421  errenums << err.error();
422  }
423 
424  for ( int i = 0; i < mIgnoreErrorsItem->childCount(); i++ )
425  {
426  QTreeWidgetItem *item( mIgnoreErrorsItem->child( i ) );
427  bool enable( errenums.contains( ( QSslError::SslError )item->data( 0, Qt::UserRole ).toInt() ) );
428  item->setCheckState( 0, enable ? Qt::Checked : Qt::Unchecked );
429  }
430 }
431 
433 {
434  if ( mDisabled )
435  {
436  return;
437  }
438  for ( int i = 0; i < mIgnoreErrorsItem->childCount(); i++ )
439  {
440  mIgnoreErrorsItem->child( i )->setCheckState( 0, Qt::Unchecked );
441  }
442 }
443 
444 const QList<QSslError::SslError> QgsAuthSslConfigWidget::sslIgnoreErrorEnums()
445 {
446  QList<QSslError::SslError> errs;
447  if ( mDisabled )
448  {
449  return errs;
450  }
451  for ( int i = 0; i < mIgnoreErrorsItem->childCount(); i++ )
452  {
453  QTreeWidgetItem *item( mIgnoreErrorsItem->child( i ) );
454  if ( item->checkState( 0 ) == Qt::Checked )
455  {
456  errs.append( ( QSslError::SslError )item->data( 0, Qt::UserRole ).toInt() );
457  }
458  }
459  return errs;
460 }
461 
462 QSslSocket::PeerVerifyMode QgsAuthSslConfigWidget::sslPeerVerifyMode()
463 {
464  if ( mDisabled )
465  {
466  return QSslSocket::AutoVerifyPeer;
467  }
468  return ( QSslSocket::PeerVerifyMode )mVerifyPeerCmbBx->currentData().toInt();
469 }
470 
472 {
473  if ( mDisabled )
474  {
475  return 0;
476  }
477  return mVerifyDepthSpnBx->value();
478 }
479 
480 void QgsAuthSslConfigWidget::setSslPeerVerify( QSslSocket::PeerVerifyMode mode, int modedepth )
481 {
482  if ( mDisabled )
483  {
484  return;
485  }
486  enableSslCustomOptions( true );
487 
488  int indx( mVerifyPeerCmbBx->findData( static_cast<int>( mode ) ) );
489  mVerifyPeerCmbBx->setCurrentIndex( indx );
490 
491  mVerifyDepthSpnBx->setValue( modedepth );
492 }
493 
495 {
496  if ( mDisabled )
497  {
498  return;
499  }
500  mVerifyPeerCmbBx->setCurrentIndex( 0 );
501  mVerifyDepthSpnBx->setValue( 0 );
502 }
503 
505 {
506  if ( mDisabled )
507  {
508  return false;
509  }
510  bool cansave = ( isEnabled()
511  && ( grpbxSslConfig->isCheckable() ? grpbxSslConfig->isChecked() : true )
512  && validateHostPort( leHost->text() ) );
513  if ( mCanSave != cansave )
514  {
515  mCanSave = cansave;
516  emit readyToSaveChanged( cansave );
517  }
518  return cansave;
519 }
520 
521 void QgsAuthSslConfigWidget::setSslHost( const QString &host )
522 {
523  if ( mDisabled )
524  {
525  return;
526  }
527  leHost->setText( host );
528 }
529 
530 bool QgsAuthSslConfigWidget::validateHostPort( const QString &txt )
531 {
532  QString hostport( txt );
533  if ( hostport.isEmpty() )
534  {
535  return false;
536  }
537 
538  // TODO: add QRegex checks against valid IP and domain.tld input
539  // i.e., currently accepts unlikely (though maybe valid) host:port combo, like 'a:1'
540  QString urlbase( QStringLiteral( "https://%1" ).arg( hostport ) );
541  QUrl url( urlbase );
542  return ( !url.host().isEmpty() && QString::number( url.port() ).size() > 0
543  && QStringLiteral( "https://%1:%2" ).arg( url.host() ).arg( url.port() ) == urlbase );
544 }
545 
547 {
548  if ( mDisabled )
549  {
550  return;
551  }
552  bool valid = validateHostPort( txt );
553  leHost->setStyleSheet( valid ? QgsAuthGuiUtils::greenTextStyleSheet()
555  emit hostPortValidityChanged( valid );
556 }
557 
559 {
560  if ( mDisabled )
561  {
562  return;
563  }
564  grpbxSslConfig->setCheckable( checkable );
565  if ( !checkable )
566  {
567  grpbxSslConfig->setEnabled( true );
568  }
569 }
570 
571 void QgsAuthSslConfigWidget::btnCertInfo_clicked()
572 {
573  if ( mCert.isNull() )
574  {
575  return;
576  }
577 
578  QgsAuthCertInfoDialog *dlg = new QgsAuthCertInfoDialog( mCert, false, this, mConnectionCAs );
579  dlg->setWindowModality( Qt::WindowModal );
580  dlg->resize( 675, 500 );
581  dlg->exec();
582  dlg->deleteLater();
583 }
584 
585 
587 
588 QgsAuthSslConfigDialog::QgsAuthSslConfigDialog( QWidget *parent, const QSslCertificate &cert, const QString &hostport )
589  : QDialog( parent )
590 
591 {
592  setWindowTitle( tr( "Custom Certificate Configuration" ) );
593  QVBoxLayout *layout = new QVBoxLayout( this );
594  layout->setMargin( 6 );
595 
596  mSslConfigWdgt = new QgsAuthSslConfigWidget( this, cert, hostport );
597  connect( mSslConfigWdgt, &QgsAuthSslConfigWidget::readyToSaveChanged,
598  this, &QgsAuthSslConfigDialog::checkCanSave );
599  layout->addWidget( mSslConfigWdgt );
600 
601  QDialogButtonBox *buttonBox = new QDialogButtonBox(
602  QDialogButtonBox::Close | QDialogButtonBox::Save, Qt::Horizontal, this );
603 
604  buttonBox->button( QDialogButtonBox::Close )->setDefault( true );
605  mSaveButton = buttonBox->button( QDialogButtonBox::Save );
606  connect( buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close );
607  connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsAuthSslConfigDialog::accept );
608  layout->addWidget( buttonBox );
609 
610  setLayout( layout );
611  mSaveButton->setEnabled( mSslConfigWdgt->readyToSave() );
612 }
613 
615 {
616  mSslConfigWdgt->saveSslCertConfig();
617  QDialog::accept();
618 }
619 
620 void QgsAuthSslConfigDialog::checkCanSave( bool cansave )
621 {
622  mSaveButton->setEnabled( cansave );
623 }
QgsAuthSslConfigDialog::accept
void accept() override
Definition: qgsauthsslconfigwidget.cpp:614
QgsAuthConfigSslServer::setSslHostPort
void setSslHostPort(const QString &hostport)
Sets server host:port string.
Definition: qgsauthconfig.h:385
QgsAuthSslConfigWidget::validateHostPortText
void validateHostPortText(const QString &txt)
Parse string for host:port.
Definition: qgsauthsslconfigwidget.cpp:546
QgsAuthSslConfigWidget::readyToSave
bool readyToSave()
Verify if the configuration if ready to save.
Definition: qgsauthsslconfigwidget.cpp:504
QgsAuthConfigSslServer::sslHostPort
const QString sslHostPort() const
Server host:port string.
Definition: qgsauthconfig.h:383
QgsAuthSslConfigWidget
Definition: qgsauthsslconfigwidget.h:39
QgsAuthSslConfigWidget::setSslCertificate
void setSslCertificate(const QSslCertificate &cert, const QString &hostport=QString())
Sets SSl certificate and any associated host:port.
Definition: qgsauthsslconfigwidget.cpp:234
QgsAuthSslConfigWidget::sslHost
const QString sslHost()
Gets the host:port to associate with the server certificate.
Definition: qgsauthsslconfigwidget.cpp:213
QgsAuthGuiUtils::orangeTextStyleSheet
static QString orangeTextStyleSheet(const QString &selector="*")
Orange text stylesheet representing loaded component, but not stored in database.
Definition: qgsauthguiutils.cpp:56
QgsAuthSslConfigWidget::setSslIgnoreErrors
void setSslIgnoreErrors(const QList< QSslError > &errors)
Sets the SSL errors to ignore for the connection.
Definition: qgsauthsslconfigwidget.cpp:404
qgsauthmanager.h
QgsAuthSslConfigWidget::resetSslIgnoreErrors
void resetSslIgnoreErrors()
Clear the SSL errors to ignore for the connection.
Definition: qgsauthsslconfigwidget.cpp:432
QgsAuthConfigSslServer::setSslPeerVerifyMode
void setSslPeerVerifyMode(QSslSocket::PeerVerifyMode mode)
Sets SSL client's peer verify mode to use in connections.
Definition: qgsauthconfig.h:402
QgsAuthSslConfigWidget::loadSslCustomConfig
void loadSslCustomConfig(const QgsAuthConfigSslServer &config=QgsAuthConfigSslServer())
Load an existing SSL server configuration.
Definition: qgsauthsslconfigwidget.cpp:272
QgsAuthSslConfigWidget::setConfigCheckable
void setConfigCheckable(bool checkable)
Sets whether the config group box is checkable.
Definition: qgsauthsslconfigwidget.cpp:558
QgsAuthConfigSslServer::setSslPeerVerifyDepth
void setSslPeerVerifyDepth(int depth)
Set number or SSL client's peer to verify in connections.
Definition: qgsauthconfig.h:414
QgsAuthSslConfigWidget::setSslPeerVerify
void setSslPeerVerify(QSslSocket::PeerVerifyMode mode, int modedepth)
Sets the client's peer verify mode for connections.
Definition: qgsauthsslconfigwidget.cpp:480
QgsAuthGuiUtils::greenTextStyleSheet
static QString greenTextStyleSheet(const QString &selector="*")
Green text stylesheet representing valid, trusted, etc. certificate.
Definition: qgsauthguiutils.cpp:51
QgsAuthSslConfigWidget::setSslHost
void setSslHost(const QString &host)
Sets the host of the server.
Definition: qgsauthsslconfigwidget.cpp:521
QgsAuthSslConfigDialog::QgsAuthSslConfigDialog
QgsAuthSslConfigDialog(QWidget *parent=nullptr, const QSslCertificate &cert=QSslCertificate(), const QString &hostport=QString())
Construct wrapper dialog for the SSL config widget.
Definition: qgsauthsslconfigwidget.cpp:588
QgsDebugMsg
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
QgsAuthCertUtils::getSslProtocolName
static QString getSslProtocolName(QSsl::SslProtocol protocol)
SSL Protocol name strings per enum.
Definition: qgsauthcertutils.cpp:36
QgsAuthConfigSslServer::setSslCertificate
void setSslCertificate(const QSslCertificate &cert)
Sets server certificate object.
Definition: qgsauthconfig.h:380
qgsauthguiutils.h
QgsAuthSslConfigWidget::hostPortValidityChanged
void hostPortValidityChanged(bool valid)
Emitted when the validity of the host:port changes.
QgsAuthSslConfigWidget::saveSslCertConfig
void saveSslCertConfig()
Save the current SSL server configuration to the authentication database.
Definition: qgsauthsslconfigwidget.cpp:304
QgsAuthCertUtils::shaHexForCert
static QString shaHexForCert(const QSslCertificate &cert, bool formatted=false)
Gets the sha1 hash for certificate.
Definition: qgsauthcertutils.cpp:743
QgsApplication::authManager
static QgsAuthManager * authManager()
Returns the application's authentication manager instance.
Definition: qgsapplication.cpp:1263
qgsapplication.h
QgsAuthSslConfigWidget::sslPeerVerifyMode
QSslSocket::PeerVerifyMode sslPeerVerifyMode()
Gets the client's peer verify mode for connections.
Definition: qgsauthsslconfigwidget.cpp:462
QgsAuthConfigSslServer::sslIgnoredErrorEnums
const QList< QSslError::SslError > sslIgnoredErrorEnums() const
SSL server errors (as enum list) to ignore in connections.
Definition: qgsauthconfig.h:395
QgsAuthSslConfigWidget::sslCertificate
const QSslCertificate sslCertificate()
Gets the SSL server certificate.
Definition: qgsauthsslconfigwidget.cpp:204
QgsAuthSslConfigWidget::sslProtocol
QSsl::SslProtocol sslProtocol()
Gets the SSL protocol used for connections.
Definition: qgsauthsslconfigwidget.cpp:336
QgsAuthSslConfigWidget::readyToSaveChanged
void readyToSaveChanged(bool cansave)
Emitted when the configuration can be saved changes.
QgsAuthConfigSslServer::sslPeerVerifyDepth
int sslPeerVerifyDepth() const
Number or SSL client's peer to verify in connections.
Definition: qgsauthconfig.h:408
QgsAuthGuiUtils::redTextStyleSheet
static QString redTextStyleSheet(const QString &selector="*")
Red text stylesheet representing invalid, untrusted, etc. certificate.
Definition: qgsauthguiutils.cpp:61
QgsAuthCertUtils::sslErrorEnumStrings
static QList< QPair< QSslError::SslError, QString > > sslErrorEnumStrings()
Gets short strings describing SSL errors.
Definition: qgsauthcertutils.cpp:1214
QgsAuthConfigSslServer::setSslProtocol
void setSslProtocol(QSsl::SslProtocol protocol)
Sets SSL server protocol to use in connections.
Definition: qgsauthconfig.h:390
QgsAuthSslConfigWidget::resetSslProtocol
void resetSslProtocol()
Reset the SSL protocol to use in connections to the default.
Definition: qgsauthsslconfigwidget.cpp:355
QgsAuthSslConfigWidget::sslConfigGroupBox
QGroupBox * sslConfigGroupBox()
Access to the SSL configuration's group box widget.
Definition: qgsauthsslconfigwidget.cpp:91
QgsAuthSslConfigWidget::sslIgnoreErrorEnums
const QList< QSslError::SslError > sslIgnoreErrorEnums()
Gets list of the SSL errors (as enums) to be ignored for connections.
Definition: qgsauthsslconfigwidget.cpp:444
QgsAuthCertInfoDialog
Definition: qgsauthcertificateinfo.h:145
QgsAuthCertUtils::resolvedCertName
static QString resolvedCertName(const QSslCertificate &cert, bool issuer=false)
Gets the general name via RFC 5280 resolution.
Definition: qgsauthcertutils.cpp:620
QgsAuthConfigSslServer::setSslIgnoredErrorEnums
void setSslIgnoredErrorEnums(const QList< QSslError::SslError > &errors)
Sets SSL server errors (as enum list) to ignore in connections.
Definition: qgsauthconfig.h:397
QgsAuthSslConfigWidget::sslCustomConfig
const QgsAuthConfigSslServer sslCustomConfig()
Gets the SSL configuration.
Definition: qgsauthsslconfigwidget.cpp:188
qgsauthcertificateinfo.h
QgsAuthSslConfigWidget::certFoundInAuthDatabase
void certFoundInAuthDatabase(bool found)
Emitted when an certificate of same SHA hash is found in authentication database.
QgsAuthSslConfigWidget::setSslProtocol
void setSslProtocol(QSsl::SslProtocol protocol)
Sets the SSL protocol to use in connections.
Definition: qgsauthsslconfigwidget.cpp:345
QgsAuthConfigSslServer::isNull
bool isNull() const
Whether configuration is null (missing components)
Definition: qgsauthconfig.cpp:386
QgsAuthSslConfigWidget::sslPeerVerifyDepth
int sslPeerVerifyDepth()
Gets the client's peer verify depth for connections.
Definition: qgsauthsslconfigwidget.cpp:471
QgsAuthConfigSslServer::sslPeerVerifyMode
QSslSocket::PeerVerifyMode sslPeerVerifyMode() const
SSL client's peer verify mode to use in connections.
Definition: qgsauthconfig.h:400
QgsAuthConfigSslServer
Configuration container for SSL server connection exceptions or overrides.
Definition: qgsauthconfig.h:371
QgsAuthSslConfigWidget::enableSslCustomOptions
void enableSslCustomOptions(bool enable)
Enable or disable the custom options widget.
Definition: qgsauthsslconfigwidget.cpp:222
QgsAuthSslConfigWidget::resetSslCertConfig
void resetSslCertConfig()
Clear the current SSL server configuration and disabled it.
Definition: qgsauthsslconfigwidget.cpp:316
qgsauthsslconfigwidget.h
QgsAuthConfigSslServer::sslProtocol
QSsl::SslProtocol sslProtocol() const
SSL server protocol to use in connections.
Definition: qgsauthconfig.h:388
QgsAuthSslConfigWidget::certificateGroupBox
QGroupBox * certificateGroupBox()
Access to the certificate's group box widget.
Definition: qgsauthsslconfigwidget.cpp:82
qgslogger.h
QgsAuthSslConfigWidget::appendSslIgnoreErrors
void appendSslIgnoreErrors(const QList< QSslError > &errors)
Add to SSL errors to ignore for the connection.
Definition: qgsauthsslconfigwidget.cpp:364
QgsAuthSslConfigWidget::resetSslPeerVerify
void resetSslPeerVerify()
Reset the client's peer verify mode for connections to default.
Definition: qgsauthsslconfigwidget.cpp:494
QgsAuthSslConfigWidget::configEnabledChanged
void configEnabledChanged(bool enabled)
Emitted when the enabled state of the configuration changes.
QgsAuthSslConfigWidget::QgsAuthSslConfigWidget
QgsAuthSslConfigWidget(QWidget *parent=nullptr, const QSslCertificate &cert=QSslCertificate(), const QString &hostport=QString(), const QList< QSslCertificate > &connectionCAs=QList< QSslCertificate >())
Construct a widget for editing an SSL server certificate configuration.
Definition: qgsauthsslconfigwidget.cpp:42
QgsAuthConfigSslServer::sslCertificate
const QSslCertificate sslCertificate() const
Server certificate object.
Definition: qgsauthconfig.h:378
QgsAuthSslConfigWidget::setSslIgnoreErrorEnums
void setSslIgnoreErrorEnums(const QList< QSslError::SslError > &errorenums)
Sets the SSL errors (as enums) to ignore for the connection.
Definition: qgsauthsslconfigwidget.cpp:389