17#ifndef QGSAUTHCONFIG_H
18#define QGSAUTHCONFIG_H
25#include <QDomDocument>
28#include <QSslCertificate>
61 const QString
id()
const {
return mId; }
63 void setId(
const QString &
id ) { mId = id; }
66 const QString
name()
const {
return mName; }
68 void setName(
const QString &name ) { mName = name; }
71 const QString
uri()
const {
return mUri; }
72 void setUri(
const QString &uri ) { mUri = uri; }
75 QString
method()
const {
return mMethod; }
76 void setMethod(
const QString &method ) { mMethod = method; }
87 bool isValid(
bool validateid =
false )
const;
93 const QString configString()
const;
99 void loadConfigString(
const QString &configstr );
116 void setConfig(
const QString &key,
const QString &value );
124 void setConfigList(
const QString &key,
const QStringList &value );
131 int removeConfig(
const QString &key );
138 QString config(
const QString &key,
const QString &defaultvalue = QString() )
const;
144 QStringList configList(
const QString &key )
const;
150 bool hasConfig(
const QString &key )
const;
163 static bool uriToResource(
const QString &accessurl, QString *resource,
bool withpath =
false );
172 bool writeXml( QDomElement &parentElement, QDomDocument &document );
179 bool readXml(
const QDomElement &element );
190 static const QString CONFIG_SEP;
191 static const QString CONFIG_KEY_SEP;
192 static const QString CONFIG_LIST_SEP;
194 static const int CONFIG_VERSION;
217 QgsPkiBundle(
const QSslCertificate &clientCert = QSslCertificate(),
218 const QSslKey &clientKey = QSslKey(),
219 const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
228 static const QgsPkiBundle fromPemPaths(
const QString &certPath,
229 const QString &keyPath,
230 const QString &keyPass = QString(),
231 const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
238 static const QgsPkiBundle fromPkcs12Paths(
const QString &bundlepath,
239 const QString &bundlepass = QString() );
245 bool isValid()
const;
248 const QString certId()
const;
253 void setClientCert(
const QSslCertificate &cert );
258 void setClientKey(
const QSslKey &certkey );
261 const QList<QSslCertificate>
caChain()
const {
return mCaChain; }
263 void setCaChain(
const QList<QSslCertificate> &cachain ) { mCaChain = cachain; }
266 QSslCertificate mCert;
268 QList<QSslCertificate> mCaChain;
288 const QSslCertificate &cert,
289 const QSslKey &certkey,
290 const QList<QSslCertificate> &cachain = QList<QSslCertificate>( ) );
317 QList<QSslCertificate>
caChain()
const {
return mCaChain; }
323 void setCaChain(
const QList<QSslCertificate> &caChain ) { mCaChain = caChain; }
327 QSslCertificate mCert;
329 QList<QSslCertificate> mCaChain;
335% MappedType QList<QSslError::SslError>
341 % ConvertFromTypeCode
345 if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
349 QList<QSslError::SslError>::iterator it = sipCpp->begin();
350 for (
int i = 0; it != sipCpp->end(); ++it, ++i )
354 if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
359 PyList_SET_ITEM( l, i, tobj );
367 if ( sipIsErr == NULL )
368 return PyList_Check( sipPy );
370 QList<QSslError::SslError> *qlist =
new QList<QSslError::SslError>;
372 for (
int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
374 *qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
378 return sipGetState( sipTransferObj );
411 const QList<QSslError> sslIgnoredErrors()
const;
445 const QString configString()
const;
447 void loadConfigString(
const QString &config = QString() );
454 QString mSslHostPort;
455 QSslCertificate mSslCert;
457 static QSsl::SslProtocol decodeSslProtocol(
const QString &protocol );
458 static QString encodeSslProtocol( QSsl::SslProtocol protocol );
460 QSsl::SslProtocol mSslProtocol;
462 QList<QSslError::SslError> mSslIgnoredErrors;
463 QSslSocket::PeerVerifyMode mSslPeerVerifyMode = QSslSocket::VerifyPeer;
464 int mSslPeerVerifyDepth = 0;
467 static const QString CONF_SEP;
Configuration container for SSL server connection exceptions or overrides.
void setSslProtocol(QSsl::SslProtocol protocol)
Sets SSL server protocol to use in connections.
void setSslCertificate(const QSslCertificate &cert)
Sets server certificate object.
void setSslHostPort(const QString &hostport)
Sets server host:port string.
int version() const
Version of the configuration (used for future upgrading)
QSsl::SslProtocol sslProtocol() const
SSL server protocol to use in connections.
void setSslPeerVerifyMode(QSslSocket::PeerVerifyMode mode)
Sets SSL client's peer verify mode to use in connections.
void setVersion(int version)
Sets version of the configuration (used for future upgrading)
void setSslPeerVerifyDepth(int depth)
Set number or SSL client's peer to verify in connections.
int sslPeerVerifyDepth() const
Number or SSL client's peer to verify in connections.
void setSslIgnoredErrorEnums(const QList< QSslError::SslError > &errors)
Sets SSL server errors (as enum list) to ignore in connections.
int qtVersion() const
Qt version when the configuration was made (SSL protocols may differ)
const QList< QSslError::SslError > sslIgnoredErrorEnums() const
SSL server errors (as enum list) to ignore in connections.
QSslSocket::PeerVerifyMode sslPeerVerifyMode() const
SSL client's peer verify mode to use in connections.
const QSslCertificate sslCertificate() const
Server certificate object.
const QString sslHostPort() const
Server host:port string.
void setQtVersion(int version)
Sets Qt version when the configuration was made (SSL protocols may differ)
Configuration storage class for authentication method configurations.
QString method() const
Textual key of the associated authentication method.
const QString uri() const
A URI to auto-select a config when connecting to a resource.
void setName(const QString &name)
Sets name of configuration.
void setConfigMap(const QgsStringMap &map)
Set extended configuration map.
void setVersion(int version)
Sets version of the configuration.
const QString name() const
Gets name of configuration.
const QString id() const
Gets 'authcfg' 7-character alphanumeric ID of the config.
void clearConfigMap()
Clear all configs.
int version() const
Gets version of the configuration.
QgsStringMap configMap() const
Gets extended configuration, mapped to key/value pairs of QStrings.
void setMethod(const QString &method)
void setUri(const QString &uri)
void setId(const QString &id)
Sets auth config ID.
Storage set for PKI bundle: SSL certificate, key, optional CA cert chain.
const QSslKey clientKey() const
Private key object.
void setCaChain(const QList< QSslCertificate > &cachain)
Sets chain of Certificate Authorities for client certificate.
const QList< QSslCertificate > caChain() const
Chain of Certificate Authorities for client certificate.
const QSslCertificate clientCert() const
Client certificate object.
Storage set for constructed SSL certificate, key, associated with an authentication config.
QList< QSslCertificate > caChain() const
caChain return the CA chain
void setClientCertKey(const QSslKey &certkey)
Sets private key object.
const QSslCertificate clientCert() const
Client certificate object.
const QgsAuthMethodConfig config() const
Authentication method configuration.
void setConfig(const QgsAuthMethodConfig &config)
Sets authentication method configuration.
const QSslKey clientCertKey() const
Private key object.
void setClientCert(const QSslCertificate &cert)
Sets client certificate object.
void setCaChain(const QList< QSslCertificate > &caChain)
setCaChain set the CA chain
QMap< QString, QString > QgsStringMap
QHash< QString, QgsAuthMethodConfig > QgsAuthMethodConfigsMap
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)