/usr/include/qgis/qgsauthsslconfigwidget.h is in libqgis-dev 2.18.17+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | /***************************************************************************
qgsauthsslconfigwidget.h
---------------------
begin : May 17, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSAUTHSSLCONFIGWIDGET_H
#define QGSAUTHSSLCONFIGWIDGET_H
#include <QDialog>
#include <QWidget>
#include "ui_qgsauthsslconfigwidget.h"
#include <QSslCertificate>
#include <QSslConfiguration>
#include "qgsauthconfig.h"
class QComboBox;
class QGroupBox;
class QSpinBox;
/** \ingroup gui
* Widget for editing an SSL server configuration
*/
class GUI_EXPORT QgsAuthSslConfigWidget : public QWidget, private Ui::QgsAuthSslConfigWidget
{
Q_OBJECT
public:
/**
* Construct a widget for editing an SSL server certificate configuration
* @param parent Parent widget
* @param cert SSL server certificate object
* @param hostport Unique host:port to associate with the server certificate
* @param connectionCAs List of trusted Certificate Authorities objects
*/
explicit QgsAuthSslConfigWidget( QWidget *parent = nullptr,
const QSslCertificate &cert = QSslCertificate(),
const QString &hostport = QString(),
const QList<QSslCertificate>& connectionCAs = QList<QSslCertificate>() );
~QgsAuthSslConfigWidget();
/** Access to the certificate's group box widget */
QGroupBox *certificateGroupBox();
/** Access to the SSL configuration's group box widget */
QGroupBox *sslConfigGroupBox();
/** Get the SSL configuration */
const QgsAuthConfigSslServer sslCustomConfig();
/** Get the SSL server certificate */
const QSslCertificate sslCertificate();
/** Get the host:port to associate with the server certificate */
const QString sslHost();
/** Get the SSL protocl used for connections */
QSsl::SslProtocol sslProtocol();
/** Get list of the SSL errors (as enums) to be ignored for connections */
const QList<QSslError::SslError> sslIgnoreErrorEnums();
/** Get the client's peer verify mode for connections */
QSslSocket::PeerVerifyMode sslPeerVerifyMode();
/** Get the client's peer verify depth for connections
* @note Value of 0 = unlimited
*/
int sslPeerVerifyDepth();
public slots:
/** Enable or disable the custom options widget */
void enableSslCustomOptions( bool enable );
// may also load existing config, if found
/** Set SSl certificate and any associated host:port */
void setSslCertificate( const QSslCertificate& cert, const QString &hostport = QString() );
/** Load an existing SSL server configuration */
void loadSslCustomConfig( const QgsAuthConfigSslServer& config = QgsAuthConfigSslServer() );
/** Save the current SSL server configuration to the authentication database */
void saveSslCertConfig();
/** Clear the current SSL server configuration and disabled it */
void resetSslCertConfig();
/** Set the SSL protocol to use in connections */
void setSslProtocol( QSsl::SslProtocol protocol );
/** Reset the SSL protocol to use in connections to the default */
void resetSslProtocol();
/** Add to SSL errors to ignore for the connection */
void appendSslIgnoreErrors( const QList<QSslError>& errors );
/** Set the SSL errors (as enums) to ignore for the connection */
void setSslIgnoreErrorEnums( const QList<QSslError::SslError>& errorenums );
/** Set the SSL errors to ignore for the connection */
void setSslIgnoreErrors( const QList<QSslError>& errors );
/** Clear the SSL errors to ignore for the connection */
void resetSslIgnoreErrors();
/** Set the client's peer verify mode for connections */
void setSslPeerVerify( QSslSocket::PeerVerifyMode mode, int modedepth );
/** Reset the client's peer verify mode for connections to default */
void resetSslPeerVerify();
/** Set the host of the server */
void setSslHost( const QString& host );
/** Set whether the config group box is checkable */
void setConfigCheckable( bool checkable );
/** Parse string for host:port */
void validateHostPortText( const QString &txt );
/** Verify if the configuration if ready to save */
bool readyToSave();
signals:
/** Emitted when the enabled state of the configuration changes */
void configEnabledChanged( bool enabled );
/** Emitted when an certificate of same SHA hash is found in authentication database */
void certFoundInAuthDatabase( bool found );
/** Emitted when the validity of the host:port changes */
void hostPortValidityChanged( bool valid );
/** Emitted when the configuration can be saved changes */
void readyToSaveChanged( bool cansave );
private slots:
void on_btnCertInfo_clicked();
private:
enum ConfigType
{
ConfigParent = 1000,
ConfigItem = 1001,
};
bool validateHostPort( const QString &txt );
void setUpSslConfigTree();
QTreeWidgetItem* addRootItem( const QString& label );
QSslCertificate mCert;
QList<QSslCertificate> mConnectionCAs;
QTreeWidgetItem *mProtocolItem;
QComboBox *mProtocolCmbBx;
QTreeWidgetItem *mIgnoreErrorsItem;
QTreeWidgetItem *mVerifyModeItem;
QComboBox *mVerifyPeerCmbBx;
QTreeWidgetItem *mVerifyDepthItem;
QSpinBox *mVerifyDepthSpnBx;
bool mCanSave;
bool mDisabled;
QVBoxLayout *mAuthNotifyLayout;
QLabel *mAuthNotify;
};
//////////////// Embed in dialog ///////////////////
/** \ingroup gui
* Dialog wrapper of widget for editing an SSL server configuration
*/
class GUI_EXPORT QgsAuthSslConfigDialog : public QDialog
{
Q_OBJECT
public:
/**
* Construct wrapper dialog for the SSL config widget
* @param parent Parent widget
* @param cert SSL server certificate object
* @param hostport Unique host:port to associate with the server certificate
*/
explicit QgsAuthSslConfigDialog( QWidget *parent = nullptr,
const QSslCertificate& cert = QSslCertificate(),
const QString &hostport = QString() );
~QgsAuthSslConfigDialog();
/** Access the embedded SSL server configuration widget */
QgsAuthSslConfigWidget *sslCustomConfigWidget() { return mSslConfigWdgt; }
public slots:
/** Overridden base dialog accept slot */
void accept() override;
private slots:
void checkCanSave( bool cansave );
private:
QgsAuthSslConfigWidget *mSslConfigWdgt;
QPushButton *mSaveButton;
};
#endif // QGSAUTHSSLCONFIGWIDGET_H
|