17 #ifndef QGSAUTHCONFIG_H
18 #define QGSAUTHCONFIG_H
20 #include "qgis_core.h"
24 #include <QDomElement>
25 #include <QDomDocument>
28 #include <QSslCertificate>
64 const QString id()
const {
return mId; }
66 void setId(
const QString &
id ) { mId = id; }
69 const QString name()
const {
return mName; }
71 void setName(
const QString &name ) { mName = name; }
74 const QString uri()
const {
return mUri; }
75 void setUri(
const QString &uri ) { mUri = uri; }
78 QString method()
const {
return mMethod; }
79 void setMethod(
const QString &method ) { mMethod = method; }
82 int version()
const {
return mVersion; }
84 void setVersion(
int version ) { mVersion = version; }
90 bool isValid(
bool validateid =
false )
const;
96 const QString configString()
const;
102 void loadConfigString(
const QString &configstr );
111 void setConfigMap(
const QgsStringMap &map ) { mConfigMap = map; }
119 void setConfig(
const QString &key,
const QString &value );
127 void setConfigList(
const QString &key,
const QStringList &value );
134 int removeConfig(
const QString &key );
141 QString config(
const QString &key,
const QString &defaultvalue = QString() )
const;
147 QStringList configList(
const QString &key )
const;
153 bool hasConfig(
const QString &key )
const;
156 void clearConfigMap() { mConfigMap.clear(); }
166 static bool uriToResource(
const QString &accessurl, QString *resource,
bool withpath =
false );
175 bool writeXml( QDomElement &parentElement, QDomDocument &document );
182 bool readXml(
const QDomElement &element );
193 static const QString CONFIG_SEP;
194 static const QString CONFIG_KEY_SEP;
195 static const QString CONFIG_LIST_SEP;
197 static const int CONFIG_VERSION;
220 QgsPkiBundle(
const QSslCertificate &clientCert = QSslCertificate(),
221 const QSslKey &clientKey = QSslKey(),
222 const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
231 static const QgsPkiBundle fromPemPaths(
const QString &certPath,
232 const QString &keyPath,
233 const QString &keyPass = QString(),
234 const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
241 static const QgsPkiBundle fromPkcs12Paths(
const QString &bundlepath,
242 const QString &bundlepass = QString() );
248 bool isValid()
const;
251 const QString certId()
const;
256 void setClientCert(
const QSslCertificate &cert );
261 void setClientKey(
const QSslKey &certkey );
264 const QList<QSslCertificate>
caChain()
const {
return mCaChain; }
266 void setCaChain(
const QList<QSslCertificate> &cachain ) { mCaChain = cachain; }
269 QSslCertificate mCert;
271 QList<QSslCertificate> mCaChain;
291 const QSslCertificate &cert,
292 const QSslKey &certkey,
293 const QList<QSslCertificate> &cachain = QList<QSslCertificate>( ) );
320 QList<QSslCertificate>
caChain()
const {
return mCaChain; }
326 void setCaChain(
const QList<QSslCertificate> &caChain ) { mCaChain = caChain; }
330 QSslCertificate mCert;
332 QList<QSslCertificate> mCaChain;
338 % MappedType QList<QSslError::SslError>
344 % ConvertFromTypeCode
348 if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
352 QList<QSslError::SslError>::iterator it = sipCpp->begin();
353 for (
int i = 0; it != sipCpp->end(); ++it, ++i )
357 if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
362 PyList_SET_ITEM( l, i, tobj );
370 if ( sipIsErr == NULL )
371 return PyList_Check( sipPy );
373 QList<QSslError::SslError> *qlist =
new QList<QSslError::SslError>;
375 for (
int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
377 *qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
381 return sipGetState( sipTransferObj );
414 const QList<QSslError> sslIgnoredErrors()
const;
448 const QString configString()
const;
450 void loadConfigString(
const QString &config = QString() );
457 QString mSslHostPort;
458 QSslCertificate mSslCert;
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;
471 #endif // QGSAUTHCONFIG_H