QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
17 #ifndef QGSAUTHCONFIG_H
18 #define QGSAUTHCONFIG_H
20 #include "qgis_core.h"
25 #include <QSslCertificate>
59 const QString
id()
const {
return mId; }
61 void setId(
const QString &
id ) { mId = id; }
64 const QString
name()
const {
return mName; }
66 void setName(
const QString &name ) { mName = name; }
69 const QString
uri()
const {
return mUri; }
70 void setUri(
const QString &uri ) { mUri = uri; }
73 QString
method()
const {
return mMethod; }
74 void setMethod(
const QString &method ) { mMethod = method; }
85 bool isValid(
bool validateid =
false )
const;
91 const QString configString()
const;
97 void loadConfigString(
const QString &configstr );
114 void setConfig(
const QString &key,
const QString &value );
122 void setConfigList(
const QString &key,
const QStringList &value );
129 int removeConfig(
const QString &key );
136 QString config(
const QString &key,
const QString &defaultvalue = QString() )
const;
142 QStringList configList(
const QString &key )
const;
148 bool hasConfig(
const QString &key )
const;
161 static bool uriToResource(
const QString &accessurl, QString *resource,
bool withpath =
false );
172 static const QString CONFIG_SEP;
173 static const QString CONFIG_KEY_SEP;
174 static const QString CONFIG_LIST_SEP;
176 static const int CONFIG_VERSION;
199 QgsPkiBundle(
const QSslCertificate &clientCert = QSslCertificate(),
200 const QSslKey &clientKey = QSslKey(),
201 const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
210 static const QgsPkiBundle fromPemPaths(
const QString &certPath,
211 const QString &keyPath,
212 const QString &keyPass = QString(),
213 const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
220 static const QgsPkiBundle fromPkcs12Paths(
const QString &bundlepath,
221 const QString &bundlepass = QString() );
227 bool isValid()
const;
230 const QString certId()
const;
235 void setClientCert(
const QSslCertificate &cert );
240 void setClientKey(
const QSslKey &certkey );
243 const QList<QSslCertificate>
caChain()
const {
return mCaChain; }
245 void setCaChain(
const QList<QSslCertificate> &cachain ) { mCaChain = cachain; }
248 QSslCertificate mCert;
250 QList<QSslCertificate> mCaChain;
270 const QSslCertificate &cert,
271 const QSslKey &certkey,
272 const QList<QSslCertificate> &cachain = QList<QSslCertificate>( ) );
299 QList<QSslCertificate>
caChain()
const {
return mCaChain; }
305 void setCaChain(
const QList<QSslCertificate> &caChain ) { mCaChain = caChain; }
309 QSslCertificate mCert;
311 QList<QSslCertificate> mCaChain;
317 % MappedType QList<QSslError::SslError>
323 % ConvertFromTypeCode
327 if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
331 QList<QSslError::SslError>::iterator it = sipCpp->begin();
332 for (
int i = 0; it != sipCpp->end(); ++it, ++i )
336 if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
341 PyList_SET_ITEM( l, i, tobj );
349 if ( sipIsErr == NULL )
350 return PyList_Check( sipPy );
352 QList<QSslError::SslError> *qlist =
new QList<QSslError::SslError>;
354 for (
int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
356 *qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
360 return sipGetState( sipTransferObj );
393 const QList<QSslError> sslIgnoredErrors()
const;
427 const QString configString()
const;
429 void loadConfigString(
const QString &config = QString() );
436 QString mSslHostPort;
437 QSslCertificate mSslCert;
439 QSsl::SslProtocol mSslProtocol;
441 QList<QSslError::SslError> mSslIgnoredErrors;
442 QSslSocket::PeerVerifyMode mSslPeerVerifyMode = QSslSocket::VerifyPeer;
443 int mSslPeerVerifyDepth = 0;
446 static const QString CONF_SEP;
450 #endif // QGSAUTHCONFIG_H
Storage set for constructed SSL certificate, key, associated with an authentication config.
void setSslHostPort(const QString &hostport)
Sets server host:port string.
const QString name() const
Gets name of configuration.
const QString sslHostPort() const
Server host:port string.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
void setUri(const QString &uri)
void setClientCertKey(const QSslKey &certkey)
Sets private key object.
const QSslCertificate clientCert() const
Client certificate object.
void setMethod(const QString &method)
const QgsAuthMethodConfig config() const
Authentication method configuration.
void setSslPeerVerifyMode(QSslSocket::PeerVerifyMode mode)
Sets SSL client's peer verify mode to use in connections.
void setSslPeerVerifyDepth(int depth)
Set number or SSL client's peer to verify in connections.
void setQtVersion(int version)
Sets Qt version when the configuration was made (SSL protocols may differ)
void setCaChain(const QList< QSslCertificate > &caChain)
setCaChain set the CA chain
void setSslCertificate(const QSslCertificate &cert)
Sets server certificate object.
Storage set for PKI bundle: SSL certificate, key, optional CA cert chain.
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
const QSslKey clientKey() const
Private key object.
QHash< QString, QgsAuthMethodConfig > QgsAuthMethodConfigsMap
void setConfigMap(const QgsStringMap &map)
Set extended configuration map.
void setConfig(const QgsAuthMethodConfig &config)
Sets authentication method configuration.
void setVersion(int version)
Sets version of the configuration.
const QList< QSslError::SslError > sslIgnoredErrorEnums() const
SSL server errors (as enum list) to ignore in connections.
const QSslCertificate clientCert() const
Client certificate object.
void setCaChain(const QList< QSslCertificate > &cachain)
Sets chain of Certificate Authorities for client certificate.
int qtVersion() const
Qt version when the configuration was made (SSL protocols may differ)
int sslPeerVerifyDepth() const
Number or SSL client's peer to verify in connections.
int version() const
Gets version of the configuration.
void setSslProtocol(QSsl::SslProtocol protocol)
Sets SSL server protocol to use in connections.
QString method() const
Textual key of the associated authentication method.
void setSslIgnoredErrorEnums(const QList< QSslError::SslError > &errors)
Sets SSL server errors (as enum list) to ignore in connections.
const QList< QSslCertificate > caChain() const
Chain of Certificate Authorities for client certificate.
int version() const
Version of the configuration (used for future upgrading)
const QSslKey clientCertKey() const
Private key object.
QgsStringMap configMap() const
Gets extended configuration, mapped to key/value pairs of QStrings.
QMap< QString, QString > QgsStringMap
const QString id() const
Gets 'authcfg' 7-character alphanumeric ID of the config.
QSslSocket::PeerVerifyMode sslPeerVerifyMode() const
SSL client's peer verify mode to use in connections.
Configuration container for SSL server connection exceptions or overrides.
void setClientCert(const QSslCertificate &cert)
Sets client certificate object.
QSsl::SslProtocol sslProtocol() const
SSL server protocol to use in connections.
void setId(const QString &id)
Sets auth config ID.
void clearConfigMap()
Clear all configs.
void setName(const QString &name)
Sets name of configuration.
const QSslCertificate sslCertificate() const
Server certificate object.
QList< QSslCertificate > caChain() const
caChain return the CA chain
Configuration storage class for authentication method configurations.
void setVersion(int version)
Sets version of the configuration (used for future upgrading)
const QString uri() const
A URI to auto-select a config when connecting to a resource.