QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
Loading...
Searching...
No Matches
qgsauthsslconfigwidget.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsauthsslconfigwidget.h
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#ifndef QGSAUTHSSLCONFIGWIDGET_H
18#define QGSAUTHSSLCONFIGWIDGET_H
19
20#include <QDialog>
21#include "qgis_sip.h"
22#include <QWidget>
23#include "ui_qgsauthsslconfigwidget.h"
24
25#include <QSslCertificate>
26#include <QSslConfiguration>
27
28#include "qgsauthconfig.h"
29#include "qgis_gui.h"
30
31class QComboBox;
32class QGroupBox;
33class QSpinBox;
34
39class GUI_EXPORT QgsAuthSslConfigWidget : public QWidget, private Ui::QgsAuthSslConfigWidget
40{
41 Q_OBJECT
42
43 public:
44
52 explicit QgsAuthSslConfigWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr,
53 const QSslCertificate &cert = QSslCertificate(),
54 const QString &hostport = QString(),
55 const QList<QSslCertificate> &connectionCAs = QList<QSslCertificate>() );
56
58 QGroupBox *certificateGroupBox();
60 QGroupBox *sslConfigGroupBox();
61
63 const QgsAuthConfigSslServer sslCustomConfig();
64
66 const QSslCertificate sslCertificate();
67
69 const QString sslHost();
70
72 QSsl::SslProtocol sslProtocol();
73
75 const QList<QSslError::SslError> sslIgnoreErrorEnums();
76
78 QSslSocket::PeerVerifyMode sslPeerVerifyMode();
79
84 int sslPeerVerifyDepth();
85
86 public slots:
88 void enableSslCustomOptions( bool enable );
89
90 // may also load existing config, if found
92 void setSslCertificate( const QSslCertificate &cert, const QString &hostport = QString() );
93
95 void loadSslCustomConfig( const QgsAuthConfigSslServer &config = QgsAuthConfigSslServer() );
96
98 void saveSslCertConfig();
99
101 void resetSslCertConfig();
102
104 void setSslProtocol( QSsl::SslProtocol protocol );
105
107 void resetSslProtocol();
108
110 void appendSslIgnoreErrors( const QList<QSslError> &errors );
111
113 void setSslIgnoreErrorEnums( const QList<QSslError::SslError> &errorenums );
114
116 void setSslIgnoreErrors( const QList<QSslError> &errors );
117
119 void resetSslIgnoreErrors();
120
122 void setSslPeerVerify( QSslSocket::PeerVerifyMode mode, int modedepth );
123
125 void resetSslPeerVerify();
126
128 void setSslHost( const QString &host );
129
131 void setConfigCheckable( bool checkable );
132
134 void validateHostPortText( const QString &txt );
135
137 bool readyToSave();
138
139 signals:
141 void configEnabledChanged( bool enabled );
142
144 void certFoundInAuthDatabase( bool found );
145
147 void hostPortValidityChanged( bool valid );
148
150 void readyToSaveChanged( bool cansave );
151
152 private slots:
153 void btnCertInfo_clicked();
154
155 private:
156 enum ConfigType
157 {
158 ConfigParent = 1000,
159 ConfigItem = 1001,
160 };
161
162 bool validateHostPort( const QString &txt );
163
164 void setUpSslConfigTree();
165 QTreeWidgetItem *addRootItem( const QString &label );
166
167 QSslCertificate mCert;
168 QList<QSslCertificate> mConnectionCAs;
169
170 QTreeWidgetItem *mProtocolItem = nullptr;
171 QComboBox *mProtocolCmbBx = nullptr;
172 QTreeWidgetItem *mIgnoreErrorsItem = nullptr;
173 QTreeWidgetItem *mVerifyModeItem = nullptr;
174 QComboBox *mVerifyPeerCmbBx = nullptr;
175 QTreeWidgetItem *mVerifyDepthItem = nullptr;
176 QSpinBox *mVerifyDepthSpnBx = nullptr;
177
178 bool mCanSave = false;
179
180 bool mDisabled = false;
181 QVBoxLayout *mAuthNotifyLayout = nullptr;
182 QLabel *mAuthNotify = nullptr;
183};
184
186
191class GUI_EXPORT QgsAuthSslConfigDialog : public QDialog
192{
193 Q_OBJECT
194
195 public:
196
203 explicit QgsAuthSslConfigDialog( QWidget *parent = nullptr,
204 const QSslCertificate &cert = QSslCertificate(),
205 const QString &hostport = QString() );
206
208 QgsAuthSslConfigWidget *sslCustomConfigWidget() { return mSslConfigWdgt; }
209
210 public slots:
211 void accept() override;
212
213 private slots:
214 void checkCanSave( bool cansave );
215
216 private:
217 QgsAuthSslConfigWidget *mSslConfigWdgt = nullptr;
218 QPushButton *mSaveButton = nullptr;
219};
220
221#endif // QGSAUTHSSLCONFIGWIDGET_H
Configuration container for SSL server connection exceptions or overrides.
Dialog wrapper of widget for editing an SSL server configuration.
QgsAuthSslConfigWidget * sslCustomConfigWidget()
Access the embedded SSL server configuration widget.
Widget for editing an SSL server configuration.
void certFoundInAuthDatabase(bool found)
Emitted when an certificate of same SHA hash is found in authentication database.
void hostPortValidityChanged(bool valid)
Emitted when the validity of the host:port changes.
void readyToSaveChanged(bool cansave)
Emitted when the configuration can be saved changes.
void configEnabledChanged(bool enabled)
Emitted when the enabled state of the configuration changes.
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:53