QGIS API Documentation  3.4.15-Madeira (e83d02e274)
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 ),
126  static_cast<int>( QSsl::TlsV1 ) );
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  Q_FOREACH ( const QSslError &err, errors )
374  {
375  errenums << err.error();
376  }
377 
378  for ( int i = 0; i < mIgnoreErrorsItem->childCount(); i++ )
379  {
380  QTreeWidgetItem *item( mIgnoreErrorsItem->child( i ) );
381  if ( errenums.contains( ( QSslError::SslError )item->data( 0, Qt::UserRole ).toInt() ) )
382  {
383  item->setCheckState( 0, Qt::Checked );
384  }
385  }
386 }
387 
388 void QgsAuthSslConfigWidget::setSslIgnoreErrorEnums( const QList<QSslError::SslError> &errorenums )
389 {
390  if ( mDisabled )
391  {
392  return;
393  }
394  QList<QSslError> errors;
395  Q_FOREACH ( QSslError::SslError errorenum, errorenums )
396  {
397  errors << QSslError( errorenum );
398  }
399  setSslIgnoreErrors( errors );
400 }
401 
402 void QgsAuthSslConfigWidget::setSslIgnoreErrors( const QList<QSslError> &errors )
403 {
404  if ( mDisabled )
405  {
406  return;
407  }
408  if ( errors.isEmpty() )
409  {
410  return;
411  }
412 
413  enableSslCustomOptions( true );
414 
415  QList<QSslError::SslError> errenums;
416  Q_FOREACH ( const QSslError &err, errors )
417  {
418  errenums << err.error();
419  }
420 
421  for ( int i = 0; i < mIgnoreErrorsItem->childCount(); i++ )
422  {
423  QTreeWidgetItem *item( mIgnoreErrorsItem->child( i ) );
424  bool enable( errenums.contains( ( QSslError::SslError )item->data( 0, Qt::UserRole ).toInt() ) );
425  item->setCheckState( 0, enable ? Qt::Checked : Qt::Unchecked );
426  }
427 }
428 
430 {
431  if ( mDisabled )
432  {
433  return;
434  }
435  for ( int i = 0; i < mIgnoreErrorsItem->childCount(); i++ )
436  {
437  mIgnoreErrorsItem->child( i )->setCheckState( 0, Qt::Unchecked );
438  }
439 }
440 
441 const QList<QSslError::SslError> QgsAuthSslConfigWidget::sslIgnoreErrorEnums()
442 {
443  QList<QSslError::SslError> errs;
444  if ( mDisabled )
445  {
446  return errs;
447  }
448  for ( int i = 0; i < mIgnoreErrorsItem->childCount(); i++ )
449  {
450  QTreeWidgetItem *item( mIgnoreErrorsItem->child( i ) );
451  if ( item->checkState( 0 ) == Qt::Checked )
452  {
453  errs.append( ( QSslError::SslError )item->data( 0, Qt::UserRole ).toInt() );
454  }
455  }
456  return errs;
457 }
458 
459 QSslSocket::PeerVerifyMode QgsAuthSslConfigWidget::sslPeerVerifyMode()
460 {
461  if ( mDisabled )
462  {
463  return QSslSocket::AutoVerifyPeer;
464  }
465  return ( QSslSocket::PeerVerifyMode )mVerifyPeerCmbBx->currentData().toInt();
466 }
467 
469 {
470  if ( mDisabled )
471  {
472  return 0;
473  }
474  return mVerifyDepthSpnBx->value();
475 }
476 
477 void QgsAuthSslConfigWidget::setSslPeerVerify( QSslSocket::PeerVerifyMode mode, int modedepth )
478 {
479  if ( mDisabled )
480  {
481  return;
482  }
483  enableSslCustomOptions( true );
484 
485  int indx( mVerifyPeerCmbBx->findData( static_cast<int>( mode ) ) );
486  mVerifyPeerCmbBx->setCurrentIndex( indx );
487 
488  mVerifyDepthSpnBx->setValue( modedepth );
489 }
490 
492 {
493  if ( mDisabled )
494  {
495  return;
496  }
497  mVerifyPeerCmbBx->setCurrentIndex( 0 );
498  mVerifyDepthSpnBx->setValue( 0 );
499 }
500 
502 {
503  if ( mDisabled )
504  {
505  return false;
506  }
507  bool cansave = ( isEnabled()
508  && ( grpbxSslConfig->isCheckable() ? grpbxSslConfig->isChecked() : true )
509  && validateHostPort( leHost->text() ) );
510  if ( mCanSave != cansave )
511  {
512  mCanSave = cansave;
513  emit readyToSaveChanged( cansave );
514  }
515  return cansave;
516 }
517 
518 void QgsAuthSslConfigWidget::setSslHost( const QString &host )
519 {
520  if ( mDisabled )
521  {
522  return;
523  }
524  leHost->setText( host );
525 }
526 
527 bool QgsAuthSslConfigWidget::validateHostPort( const QString &txt )
528 {
529  QString hostport( txt );
530  if ( hostport.isEmpty() )
531  {
532  return false;
533  }
534 
535  // TODO: add QRegex checks against valid IP and domain.tld input
536  // i.e., currently accepts unlikely (though maybe valid) host:port combo, like 'a:1'
537  QString urlbase( QStringLiteral( "https://%1" ).arg( hostport ) );
538  QUrl url( urlbase );
539  return ( !url.host().isEmpty() && QString::number( url.port() ).size() > 0
540  && QStringLiteral( "https://%1:%2" ).arg( url.host() ).arg( url.port() ) == urlbase );
541 }
542 
544 {
545  if ( mDisabled )
546  {
547  return;
548  }
549  bool valid = validateHostPort( txt );
550  leHost->setStyleSheet( valid ? QgsAuthGuiUtils::greenTextStyleSheet()
552  emit hostPortValidityChanged( valid );
553 }
554 
556 {
557  if ( mDisabled )
558  {
559  return;
560  }
561  grpbxSslConfig->setCheckable( checkable );
562  if ( !checkable )
563  {
564  grpbxSslConfig->setEnabled( true );
565  }
566 }
567 
568 void QgsAuthSslConfigWidget::btnCertInfo_clicked()
569 {
570  if ( mCert.isNull() )
571  {
572  return;
573  }
574 
575  QgsAuthCertInfoDialog *dlg = new QgsAuthCertInfoDialog( mCert, false, this, mConnectionCAs );
576  dlg->setWindowModality( Qt::WindowModal );
577  dlg->resize( 675, 500 );
578  dlg->exec();
579  dlg->deleteLater();
580 }
581 
582 
584 
585 QgsAuthSslConfigDialog::QgsAuthSslConfigDialog( QWidget *parent, const QSslCertificate &cert, const QString &hostport )
586  : QDialog( parent )
587 
588 {
589  setWindowTitle( tr( "Custom Certificate Configuration" ) );
590  QVBoxLayout *layout = new QVBoxLayout( this );
591  layout->setMargin( 6 );
592 
593  mSslConfigWdgt = new QgsAuthSslConfigWidget( this, cert, hostport );
594  connect( mSslConfigWdgt, &QgsAuthSslConfigWidget::readyToSaveChanged,
595  this, &QgsAuthSslConfigDialog::checkCanSave );
596  layout->addWidget( mSslConfigWdgt );
597 
598  QDialogButtonBox *buttonBox = new QDialogButtonBox(
599  QDialogButtonBox::Close | QDialogButtonBox::Save, Qt::Horizontal, this );
600 
601  buttonBox->button( QDialogButtonBox::Close )->setDefault( true );
602  mSaveButton = buttonBox->button( QDialogButtonBox::Save );
603  connect( buttonBox, &QDialogButtonBox::rejected, this, &QWidget::close );
604  connect( buttonBox, &QDialogButtonBox::accepted, this, &QgsAuthSslConfigDialog::accept );
605  layout->addWidget( buttonBox );
606 
607  setLayout( layout );
608  mSaveButton->setEnabled( mSslConfigWdgt->readyToSave() );
609 }
610 
612 {
613  mSslConfigWdgt->saveSslCertConfig();
614  QDialog::accept();
615 }
616 
617 void QgsAuthSslConfigDialog::checkCanSave( bool cansave )
618 {
619  mSaveButton->setEnabled( cansave );
620 }
void resetSslProtocol()
Reset the SSL protocol to use in connections to the default.
QSsl::SslProtocol sslProtocol()
Gets the SSL protocol used for connections.
#define QgsDebugMsg(str)
Definition: qgslogger.h:38
QGroupBox * sslConfigGroupBox()
Access to the SSL configuration&#39;s group box widget.
bool isNull() const
Whether configuration is null (missing components)
Configuration container for SSL server connection exceptions or overrides.
void enableSslCustomOptions(bool enable)
Enable or disable the custom options widget.
void resetSslCertConfig()
Clear the current SSL server configuration and disabled it.
QGroupBox * certificateGroupBox()
Access to the certificate&#39;s group box widget.
int sslPeerVerifyDepth()
Gets the client&#39;s peer verify depth for connections.
void setSslPeerVerifyMode(QSslSocket::PeerVerifyMode mode)
Sets SSL client&#39;s peer verify mode to use in connections.
void resetSslPeerVerify()
Reset the client&#39;s peer verify mode for connections to default.
void certFoundInAuthDatabase(bool found)
Emitted when an certificate of same SHA hash is found in authentication database. ...
void setSslProtocol(QSsl::SslProtocol protocol)
Sets the SSL protocol to use in connections.
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.
Dialog wrapper for widget displaying detailed info on a certificate and its hierarchical trust chain...
static QString greenTextStyleSheet(const QString &selector="*")
Green text stylesheet representing valid, trusted, etc. certificate.
QSslSocket::PeerVerifyMode sslPeerVerifyMode() const
SSL client&#39;s peer verify mode to use in connections.
void validateHostPortText(const QString &txt)
Parse string for host:port.
QSsl::SslProtocol sslProtocol() const
SSL server protocol to use in connections.
void configEnabledChanged(bool enabled)
Emitted when the enabled state of the configuration changes.
const QString sslHost()
Gets the host:port to associate with the server certificate.
QgsAuthSslConfigDialog(QWidget *parent=nullptr, const QSslCertificate &cert=QSslCertificate(), const QString &hostport=QString())
Construct wrapper dialog for the SSL config widget.
void setSslIgnoreErrors(const QList< QSslError > &errors)
Sets the SSL errors to ignore for the connection.
Widget for editing an SSL server configuration.
void appendSslIgnoreErrors(const QList< QSslError > &errors)
Add to SSL errors to ignore for the connection.
void setSslCertificate(const QSslCertificate &cert, const QString &hostport=QString())
Sets SSl certificate and any associated host:port.
const QSslCertificate sslCertificate() const
Server certificate object.
void setSslHostPort(const QString &hostport)
Sets server host:port string.
void setSslIgnoreErrorEnums(const QList< QSslError::SslError > &errorenums)
Sets the SSL errors (as enums) to ignore for the connection.
void setConfigCheckable(bool checkable)
Sets whether the config group box is checkable.
static QString getSslProtocolName(QSsl::SslProtocol protocol)
SSL Protocol name strings per enum.
void setSslPeerVerify(QSslSocket::PeerVerifyMode mode, int modedepth)
Sets the client&#39;s peer verify mode for connections.
void setSslProtocol(QSsl::SslProtocol protocol)
Sets SSL server protocol to use in connections.
static QString shaHexForCert(const QSslCertificate &cert, bool formatted=false)
Gets the sha1 hash for certificate.
static QgsAuthManager * authManager()
Returns the application&#39;s authentication manager instance.
void hostPortValidityChanged(bool valid)
Emitted when the validity of the host:port changes.
void resetSslIgnoreErrors()
Clear the SSL errors to ignore for the connection.
static QString redTextStyleSheet(const QString &selector="*")
Red text stylesheet representing invalid, untrusted, etc. certificate.
bool readyToSave()
Verify if the configuration if ready to save.
void loadSslCustomConfig(const QgsAuthConfigSslServer &config=QgsAuthConfigSslServer())
Load an existing SSL server configuration.
int sslPeerVerifyDepth() const
Number or SSL client&#39;s peer to verify in connections.
void setSslIgnoredErrorEnums(const QList< QSslError::SslError > &errors)
Sets SSL server errors (as enum list) to ignore in connections.
void setSslHost(const QString &host)
Sets the host of the server.
const QSslCertificate sslCertificate()
Gets the SSL server certificate.
void readyToSaveChanged(bool cansave)
Emitted when the configuration can be saved changes.
QSslSocket::PeerVerifyMode sslPeerVerifyMode()
Gets the client&#39;s peer verify mode for connections.
void setSslPeerVerifyDepth(int depth)
Set number or SSL client&#39;s peer to verify in connections.
void saveSslCertConfig()
Save the current SSL server configuration to the authentication database.
const QString sslHostPort() const
Server host:port string.
static QList< QPair< QSslError::SslError, QString > > sslErrorEnumStrings()
Gets short strings describing SSL errors.
void setSslCertificate(const QSslCertificate &cert)
Sets server certificate object.
static QString resolvedCertName(const QSslCertificate &cert, bool issuer=false)
Gets the general name via RFC 5280 resolution.
const QgsAuthConfigSslServer sslCustomConfig()
Gets the SSL configuration.
static QString orangeTextStyleSheet(const QString &selector="*")
Orange text stylesheet representing loaded component, but not stored in database. ...
const QList< QSslError::SslError > sslIgnoreErrorEnums()
Gets list of the SSL errors (as enums) to be ignored for connections.
const QList< QSslError::SslError > sslIgnoredErrorEnums() const
SSL server errors (as enum list) to ignore in connections.