Skip to content

Commit 00fcc6e

Browse files
committedMay 23, 2017
sipify auth classes
1 parent e99f548 commit 00fcc6e

File tree

7 files changed

+1212
-649
lines changed

7 files changed

+1212
-649
lines changed
 

‎python/auto_sip.blacklist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ core/qgsexception.sip
33
core/qgis.sip
44
core/qgsrange.sip
55
core/qgsvectorlayerfeatureiterator.sip
6-
core/auth/qgsauthcertutils.sip
7-
core/auth/qgsauthconfig.sip
8-
core/auth/qgsauthmanager.sip
9-
core/auth/qgsauthmethod.sip
106
core/composer/qgsaddremoveitemcommand.sip
117
core/composer/qgsgroupungroupitemscommand.sip
128
core/composer/qgsaddremovemultiframecommand.sip

‎python/core/auth/qgsauthcertutils.sip

Lines changed: 158 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,47 @@
1-
/** \ingroup core
2-
* \brief Utilities for working with certificates and keys
3-
*/
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/auth/qgsauthcertutils.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
13+
14+
15+
416
class QgsAuthCertUtils
517
{
18+
%Docstring
19+
Utilities for working with certificates and keys
20+
%End
21+
622
%TypeHeaderCode
7-
#include <qgsauthcertutils.h>
23+
#include "qgsauthcertutils.h"
824
%End
925
public:
10-
/** Type of CA certificate source */
1126
enum CaCertSource
1227
{
13-
SystemRoot = 0,
14-
FromFile = 1,
15-
InDatabase = 2,
16-
Connection = 3
28+
SystemRoot,
29+
FromFile,
30+
InDatabase,
31+
Connection
1732
};
1833

19-
/** Type of certificate trust policy */
2034
enum CertTrustPolicy
2135
{
22-
DefaultTrust = 0,
23-
Trusted = 1,
24-
Untrusted = 2,
25-
NoPolicy = 3
36+
DefaultTrust,
37+
Trusted,
38+
Untrusted,
39+
NoPolicy
2640
};
2741

28-
/** Type of certificate usage */
2942
enum CertUsageType
3043
{
31-
UndeterminedUsage = 0,
44+
UndeterminedUsage,
3245
AnyOrUnspecifiedUsage,
3346
CertAuthorityUsage,
3447
CertIssuerUsage,
@@ -41,170 +54,188 @@ class QgsAuthCertUtils
4154
CRLSigningUsage
4255
};
4356

44-
/** Type of certificate key group */
4557
enum ConstraintGroup
4658
{
47-
KeyUsage = 0,
48-
ExtendedKeyUsage = 1
59+
KeyUsage,
60+
ExtendedKeyUsage
4961
};
5062

5163

52-
/** SSL Protocol name strings per enum */
5364
static QString getSslProtocolName( QSsl::SslProtocol protocol );
65+
%Docstring
66+
SSL Protocol name strings per enum
67+
:rtype: str
68+
%End
5469

55-
/** Map certificate sha1 to certificate as simple cache */
5670
static QMap<QString, QSslCertificate> mapDigestToCerts( const QList<QSslCertificate> &certs );
71+
%Docstring
72+
Map certificate sha1 to certificate as simple cache
73+
:rtype: QMap<str, QSslCertificate>
74+
%End
5775

58-
/** Map certificates to their oraganization.
59-
* @note not available in Python bindings
60-
*/
61-
// static QMap< QString, QList<QSslCertificate> > certsGroupedByOrg( QList<QSslCertificate> certs );
6276

63-
/** Map SSL custom configs' certificate sha1 to custom config as simple cache
64-
*/
6577
static QMap<QString, QgsAuthConfigSslServer> mapDigestToSslConfigs( const QList<QgsAuthConfigSslServer> &configs );
78+
%Docstring
79+
Map SSL custom configs' certificate sha1 to custom config as simple cache
80+
:rtype: QMap<str, QgsAuthConfigSslServer>
81+
%End
6682

67-
/** Map SSL custom configs' certificates to their oraganization.
68-
* @note not available in Python bindings
69-
*/
70-
// static QMap< QString, QList<QgsAuthConfigSslServer> > sslConfigsGroupedByOrg( const QList<QgsAuthConfigSslServer> &configs );
7183

72-
/** Return list of concatenated certs from a PEM or DER formatted file */
7384
static QList<QSslCertificate> certsFromFile( const QString &certspath );
85+
%Docstring
86+
Return list of concatenated certs from a PEM or DER formatted file
87+
:rtype: list of QSslCertificate
88+
%End
7489

75-
/** Return first cert from a PEM or DER formatted file */
7690
static QSslCertificate certFromFile( const QString &certpath );
91+
%Docstring
92+
Return first cert from a PEM or DER formatted file
93+
:rtype: QSslCertificate
94+
%End
7795

78-
/** Return non-encrypted key from a PEM or DER formatted file
79-
* @param keypath File path to private key
80-
* @param keypass Passphrase for private key
81-
* @param algtype QString to set with resolved algorithm type
82-
*/
8396
static QSslKey keyFromFile( const QString &keypath,
8497
const QString &keypass = QString(),
8598
QString *algtype = 0 );
99+
%Docstring
100+
Return non-encrypted key from a PEM or DER formatted file
101+
\param keypath File path to private key
102+
\param keypass Passphrase for private key
103+
\param algtype QString to set with resolved algorithm type
104+
:rtype: QSslKey
105+
%End
86106

87-
/** Return list of concatenated certs from a PEM Base64 text block */
88107
static QList<QSslCertificate> certsFromString( const QString &pemtext );
108+
%Docstring
109+
Return list of concatenated certs from a PEM Base64 text block
110+
:rtype: list of QSslCertificate
111+
%End
89112

90-
/** Return list of certificate, private key and algorithm (as PEM text) from file path components
91-
* @param certpath File path to certificate
92-
* @param keypath File path to private key
93-
* @param keypass Passphrase for private key
94-
* @param reencrypt Whether to re-encrypt the private key with the passphrase
95-
* @return certificate, private key, key's algorithm type
96-
*/
97113
static QStringList certKeyBundleToPem( const QString &certpath,
98114
const QString &keypath,
99115
const QString &keypass = QString(),
100116
bool reencrypt = true );
117+
%Docstring
118+
Return list of certificate, private key and algorithm (as PEM text) from file path components
119+
\param certpath File path to certificate
120+
\param keypath File path to private key
121+
\param keypass Passphrase for private key
122+
\param reencrypt Whether to re-encrypt the private key with the passphrase
123+
:return: certificate, private key, key's algorithm type
124+
:rtype: list of str
125+
%End
101126

102-
/** Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
103-
* @param bundlepath File path to the PKCS bundle
104-
* @param bundlepass Passphrase for bundle
105-
* @param reencrypt Whether to re-encrypt the private key with the passphrase
106-
* @return certificate, private key, key's algorithm type
107-
*/
108127
static QStringList pkcs12BundleToPem( const QString &bundlepath,
109128
const QString &bundlepass = QString(),
110129
bool reencrypt = true );
130+
%Docstring
131+
Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
132+
\param bundlepath File path to the PKCS bundle
133+
\param bundlepass Passphrase for bundle
134+
\param reencrypt Whether to re-encrypt the private key with the passphrase
135+
:return: certificate, private key, key's algorithm type
136+
:rtype: list of str
137+
%End
111138

112-
/** Write a temporary file for a PEM text of cert/key/CAs bundle component
113-
* @param pemtext Component content as PEM text
114-
* @param name Name of file
115-
* @return File path to temporary file
116-
*/
117139
static QString pemTextToTempFile( const QString &name, const QByteArray &pemtext );
140+
%Docstring
141+
Write a temporary file for a PEM text of cert/key/CAs bundle component
142+
\param pemtext Component content as PEM text
143+
\param name Name of file
144+
:return: File path to temporary file
145+
:rtype: str
146+
%End
118147

119-
/** Get the general name for CA source enum type
120-
* @param source The enum source type for the CA
121-
* @param single Whether to return singular or plural description
122-
*/
123-
static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source , bool single = false );
148+
static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source, bool single = false );
149+
%Docstring
150+
Get the general name for CA source enum type
151+
\param source The enum source type for the CA
152+
\param single Whether to return singular or plural description
153+
:rtype: str
154+
%End
124155

125-
/** Get the general name via RFC 5280 resolution */
126156
static QString resolvedCertName( const QSslCertificate &cert, bool issuer = false );
157+
%Docstring
158+
Get the general name via RFC 5280 resolution
159+
:rtype: str
160+
%End
161+
127162

128-
/** Get combined distinguished name for certificate
129-
* @param qcert Qt SSL cert object
130-
* @param acert QCA SSL cert object to add more info to the output
131-
* @param issuer Whether to return cert's subject or issuer combined name
132-
* @note not available in Python bindings
133-
*/
134-
// static QString getCertDistinguishedName( const QSslCertificate& qcert,
135-
// const QCA::Certificate& acert = QCA::Certificate(),
136-
// bool issuer = false );
137-
138-
/** Get the general name for certificate trust */
139163
static QString getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust );
164+
%Docstring
165+
Get the general name for certificate trust
166+
:rtype: str
167+
%End
140168

141-
/** Get string with colon delimiters every 2 characters */
142169
static QString getColonDelimited( const QString &txt );
170+
%Docstring
171+
Get string with colon delimiters every 2 characters
172+
:rtype: str
173+
%End
174+
175+
static QString shaHexForCert( const QSslCertificate &cert, bool formatted = false );
176+
%Docstring
177+
Get the sha1 hash for certificate
178+
\param cert Qt SSL certificate to generate hash from
179+
\param formatted Whether to colon-delimit the hash
180+
:rtype: str
181+
%End
182+
183+
184+
185+
186+
187+
188+
143189

144-
/** Get the sha1 hash for certificate
145-
* @param cert Qt SSL certificate to generate hash from
146-
* @param formatted Whether to colon-delimit the hash
147-
*/
148-
static QString shaHexForCert( const QSslCertificate &cert , bool formatted = false );
149-
150-
/** Convert a QSslCertificate to a QCA::Certificate.
151-
* @note not available in Python bindings
152-
*/
153-
// static QCA::Certificate qtCertToQcaCert( const QSslCertificate &cert );
154-
155-
/** Convert a QList of QSslCertificate to a QCA::CertificateCollection.
156-
* @note not available in Python bindings
157-
*/
158-
// static QCA::CertificateCollection qtCertsToQcaCollection( const QList<QSslCertificate> &certs );
159-
160-
/** PKI key/cert bundle from file path, e.g. from .p12 or pfx files.
161-
* @note not available in Python bindings
162-
*/
163-
// static QCA::KeyBundle qcaKeyBundle( const QString &path, const QString &pass );
164-
165-
/** Certificate validity check messages per enum.
166-
* @note not available in Python bindings
167-
*/
168-
// static QString qcaValidityMessage( QCA::Validity validity );
169-
170-
/** Certificate signature algorithm strings per enum.
171-
* @note not available in Python bindings
172-
*/
173-
// static QString qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm );
174-
175-
/** Certificate well-known constraint strings per enum.
176-
* @note not available in Python bindings
177-
*/
178-
// static QString qcaKnownConstraint( QCA::ConstraintTypeKnown constraint );
179-
180-
/** Certificate usage type strings per enum
181-
* @note not available in Python bindings
182-
*/
183-
static QString certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype );
184-
185-
/** Try to determine the certificates usage types */
186190
static QList<QgsAuthCertUtils::CertUsageType> certificateUsageTypes( const QSslCertificate &cert );
191+
%Docstring
192+
Try to determine the certificates usage types
193+
:rtype: list of QgsAuthCertUtils.CertUsageType
194+
%End
187195

188-
/** Get whether a certificate is an Authority */
189196
static bool certificateIsAuthority( const QSslCertificate &cert );
197+
%Docstring
198+
Get whether a certificate is an Authority
199+
:rtype: bool
200+
%End
190201

191-
/** Get whether a certificate can sign other certificates */
192202
static bool certificateIsIssuer( const QSslCertificate &cert );
203+
%Docstring
204+
Get whether a certificate can sign other certificates
205+
:rtype: bool
206+
%End
193207

194-
/** Get whether a certificate is an Authority or can at least sign other certificates */
195208
static bool certificateIsAuthorityOrIssuer( const QSslCertificate &cert );
209+
%Docstring
210+
Get whether a certificate is an Authority or can at least sign other certificates
211+
:rtype: bool
212+
%End
196213

197-
/** Get whether a certificate is probably used for a SSL server */
198214
static bool certificateIsSslServer( const QSslCertificate &cert );
215+
%Docstring
216+
Get whether a certificate is probably used for a SSL server
217+
:rtype: bool
218+
%End
199219

200-
/** Get whether a certificate is probably used for a client identity */
201220
static bool certificateIsSslClient( const QSslCertificate &cert );
221+
%Docstring
222+
Get whether a certificate is probably used for a client identity
223+
:rtype: bool
224+
%End
202225

203-
/** Get short strings describing an SSL error */
204226
static QString sslErrorEnumString( QSslError::SslError errenum );
227+
%Docstring
228+
Get short strings describing an SSL error
229+
:rtype: str
230+
%End
231+
205232

206-
/** Get short strings describing SSL errors.
207-
* @note not available in Python bindings
208-
*/
209-
// static QList<QPair<QSslError::SslError, QString> > sslErrorEnumStrings();
210233
};
234+
235+
/************************************************************************
236+
* This file has been generated automatically from *
237+
* *
238+
* src/core/auth/qgsauthcertutils.h *
239+
* *
240+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
241+
************************************************************************/

‎python/core/auth/qgsauthconfig.sip

Lines changed: 349 additions & 170 deletions
Large diffs are not rendered by default.

‎python/core/auth/qgsauthmanager.sip

Lines changed: 522 additions & 279 deletions
Large diffs are not rendered by default.

‎python/core/auth/qgsauthmethod.sip

Lines changed: 120 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1+
/************************************************************************
2+
* This file has been generated automatically from *
3+
* *
4+
* src/core/auth/qgsauthmethod.h *
5+
* *
6+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
7+
************************************************************************/
8+
9+
10+
11+
12+
113
class QgsAuthMethod : QObject
214
{
3-
%TypeHeaderCode
4-
#include <qgsauthmethod.h>
15+
%Docstring
16+
Abstract base class for authentication method plugins
517
%End
618

19+
%TypeHeaderCode
20+
#include "qgsauthmethod.h"
21+
%End
722
public:
823

9-
/** Flags that represent the update points (where authentication configurations are expanded)
10-
* supported by an authentication method. These equate to the 'update*()' virtual functions
11-
* below, and allow for update point code to skip calling an unused update by a method, because
12-
* the base virtual function will always return true, giving a false impression an update occurred.
13-
* @note When adding an 'update' member function, also add the corresponding Expansion flag.
14-
* @note These flags will be added to as new update points are added
15-
*/
1624
enum Expansion
1725
{
18-
// TODO: Figure out all different authentication expansions current layer providers use
26+
// TODO
1927
NetworkRequest,
2028
NetworkReply,
2129
DataSourceUri,
@@ -24,90 +32,142 @@ class QgsAuthMethod : QObject
2432
};
2533
typedef QFlags<QgsAuthMethod::Expansion> Expansions;
2634

27-
virtual ~QgsAuthMethod();
2835

29-
/** A non-translated short name representing the auth method */
3036
virtual QString key() const = 0;
37+
%Docstring
38+
A non-translated short name representing the auth method
39+
:rtype: str
40+
%End
3141

32-
/** A non-translated short description representing the auth method for use in debug output and About dialog */
3342
virtual QString description() const = 0;
43+
%Docstring
44+
A non-translated short description representing the auth method for use in debug output and About dialog
45+
:rtype: str
46+
%End
3447

35-
/** Translatable display version of the 'description()' */
3648
virtual QString displayDescription() const = 0;
49+
%Docstring
50+
Translatable display version of the 'description()'
51+
:rtype: str
52+
%End
3753

38-
/** Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg */
3954
int version() const;
55+
%Docstring
56+
Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg
57+
:rtype: int
58+
%End
4059

41-
/** Flags that represent the update points (where authentication configurations are expanded)
42-
* supported by an authentication method.
43-
* @note These should directly correlate to existing 'update*()' member functions
44-
*/
4560
QgsAuthMethod::Expansions supportedExpansions() const;
61+
%Docstring
62+
Flags that represent the update points (where authentication configurations are expanded)
63+
supported by an authentication method.
64+
.. note::
65+
66+
These should directly correlate to existing 'update*()' member functions
67+
:rtype: QgsAuthMethod.Expansions
68+
%End
4669

47-
/** The data providers that the method supports, allowing for filtering out authcfgs that are not
48-
* applicable to a given provider, or where the updating code is not currently implemented.
49-
*/
5070
QStringList supportedDataProviders() const;
71+
%Docstring
72+
The data providers that the method supports, allowing for filtering out authcfgs that are not
73+
applicable to a given provider, or where the updating code is not currently implemented.
74+
:rtype: list of str
75+
%End
5176

52-
/** Update a network request with authentication components
53-
* @param request The network request to update
54-
* @param authcfg Authentication configuration ID
55-
* @param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
56-
* for custom updater code specific to the provider
57-
* @return Whether the update succeeded
58-
*/
5977
virtual bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
6078
const QString &dataprovider = QString() );
79+
%Docstring
80+
Update a network request with authentication components
81+
\param request The network request to update
82+
\param authcfg Authentication configuration ID
83+
\param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
84+
for custom updater code specific to the provider
85+
:return: Whether the update succeeded
86+
:rtype: bool
87+
%End
6188

62-
/** Update a network reply with authentication components
63-
* @param reply The network reply object to update
64-
* @param authcfg Authentication configuration ID
65-
* @param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
66-
* for custom updater code specific to the provider
67-
* @return Whether the update succeeded
68-
*/
6989
virtual bool updateNetworkReply( QNetworkReply *reply, const QString &authcfg,
7090
const QString &dataprovider = QString() );
91+
%Docstring
92+
Update a network reply with authentication components
93+
\param reply The network reply object to update
94+
\param authcfg Authentication configuration ID
95+
\param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
96+
for custom updater code specific to the provider
97+
:return: Whether the update succeeded
98+
:rtype: bool
99+
%End
71100

72-
/** Update data source connection items with authentication components
73-
* @param connectionItems QStringlist of 'key=value' pairs, as utilized in QgsDataSourceUri::connectionInfo()
74-
* @param authcfg Authentication configuration ID
75-
* @param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
76-
* for custom updater code specific to the provider
77-
* @return Whether the update succeeded
78-
*/
79101
virtual bool updateDataSourceUriItems( QStringList &connectionItems, const QString &authcfg,
80102
const QString &dataprovider = QString() );
103+
%Docstring
104+
Update data source connection items with authentication components
105+
\param connectionItems QStringlist of 'key=value' pairs, as utilized in QgsDataSourceUri.connectionInfo()
106+
\param authcfg Authentication configuration ID
107+
\param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
108+
for custom updater code specific to the provider
109+
:return: Whether the update succeeded
110+
:rtype: bool
111+
%End
81112

82-
/** Clear any cached configuration. Called when the QgsAuthManager deletes an authentication configuration (authcfg).
83-
* @note It is highly recommended that a cache of authentication components (per requested authcfg)
84-
* be implemented, to avoid excessive queries on the auth database. Such a cache could be as
85-
* simple as a QHash or QMap of authcfg -> QgsAuthMethodConfig. See 'Basic' auth method plugin for example.
86-
*/
87113
virtual void clearCachedConfig( const QString &authcfg ) = 0;
114+
%Docstring
115+
Clear any cached configuration. Called when the QgsAuthManager deletes an authentication configuration (authcfg).
116+
.. note::
117+
118+
It is highly recommended that a cache of authentication components (per requested authcfg)
119+
be implemented, to avoid excessive queries on the auth database. Such a cache could be as
120+
simple as a QHash or QMap of authcfg -> QgsAuthMethodConfig. See 'Basic' auth method plugin for example.
121+
%End
88122

89-
/** Update an authentication configuration in place
90-
* @note Useful for updating previously stored authcfgs, when an authentication method has been significantly updated
91-
*/
92123
virtual void updateMethodConfig( QgsAuthMethodConfig &mconfig ) = 0;
124+
%Docstring
125+
Update an authentication configuration in place
126+
.. note::
127+
128+
Useful for updating previously stored authcfgs, when an authentication method has been significantly updated
129+
%End
93130

94131
protected:
95-
/**
96-
* Construct a default authentication method
97-
* @note Non-public since this is an abstract base class
98-
*/
132+
99133
explicit QgsAuthMethod();
134+
%Docstring
135+
Construct a default authentication method
136+
.. note::
137+
138+
Non-public since this is an abstract base class
139+
%End
100140

101-
/** Tag signifying that this is an authentcation method (e.g. for use as title in message log panel output) */
102141
static QString authMethodTag();
142+
%Docstring
143+
Tag signifying that this is an authentcation method (e.g. for use as title in message log panel output)
144+
:rtype: str
145+
%End
103146

104-
/** Set the version of the auth method (useful for future upgrading) */
105147
void setVersion( int version );
148+
%Docstring
149+
Set the version of the auth method (useful for future upgrading)
150+
%End
106151

107-
/** Set the support expansions (points in providers where the authentication is injected) of the auth method */
108152
void setExpansions( QgsAuthMethod::Expansions expansions );
109-
/** Set list of data providers this auth method supports */
153+
%Docstring
154+
Set the support expansions (points in providers where the authentication is injected) of the auth method
155+
%End
110156
void setDataProviders( const QStringList &dataproviders );
157+
%Docstring
158+
Set list of data providers this auth method supports
159+
%End
160+
111161
};
162+
QFlags<QgsAuthMethod::Expansion> operator|(QgsAuthMethod::Expansion f1, QFlags<QgsAuthMethod::Expansion> f2);
163+
164+
165+
typedef QHash<QString, QgsAuthMethod *> QgsAuthMethodsMap;
112166

113-
typedef QHash<QString, QgsAuthMethod*> QgsAuthMethodsMap;
167+
/************************************************************************
168+
* This file has been generated automatically from *
169+
* *
170+
* src/core/auth/qgsauthmethod.h *
171+
* *
172+
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
173+
************************************************************************/

‎src/core/auth/qgsauthconfig.h

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,58 @@ class CORE_EXPORT QgsPkiConfigBundle
291291
};
292292

293293

294+
295+
#ifdef SIP_RUN
296+
% MappedType QList<QSslError::SslError>
297+
{
298+
% TypeHeaderCode
299+
#include <QList>
300+
% End
301+
302+
% ConvertFromTypeCode
303+
// Create the list.
304+
PyObject *l;
305+
306+
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
307+
return NULL;
308+
309+
// Set the list elements.
310+
QList<QSslError::SslError>::iterator it = sipCpp->begin();
311+
for ( int i = 0; it != sipCpp->end(); ++it, ++i )
312+
{
313+
PyObject *tobj;
314+
315+
if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
316+
{
317+
Py_DECREF( l );
318+
return NULL;
319+
}
320+
PyList_SET_ITEM( l, i, tobj );
321+
}
322+
323+
return l;
324+
% End
325+
326+
% ConvertToTypeCode
327+
// Check the type if that is all that is required.
328+
if ( sipIsErr == NULL )
329+
return PyList_Check( sipPy );
330+
331+
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
332+
333+
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
334+
{
335+
*qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
336+
}
337+
338+
*sipCppPtr = qlist;
339+
return sipGetState( sipTransferObj );
340+
% End
341+
};
342+
#endif
343+
344+
345+
294346
/** \ingroup core
295347
* \brief Configuration container for SSL server connection exceptions or overrides
296348
*/

‎src/core/auth/qgsauthmanager.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@
4141
// Qt5KeyChain library
4242
#include "keychain.h"
4343

44+
#ifndef SIP_RUN
4445
namespace QCA
4546
{
4647
class Initializer;
4748
}
49+
#endif
4850
class QgsAuthMethod;
4951
class QgsAuthMethodEdit;
5052
class QgsAuthProvider;
@@ -142,7 +144,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
142144
* \param keepbackup Whether to keep the generated backup of current database
143145
* \param backuppath Where the backup is located, if kept
144146
*/
145-
bool resetMasterPassword( const QString &newpass, const QString &oldpass, bool keepbackup, QString *backuppath = nullptr );
147+
bool resetMasterPassword( const QString &newpass, const QString &oldpass, bool keepbackup, QString *backuppath SIP_INOUT = nullptr );
146148

147149
/** Whether there is a scheduled opitonal erase of authentication database.
148150
* \note not available in Python bindings
@@ -252,7 +254,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
252254
* \param mconfig Associated authentication config id
253255
* \returns Whether operation succeeded
254256
*/
255-
bool storeAuthenticationConfig( QgsAuthMethodConfig &mconfig );
257+
bool storeAuthenticationConfig( QgsAuthMethodConfig &mconfig SIP_INOUT );
256258

257259
/**
258260
* Update an authentication config in the database
@@ -268,7 +270,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
268270
* \param full Whether to decrypt and populate all sensitive data in subclass
269271
* \returns Whether operation succeeded
270272
*/
271-
bool loadAuthenticationConfig( const QString &authcfg, QgsAuthMethodConfig &mconfig, bool full = false );
273+
bool loadAuthenticationConfig( const QString &authcfg, QgsAuthMethodConfig &mconfig SIP_INOUT, bool full = false );
272274

273275
/**
274276
* Remove an authentication config in the database
@@ -287,15 +289,15 @@ class CORE_EXPORT QgsAuthManager : public QObject
287289
* Close connection to current authentication database and back it up
288290
* \returns Path to backup
289291
*/
290-
bool backupAuthenticationDatabase( QString *backuppath = nullptr );
292+
bool backupAuthenticationDatabase( QString *backuppath SIP_INOUT = nullptr );
291293

292294
/**
293295
* Erase all rows from all tables in authentication database
294296
* \param backup Whether to backup of current database
295297
* \param backuppath Where the backup is locate
296298
* \returns Whether operation succeeded
297299
*/
298-
bool eraseAuthenticationDatabase( bool backup, QString *backuppath = nullptr );
300+
bool eraseAuthenticationDatabase( bool backup, QString *backuppath SIP_INOUT = nullptr );
299301

300302

301303
////////////////// Auth Method calls ///////////////////////
@@ -307,7 +309,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
307309
* \param dataprovider Provider key filter, offering logic branching in authentication method
308310
* \returns Whether operation succeeded
309311
*/
310-
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
312+
bool updateNetworkRequest( QNetworkRequest &request SIP_INOUT, const QString &authcfg,
311313
const QString &dataprovider = QString() );
312314

313315
/**
@@ -327,7 +329,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
327329
* \param dataprovider Provider key filter, offering logic branching in authentication method
328330
* \returns Whether operation succeeded
329331
*/
330-
bool updateDataSourceUriItems( QStringList &connectionItems, const QString &authcfg,
332+
bool updateDataSourceUriItems( QStringList &connectionItems SIP_INOUT, const QString &authcfg,
331333
const QString &dataprovider = QString() );
332334

333335
////////////////// Generic settings ///////////////////////
@@ -555,7 +557,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
555557
* \param tag Associated tag (title)
556558
* \param level Message log level
557559
*/
558-
void messageOut( const QString &message, const QString &tag = AUTH_MAN_TAG, QgsAuthManager::MessageLevel level = INFO ) const;
560+
void messageOut( const QString &message, const QString &tag = QgsAuthManager::AUTH_MAN_TAG, QgsAuthManager::MessageLevel level = QgsAuthManager::INFO ) const;
559561

560562
/**
561563
* Custom logging signal to inform the user about master password <-> password manager interactions
@@ -564,7 +566,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
564566
* @param tag Associated tag (title)
565567
* @param level Message log level
566568
*/
567-
void passwordHelperMessageOut( const QString &message, const QString &tag = AUTH_MAN_TAG, QgsAuthManager::MessageLevel level = INFO ) const;
569+
void passwordHelperMessageOut( const QString &message, const QString &tag = QgsAuthManager::AUTH_MAN_TAG, QgsAuthManager::MessageLevel level = QgsAuthManager::INFO ) const;
568570

569571

570572
/**

0 commit comments

Comments
 (0)
Please sign in to comment.