QGIS API Documentation 3.41.0-Master (57ec4277f5e)
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:
51 explicit QgsAuthSslConfigWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, const QSslCertificate &cert = QSslCertificate(), const QString &hostport = QString(), const QList<QSslCertificate> &connectionCAs = QList<QSslCertificate>() );
52
54 QGroupBox *certificateGroupBox();
56 QGroupBox *sslConfigGroupBox();
57
59 const QgsAuthConfigSslServer sslCustomConfig();
60
62 const QSslCertificate sslCertificate();
63
65 const QString sslHost();
66
68 QSsl::SslProtocol sslProtocol();
69
71 const QList<QSslError::SslError> sslIgnoreErrorEnums();
72
74 QSslSocket::PeerVerifyMode sslPeerVerifyMode();
75
80 int sslPeerVerifyDepth();
81
82 public slots:
84 void enableSslCustomOptions( bool enable );
85
86 // may also load existing config, if found
88 void setSslCertificate( const QSslCertificate &cert, const QString &hostport = QString() );
89
91 void loadSslCustomConfig( const QgsAuthConfigSslServer &config = QgsAuthConfigSslServer() );
92
94 void saveSslCertConfig();
95
97 void resetSslCertConfig();
98
100 void setSslProtocol( QSsl::SslProtocol protocol );
101
103 void resetSslProtocol();
104
106 void appendSslIgnoreErrors( const QList<QSslError> &errors );
107
109 void setSslIgnoreErrorEnums( const QList<QSslError::SslError> &errorenums );
110
112 void setSslIgnoreErrors( const QList<QSslError> &errors );
113
115 void resetSslIgnoreErrors();
116
118 void setSslPeerVerify( QSslSocket::PeerVerifyMode mode, int modedepth );
119
121 void resetSslPeerVerify();
122
124 void setSslHost( const QString &host );
125
127 void setConfigCheckable( bool checkable );
128
130 void validateHostPortText( const QString &txt );
131
133 bool readyToSave();
134
135 signals:
137 void configEnabledChanged( bool enabled );
138
140 void certFoundInAuthDatabase( bool found );
141
143 void hostPortValidityChanged( bool valid );
144
146 void readyToSaveChanged( bool cansave );
147
148 private slots:
149 void btnCertInfo_clicked();
150
151 private:
152 enum ConfigType
153 {
154 ConfigParent = 1000,
155 ConfigItem = 1001,
156 };
157
158 bool validateHostPort( const QString &txt );
159
160 void setUpSslConfigTree();
161 QTreeWidgetItem *addRootItem( const QString &label );
162
163 QSslCertificate mCert;
164 QList<QSslCertificate> mConnectionCAs;
165
166 QTreeWidgetItem *mProtocolItem = nullptr;
167 QComboBox *mProtocolCmbBx = nullptr;
168 QTreeWidgetItem *mIgnoreErrorsItem = nullptr;
169 QTreeWidgetItem *mVerifyModeItem = nullptr;
170 QComboBox *mVerifyPeerCmbBx = nullptr;
171 QTreeWidgetItem *mVerifyDepthItem = nullptr;
172 QSpinBox *mVerifyDepthSpnBx = nullptr;
173
174 bool mCanSave = false;
175
176 bool mDisabled = false;
177 QVBoxLayout *mAuthNotifyLayout = nullptr;
178 QLabel *mAuthNotify = nullptr;
179};
180
182
187class GUI_EXPORT QgsAuthSslConfigDialog : public QDialog
188{
189 Q_OBJECT
190
191 public:
198 explicit QgsAuthSslConfigDialog( QWidget *parent = nullptr, const QSslCertificate &cert = QSslCertificate(), const QString &hostport = QString() );
199
201 QgsAuthSslConfigWidget *sslCustomConfigWidget() { return mSslConfigWdgt; }
202
203 public slots:
204 void accept() override;
205
206 private slots:
207 void checkCanSave( bool cansave );
208
209 private:
210 QgsAuthSslConfigWidget *mSslConfigWdgt = nullptr;
211 QPushButton *mSaveButton = nullptr;
212};
213
214#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