mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-15 00:07:25 -05:00
sipify auth classes
This commit is contained in:
parent
e99f54854b
commit
00fcc6e0cd
@ -3,10 +3,6 @@ core/qgsexception.sip
|
||||
core/qgis.sip
|
||||
core/qgsrange.sip
|
||||
core/qgsvectorlayerfeatureiterator.sip
|
||||
core/auth/qgsauthcertutils.sip
|
||||
core/auth/qgsauthconfig.sip
|
||||
core/auth/qgsauthmanager.sip
|
||||
core/auth/qgsauthmethod.sip
|
||||
core/composer/qgsaddremoveitemcommand.sip
|
||||
core/composer/qgsgroupungroupitemscommand.sip
|
||||
core/composer/qgsaddremovemultiframecommand.sip
|
||||
|
||||
@ -1,34 +1,47 @@
|
||||
/** \ingroup core
|
||||
* \brief Utilities for working with certificates and keys
|
||||
*/
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/auth/qgsauthcertutils.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsAuthCertUtils
|
||||
{
|
||||
%Docstring
|
||||
Utilities for working with certificates and keys
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsauthcertutils.h>
|
||||
#include "qgsauthcertutils.h"
|
||||
%End
|
||||
public:
|
||||
/** Type of CA certificate source */
|
||||
enum CaCertSource
|
||||
{
|
||||
SystemRoot = 0,
|
||||
FromFile = 1,
|
||||
InDatabase = 2,
|
||||
Connection = 3
|
||||
SystemRoot,
|
||||
FromFile,
|
||||
InDatabase,
|
||||
Connection
|
||||
};
|
||||
|
||||
/** Type of certificate trust policy */
|
||||
enum CertTrustPolicy
|
||||
{
|
||||
DefaultTrust = 0,
|
||||
Trusted = 1,
|
||||
Untrusted = 2,
|
||||
NoPolicy = 3
|
||||
DefaultTrust,
|
||||
Trusted,
|
||||
Untrusted,
|
||||
NoPolicy
|
||||
};
|
||||
|
||||
/** Type of certificate usage */
|
||||
enum CertUsageType
|
||||
{
|
||||
UndeterminedUsage = 0,
|
||||
UndeterminedUsage,
|
||||
AnyOrUnspecifiedUsage,
|
||||
CertAuthorityUsage,
|
||||
CertIssuerUsage,
|
||||
@ -41,170 +54,188 @@ class QgsAuthCertUtils
|
||||
CRLSigningUsage
|
||||
};
|
||||
|
||||
/** Type of certificate key group */
|
||||
enum ConstraintGroup
|
||||
{
|
||||
KeyUsage = 0,
|
||||
ExtendedKeyUsage = 1
|
||||
KeyUsage,
|
||||
ExtendedKeyUsage
|
||||
};
|
||||
|
||||
|
||||
/** SSL Protocol name strings per enum */
|
||||
static QString getSslProtocolName( QSsl::SslProtocol protocol );
|
||||
%Docstring
|
||||
SSL Protocol name strings per enum
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Map certificate sha1 to certificate as simple cache */
|
||||
static QMap<QString, QSslCertificate> mapDigestToCerts( const QList<QSslCertificate> &certs );
|
||||
%Docstring
|
||||
Map certificate sha1 to certificate as simple cache
|
||||
:rtype: QMap<str, QSslCertificate>
|
||||
%End
|
||||
|
||||
/** Map certificates to their oraganization.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QMap< QString, QList<QSslCertificate> > certsGroupedByOrg( QList<QSslCertificate> certs );
|
||||
|
||||
/** Map SSL custom configs' certificate sha1 to custom config as simple cache
|
||||
*/
|
||||
static QMap<QString, QgsAuthConfigSslServer> mapDigestToSslConfigs( const QList<QgsAuthConfigSslServer> &configs );
|
||||
%Docstring
|
||||
Map SSL custom configs' certificate sha1 to custom config as simple cache
|
||||
:rtype: QMap<str, QgsAuthConfigSslServer>
|
||||
%End
|
||||
|
||||
/** Map SSL custom configs' certificates to their oraganization.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QMap< QString, QList<QgsAuthConfigSslServer> > sslConfigsGroupedByOrg( const QList<QgsAuthConfigSslServer> &configs );
|
||||
|
||||
/** Return list of concatenated certs from a PEM or DER formatted file */
|
||||
static QList<QSslCertificate> certsFromFile( const QString &certspath );
|
||||
%Docstring
|
||||
Return list of concatenated certs from a PEM or DER formatted file
|
||||
:rtype: list of QSslCertificate
|
||||
%End
|
||||
|
||||
/** Return first cert from a PEM or DER formatted file */
|
||||
static QSslCertificate certFromFile( const QString &certpath );
|
||||
%Docstring
|
||||
Return first cert from a PEM or DER formatted file
|
||||
:rtype: QSslCertificate
|
||||
%End
|
||||
|
||||
/** Return non-encrypted key from a PEM or DER formatted file
|
||||
* @param keypath File path to private key
|
||||
* @param keypass Passphrase for private key
|
||||
* @param algtype QString to set with resolved algorithm type
|
||||
*/
|
||||
static QSslKey keyFromFile( const QString &keypath,
|
||||
const QString &keypass = QString(),
|
||||
QString *algtype = 0 );
|
||||
%Docstring
|
||||
Return non-encrypted key from a PEM or DER formatted file
|
||||
\param keypath File path to private key
|
||||
\param keypass Passphrase for private key
|
||||
\param algtype QString to set with resolved algorithm type
|
||||
:rtype: QSslKey
|
||||
%End
|
||||
|
||||
/** Return list of concatenated certs from a PEM Base64 text block */
|
||||
static QList<QSslCertificate> certsFromString( const QString &pemtext );
|
||||
%Docstring
|
||||
Return list of concatenated certs from a PEM Base64 text block
|
||||
:rtype: list of QSslCertificate
|
||||
%End
|
||||
|
||||
/** Return list of certificate, private key and algorithm (as PEM text) from file path components
|
||||
* @param certpath File path to certificate
|
||||
* @param keypath File path to private key
|
||||
* @param keypass Passphrase for private key
|
||||
* @param reencrypt Whether to re-encrypt the private key with the passphrase
|
||||
* @return certificate, private key, key's algorithm type
|
||||
*/
|
||||
static QStringList certKeyBundleToPem( const QString &certpath,
|
||||
const QString &keypath,
|
||||
const QString &keypass = QString(),
|
||||
bool reencrypt = true );
|
||||
%Docstring
|
||||
Return list of certificate, private key and algorithm (as PEM text) from file path components
|
||||
\param certpath File path to certificate
|
||||
\param keypath File path to private key
|
||||
\param keypass Passphrase for private key
|
||||
\param reencrypt Whether to re-encrypt the private key with the passphrase
|
||||
:return: certificate, private key, key's algorithm type
|
||||
:rtype: list of str
|
||||
%End
|
||||
|
||||
/** Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
|
||||
* @param bundlepath File path to the PKCS bundle
|
||||
* @param bundlepass Passphrase for bundle
|
||||
* @param reencrypt Whether to re-encrypt the private key with the passphrase
|
||||
* @return certificate, private key, key's algorithm type
|
||||
*/
|
||||
static QStringList pkcs12BundleToPem( const QString &bundlepath,
|
||||
const QString &bundlepass = QString(),
|
||||
bool reencrypt = true );
|
||||
%Docstring
|
||||
Return list of certificate, private key and algorithm (as PEM text) for a PKCS#12 bundle
|
||||
\param bundlepath File path to the PKCS bundle
|
||||
\param bundlepass Passphrase for bundle
|
||||
\param reencrypt Whether to re-encrypt the private key with the passphrase
|
||||
:return: certificate, private key, key's algorithm type
|
||||
:rtype: list of str
|
||||
%End
|
||||
|
||||
/** Write a temporary file for a PEM text of cert/key/CAs bundle component
|
||||
* @param pemtext Component content as PEM text
|
||||
* @param name Name of file
|
||||
* @return File path to temporary file
|
||||
*/
|
||||
static QString pemTextToTempFile( const QString &name, const QByteArray &pemtext );
|
||||
%Docstring
|
||||
Write a temporary file for a PEM text of cert/key/CAs bundle component
|
||||
\param pemtext Component content as PEM text
|
||||
\param name Name of file
|
||||
:return: File path to temporary file
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Get the general name for CA source enum type
|
||||
* @param source The enum source type for the CA
|
||||
* @param single Whether to return singular or plural description
|
||||
*/
|
||||
static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source , bool single = false );
|
||||
static QString getCaSourceName( QgsAuthCertUtils::CaCertSource source, bool single = false );
|
||||
%Docstring
|
||||
Get the general name for CA source enum type
|
||||
\param source The enum source type for the CA
|
||||
\param single Whether to return singular or plural description
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Get the general name via RFC 5280 resolution */
|
||||
static QString resolvedCertName( const QSslCertificate &cert, bool issuer = false );
|
||||
%Docstring
|
||||
Get the general name via RFC 5280 resolution
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Get combined distinguished name for certificate
|
||||
* @param qcert Qt SSL cert object
|
||||
* @param acert QCA SSL cert object to add more info to the output
|
||||
* @param issuer Whether to return cert's subject or issuer combined name
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QString getCertDistinguishedName( const QSslCertificate& qcert,
|
||||
// const QCA::Certificate& acert = QCA::Certificate(),
|
||||
// bool issuer = false );
|
||||
|
||||
/** Get the general name for certificate trust */
|
||||
static QString getCertTrustName( QgsAuthCertUtils::CertTrustPolicy trust );
|
||||
%Docstring
|
||||
Get the general name for certificate trust
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Get string with colon delimiters every 2 characters */
|
||||
static QString getColonDelimited( const QString &txt );
|
||||
%Docstring
|
||||
Get string with colon delimiters every 2 characters
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Get the sha1 hash for certificate
|
||||
* @param cert Qt SSL certificate to generate hash from
|
||||
* @param formatted Whether to colon-delimit the hash
|
||||
*/
|
||||
static QString shaHexForCert( const QSslCertificate &cert , bool formatted = false );
|
||||
static QString shaHexForCert( const QSslCertificate &cert, bool formatted = false );
|
||||
%Docstring
|
||||
Get the sha1 hash for certificate
|
||||
\param cert Qt SSL certificate to generate hash from
|
||||
\param formatted Whether to colon-delimit the hash
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Convert a QSslCertificate to a QCA::Certificate.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QCA::Certificate qtCertToQcaCert( const QSslCertificate &cert );
|
||||
|
||||
/** Convert a QList of QSslCertificate to a QCA::CertificateCollection.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QCA::CertificateCollection qtCertsToQcaCollection( const QList<QSslCertificate> &certs );
|
||||
|
||||
/** PKI key/cert bundle from file path, e.g. from .p12 or pfx files.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QCA::KeyBundle qcaKeyBundle( const QString &path, const QString &pass );
|
||||
|
||||
/** Certificate validity check messages per enum.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QString qcaValidityMessage( QCA::Validity validity );
|
||||
|
||||
/** Certificate signature algorithm strings per enum.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QString qcaSignatureAlgorithm( QCA::SignatureAlgorithm algorithm );
|
||||
|
||||
/** Certificate well-known constraint strings per enum.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QString qcaKnownConstraint( QCA::ConstraintTypeKnown constraint );
|
||||
|
||||
/** Certificate usage type strings per enum
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
static QString certificateUsageTypeString( QgsAuthCertUtils::CertUsageType usagetype );
|
||||
|
||||
/** Try to determine the certificates usage types */
|
||||
static QList<QgsAuthCertUtils::CertUsageType> certificateUsageTypes( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Try to determine the certificates usage types
|
||||
:rtype: list of QgsAuthCertUtils.CertUsageType
|
||||
%End
|
||||
|
||||
/** Get whether a certificate is an Authority */
|
||||
static bool certificateIsAuthority( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Get whether a certificate is an Authority
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Get whether a certificate can sign other certificates */
|
||||
static bool certificateIsIssuer( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Get whether a certificate can sign other certificates
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Get whether a certificate is an Authority or can at least sign other certificates */
|
||||
static bool certificateIsAuthorityOrIssuer( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Get whether a certificate is an Authority or can at least sign other certificates
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Get whether a certificate is probably used for a SSL server */
|
||||
static bool certificateIsSslServer( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Get whether a certificate is probably used for a SSL server
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Get whether a certificate is probably used for a client identity */
|
||||
static bool certificateIsSslClient( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Get whether a certificate is probably used for a client identity
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Get short strings describing an SSL error */
|
||||
static QString sslErrorEnumString( QSslError::SslError errenum );
|
||||
%Docstring
|
||||
Get short strings describing an SSL error
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
|
||||
/** Get short strings describing SSL errors.
|
||||
* @note not available in Python bindings
|
||||
*/
|
||||
// static QList<QPair<QSslError::SslError, QString> > sslErrorEnumStrings();
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/auth/qgsauthcertutils.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
@ -1,241 +1,355 @@
|
||||
/** \ingroup core
|
||||
* \brief Configuration storage class for authentication method configurations
|
||||
*/
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/auth/qgsauthconfig.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsAuthMethodConfig
|
||||
{
|
||||
%Docstring
|
||||
Configuration storage class for authentication method configurations
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsauthconfig.h>
|
||||
#include "qgsauthconfig.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct a configuration for an authentication method
|
||||
* @param method Textual key of the authentication method
|
||||
* @param version Version of the configuration (for updating previously saved configs later on)
|
||||
*/
|
||||
QgsAuthMethodConfig( const QString &method = QString(), int version = 0 );
|
||||
%Docstring
|
||||
Construct a configuration for an authentication method
|
||||
\param method Textual key of the authentication method
|
||||
\param version Version of the configuration (for updating previously saved configs later on)
|
||||
%End
|
||||
|
||||
/** Operator used to compare configs' equality */
|
||||
bool operator==( const QgsAuthMethodConfig &other ) const;
|
||||
|
||||
/** Operator used to compare configs' inequality */
|
||||
bool operator!=( const QgsAuthMethodConfig &other ) const;
|
||||
%Docstring
|
||||
Operator used to compare configs' inequality
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/**
|
||||
* Get 'authcfg' 7-character alphanumeric ID of the config
|
||||
* @note This is set by QgsAuthManager when the config is initially stored
|
||||
*/
|
||||
const QString id() const;
|
||||
/** Set auth config ID */
|
||||
%Docstring
|
||||
Get 'authcfg' 7-character alphanumeric ID of the config
|
||||
.. note::
|
||||
|
||||
This is set by QgsAuthManager when the config is initially stored
|
||||
:rtype: str
|
||||
%End
|
||||
void setId( const QString &id );
|
||||
%Docstring
|
||||
Set auth config ID
|
||||
%End
|
||||
|
||||
/** Get name of configuration */
|
||||
const QString name() const;
|
||||
/** Set name of configuration */
|
||||
%Docstring
|
||||
Get name of configuration
|
||||
:rtype: str
|
||||
%End
|
||||
void setName( const QString &name );
|
||||
%Docstring
|
||||
Set name of configuration
|
||||
%End
|
||||
|
||||
/** A URI to auto-select a config when connecting to a resource */
|
||||
const QString uri() const;
|
||||
%Docstring
|
||||
A URI to auto-select a config when connecting to a resource
|
||||
:rtype: str
|
||||
%End
|
||||
void setUri( const QString &uri );
|
||||
|
||||
/** Textual key of the associated authentication method */
|
||||
QString method() const;
|
||||
%Docstring
|
||||
Textual key of the associated authentication method
|
||||
:rtype: str
|
||||
%End
|
||||
void setMethod( const QString &method );
|
||||
|
||||
/** Get version of the configuration */
|
||||
int version() const;
|
||||
/** Set version of the configuration */
|
||||
%Docstring
|
||||
Get version of the configuration
|
||||
:rtype: int
|
||||
%End
|
||||
void setVersion( int version );
|
||||
%Docstring
|
||||
Set version of the configuration
|
||||
%End
|
||||
|
||||
/**
|
||||
* Whether the configuration is valid
|
||||
* @param validateid Additionally verify the auth config ID is not empty
|
||||
*/
|
||||
bool isValid( bool validateid = false ) const;
|
||||
%Docstring
|
||||
Whether the configuration is valid
|
||||
\param validateid Additionally verify the auth config ID is not empty
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/**
|
||||
* The extended configuration, as stored and retrieved from the authentication database
|
||||
* @note This is an internal construct used by QgsAuthManager that should generally not be set by client code
|
||||
*/
|
||||
const QString configString() const;
|
||||
/**
|
||||
* Load existing extended configuration
|
||||
* @param configstr Configuration string to load
|
||||
*/
|
||||
%Docstring
|
||||
The extended configuration, as stored and retrieved from the authentication database
|
||||
.. note::
|
||||
|
||||
This is an internal construct used by QgsAuthManager that should generally not be set by client code
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
void loadConfigString( const QString &configstr );
|
||||
%Docstring
|
||||
Load existing extended configuration
|
||||
\param configstr Configuration string to load
|
||||
%End
|
||||
|
||||
/** Get extended configuration, mapped to key/value pairs of QStrings */
|
||||
QgsStringMap configMap() const;
|
||||
/**
|
||||
* Set extended configuration map
|
||||
* @param map Map to set
|
||||
*/
|
||||
%Docstring
|
||||
Get extended configuration, mapped to key/value pairs of QStrings
|
||||
:rtype: QgsStringMap
|
||||
%End
|
||||
|
||||
void setConfigMap( const QgsStringMap &map );
|
||||
%Docstring
|
||||
Set extended configuration map
|
||||
\param map Map to set
|
||||
%End
|
||||
|
||||
/**
|
||||
* Set a single config value per key in the map
|
||||
* @note if key exists, it is replaced
|
||||
* @param key Config key
|
||||
* @param value Config value
|
||||
*/
|
||||
void setConfig( const QString &key, const QString &value );
|
||||
/**
|
||||
* Set a multiple config values per key in the map
|
||||
* @note if key exists, it is replaced
|
||||
* @param key Config key
|
||||
* @param value Config value
|
||||
*/
|
||||
%Docstring
|
||||
Set a single config value per key in the map
|
||||
.. note::
|
||||
|
||||
if key exists, it is replaced
|
||||
\param key Config key
|
||||
\param value Config value
|
||||
%End
|
||||
|
||||
void setConfigList( const QString &key, const QStringList &value );
|
||||
%Docstring
|
||||
Set a multiple config values per key in the map
|
||||
.. note::
|
||||
|
||||
if key exists, it is replaced
|
||||
\param key Config key
|
||||
\param value Config value
|
||||
%End
|
||||
|
||||
/**
|
||||
* Remove a config from map
|
||||
* @param key Config to remove
|
||||
* @return Number of keys removed (should always be 1 or 0)
|
||||
*/
|
||||
int removeConfig( const QString &key );
|
||||
%Docstring
|
||||
Remove a config from map
|
||||
\param key Config to remove
|
||||
:return: Number of keys removed (should always be 1 or 0)
|
||||
:rtype: int
|
||||
%End
|
||||
|
||||
/**
|
||||
* Return a config's value
|
||||
* @param key Config key
|
||||
* @param defaultvalue Default value, if key not found
|
||||
*/
|
||||
QString config( const QString &key, const QString &defaultvalue = QString() ) const;
|
||||
%Docstring
|
||||
Return a config's value
|
||||
\param key Config key
|
||||
\param defaultvalue Default value, if key not found
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/**
|
||||
* Return a config's list of values
|
||||
* @param key
|
||||
*/
|
||||
QStringList configList( const QString &key ) const;
|
||||
%Docstring
|
||||
Return a config's list of values
|
||||
\param key
|
||||
:rtype: list of str
|
||||
%End
|
||||
|
||||
/**
|
||||
* Whether a config key exists in config map
|
||||
* @param key
|
||||
*/
|
||||
bool hasConfig( const QString &key ) const;
|
||||
%Docstring
|
||||
Whether a config key exists in config map
|
||||
\param key
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Clear all configs */
|
||||
void clearConfigMap();
|
||||
%Docstring
|
||||
Clear all configs
|
||||
%End
|
||||
|
||||
/**
|
||||
* A utility function for generating a resource from a URL to be compared
|
||||
* against the config's uri() for auto-selecting authentication configs to use
|
||||
* @note Essentially strips the URL query variables, and by default, strips the path as well
|
||||
* @param accessurl A URL to process
|
||||
* @param resource Output variable for result
|
||||
* @param withpath Whether to include the URI's path in output
|
||||
*/
|
||||
static bool uriToResource( const QString &accessurl, QString *resource, bool withpath = false );
|
||||
%Docstring
|
||||
A utility function for generating a resource from a URL to be compared
|
||||
against the config's uri() for auto-selecting authentication configs to use
|
||||
.. note::
|
||||
|
||||
Essentially strips the URL query variables, and by default, strips the path as well
|
||||
\param accessurl A URL to process
|
||||
\param resource Output variable for result
|
||||
\param withpath Whether to include the URI's path in output
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
typedef QHash<QString, QgsAuthMethodConfig> QgsAuthMethodConfigsMap;
|
||||
|
||||
|
||||
/** \ingroup core
|
||||
* \brief Storage set for PKI bundle: SSL certificate, key, optional CA cert chain
|
||||
* \note Useful for caching the bundle during application run sessions
|
||||
*/
|
||||
|
||||
class QgsPkiBundle
|
||||
{
|
||||
%Docstring
|
||||
Storage set for PKI bundle: SSL certificate, key, optional CA cert chain
|
||||
.. note::
|
||||
|
||||
Useful for caching the bundle during application run sessions
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsauthconfig.h>
|
||||
#include "qgsauthconfig.h"
|
||||
%End
|
||||
public:
|
||||
/**
|
||||
* Construct a bundle from existing PKI components
|
||||
* @param clientCert Certificate to store in bundle
|
||||
* @param clientKey Private key to store in bundle
|
||||
* @param caChain Chain of Certificate Authorities for client certificate
|
||||
*/
|
||||
|
||||
QgsPkiBundle( const QSslCertificate &clientCert = QSslCertificate(),
|
||||
const QSslKey &clientKey = QSslKey(),
|
||||
const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
|
||||
%Docstring
|
||||
Construct a bundle from existing PKI components
|
||||
\param clientCert Certificate to store in bundle
|
||||
\param clientKey Private key to store in bundle
|
||||
\param caChain Chain of Certificate Authorities for client certificate
|
||||
%End
|
||||
|
||||
/**
|
||||
* Construct a bundle of PKI components from PEM-formatted file paths
|
||||
* @param certPath Certificate file path
|
||||
* @param keyPath Private key path
|
||||
* @param keyPass Private key passphrase
|
||||
* @param caChain Chain of Certificate Authorities for client certificate
|
||||
*/
|
||||
static const QgsPkiBundle fromPemPaths( const QString &certPath,
|
||||
const QString &keyPath,
|
||||
const QString &keyPass = QString::null,
|
||||
const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
|
||||
|
||||
/**
|
||||
* Construct a bundle of PKI components from a PKCS#12 file path
|
||||
* @param bundlepath Bundle file path
|
||||
* @param bundlepass Optional bundle passphrase
|
||||
*/
|
||||
static const QgsPkiBundle fromPkcs12Paths( const QString &bundlepath,
|
||||
const QString &bundlepass = QString::null );
|
||||
|
||||
/** Whether the bundle, either its certificate or private key, is null */
|
||||
bool isNull() const;
|
||||
|
||||
/** Whether the bundle is valid */
|
||||
bool isValid() const;
|
||||
|
||||
/** The sha hash of the client certificate */
|
||||
const QString certId() const;
|
||||
|
||||
/** Client certificate object */
|
||||
const QSslCertificate clientCert() const;
|
||||
/** Set client certificate object */
|
||||
void setClientCert( const QSslCertificate &cert );
|
||||
|
||||
/** Private key object */
|
||||
const QSslKey clientKey() const;
|
||||
/** Set private key object */
|
||||
void setClientKey( const QSslKey &certkey );
|
||||
|
||||
/** Chain of Certificate Authorities for client certificate */
|
||||
const QList<QSslCertificate> caChain() const;
|
||||
/** Set chain of Certificate Authorities for client certificate */
|
||||
void setCaChain( const QList<QSslCertificate> &cachain );
|
||||
};
|
||||
|
||||
|
||||
/** \ingroup core
|
||||
* \brief Storage set for constructed SSL certificate, key, associated with an authentication config
|
||||
*/
|
||||
class QgsPkiConfigBundle
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsauthconfig.h>
|
||||
%Docstring
|
||||
Construct a bundle of PKI components from PEM-formatted file paths
|
||||
\param certPath Certificate file path
|
||||
\param keyPath Private key path
|
||||
\param keyPass Private key passphrase
|
||||
\param caChain Chain of Certificate Authorities for client certificate
|
||||
:rtype: QgsPkiBundle
|
||||
%End
|
||||
|
||||
public:
|
||||
/**
|
||||
* Construct a bundle from existing PKI components and authentication method configuration
|
||||
* @param config Authentication method configuration
|
||||
* @param cert Certificate to store in bundle
|
||||
* @param certkey Private key to store in bundle
|
||||
*/
|
||||
QgsPkiConfigBundle( const QgsAuthMethodConfig& config,
|
||||
const QSslCertificate& cert,
|
||||
const QSslKey &certkey );
|
||||
static const QgsPkiBundle fromPkcs12Paths( const QString &bundlepath,
|
||||
const QString &bundlepass = QString::null );
|
||||
%Docstring
|
||||
Construct a bundle of PKI components from a PKCS#12 file path
|
||||
\param bundlepath Bundle file path
|
||||
\param bundlepass Optional bundle passphrase
|
||||
:rtype: QgsPkiBundle
|
||||
%End
|
||||
|
||||
/** Whether the bundle is valid */
|
||||
bool isValid();
|
||||
bool isNull() const;
|
||||
%Docstring
|
||||
Whether the bundle, either its certificate or private key, is null
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Authentication method configuration */
|
||||
const QgsAuthMethodConfig config() const;
|
||||
/** Set authentication method configuration */
|
||||
void setConfig( const QgsAuthMethodConfig &config );
|
||||
bool isValid() const;
|
||||
%Docstring
|
||||
Whether the bundle is valid
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
const QString certId() const;
|
||||
%Docstring
|
||||
The sha hash of the client certificate
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Client certificate object */
|
||||
const QSslCertificate clientCert() const;
|
||||
/** Set client certificate object */
|
||||
%Docstring
|
||||
Client certificate object
|
||||
:rtype: QSslCertificate
|
||||
%End
|
||||
void setClientCert( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Set client certificate object
|
||||
%End
|
||||
|
||||
const QSslKey clientKey() const;
|
||||
%Docstring
|
||||
Private key object
|
||||
:rtype: QSslKey
|
||||
%End
|
||||
void setClientKey( const QSslKey &certkey );
|
||||
%Docstring
|
||||
Set private key object
|
||||
%End
|
||||
|
||||
const QList<QSslCertificate> caChain() const;
|
||||
%Docstring
|
||||
Chain of Certificate Authorities for client certificate
|
||||
:rtype: list of QSslCertificate
|
||||
%End
|
||||
void setCaChain( const QList<QSslCertificate> &cachain );
|
||||
%Docstring
|
||||
Set chain of Certificate Authorities for client certificate
|
||||
%End
|
||||
|
||||
/** Private key object */
|
||||
const QSslKey clientCertKey() const;
|
||||
/** Set private key object */
|
||||
void setClientCertKey( const QSslKey &certkey );
|
||||
};
|
||||
|
||||
|
||||
class QgsPkiConfigBundle
|
||||
{
|
||||
%Docstring
|
||||
Storage set for constructed SSL certificate, key, associated with an authentication config
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsauthconfig.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
QgsPkiConfigBundle( const QgsAuthMethodConfig &config,
|
||||
const QSslCertificate &cert,
|
||||
const QSslKey &certkey );
|
||||
%Docstring
|
||||
Construct a bundle from existing PKI components and authentication method configuration
|
||||
\param config Authentication method configuration
|
||||
\param cert Certificate to store in bundle
|
||||
\param certkey Private key to store in bundle
|
||||
%End
|
||||
|
||||
bool isValid();
|
||||
%Docstring
|
||||
Whether the bundle is valid
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
const QgsAuthMethodConfig config() const;
|
||||
%Docstring
|
||||
Authentication method configuration
|
||||
:rtype: QgsAuthMethodConfig
|
||||
%End
|
||||
void setConfig( const QgsAuthMethodConfig &config );
|
||||
%Docstring
|
||||
Set authentication method configuration
|
||||
%End
|
||||
|
||||
const QSslCertificate clientCert() const;
|
||||
%Docstring
|
||||
Client certificate object
|
||||
:rtype: QSslCertificate
|
||||
%End
|
||||
void setClientCert( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Set client certificate object
|
||||
%End
|
||||
|
||||
const QSslKey clientCertKey() const;
|
||||
%Docstring
|
||||
Private key object
|
||||
:rtype: QSslKey
|
||||
%End
|
||||
void setClientCertKey( const QSslKey &certkey );
|
||||
%Docstring
|
||||
Set private key object
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
%MappedType QList<QSslError::SslError>
|
||||
{
|
||||
%TypeHeaderCode
|
||||
@ -246,21 +360,21 @@ class QgsPkiConfigBundle
|
||||
// Create the list.
|
||||
PyObject *l;
|
||||
|
||||
if ((l = PyList_New(sipCpp->size())) == NULL)
|
||||
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
|
||||
return NULL;
|
||||
|
||||
// Set the list elements.
|
||||
QList<QSslError::SslError>::iterator it = sipCpp->begin();
|
||||
for (int i = 0; it != sipCpp->end(); ++it, ++i)
|
||||
for ( int i = 0; it != sipCpp->end(); ++it, ++i )
|
||||
{
|
||||
PyObject *tobj;
|
||||
|
||||
if ((tobj = sipConvertFromEnum(*it, sipType_QSslError_SslError)) == NULL)
|
||||
if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
|
||||
{
|
||||
Py_DECREF(l);
|
||||
Py_DECREF( l );
|
||||
return NULL;
|
||||
}
|
||||
PyList_SET_ITEM(l, i, tobj);
|
||||
PyList_SET_ITEM( l, i, tobj );
|
||||
}
|
||||
|
||||
return l;
|
||||
@ -268,87 +382,152 @@ class QgsPkiConfigBundle
|
||||
|
||||
%ConvertToTypeCode
|
||||
// Check the type if that is all that is required.
|
||||
if (sipIsErr == NULL)
|
||||
return PyList_Check(sipPy);
|
||||
if ( sipIsErr == NULL )
|
||||
return PyList_Check( sipPy );
|
||||
|
||||
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
|
||||
|
||||
for (int i = 0; i < PyList_GET_SIZE(sipPy); ++i)
|
||||
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
|
||||
{
|
||||
*qlist << (QSslError::SslError)SIPLong_AsLong(PyList_GET_ITEM(sipPy, i));
|
||||
*qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
|
||||
}
|
||||
|
||||
*sipCppPtr = qlist;
|
||||
return sipGetState(sipTransferObj);
|
||||
return sipGetState( sipTransferObj );
|
||||
%End
|
||||
};
|
||||
|
||||
|
||||
/** \ingroup core
|
||||
* \brief Configuration container for SSL server connection exceptions or overrides
|
||||
*/
|
||||
|
||||
class QgsAuthConfigSslServer
|
||||
{
|
||||
%Docstring
|
||||
Configuration container for SSL server connection exceptions or overrides
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include <qgsauthconfig.h>
|
||||
#include "qgsauthconfig.h"
|
||||
%End
|
||||
public:
|
||||
QgsAuthConfigSslServer();
|
||||
%Docstring
|
||||
Construct a default SSL server configuration
|
||||
%End
|
||||
|
||||
~QgsAuthConfigSslServer();
|
||||
|
||||
/** Server certificate object */
|
||||
const QSslCertificate sslCertificate() const;
|
||||
/** Set server certificate object */
|
||||
%Docstring
|
||||
Server certificate object
|
||||
:rtype: QSslCertificate
|
||||
%End
|
||||
void setSslCertificate( const QSslCertificate &cert );
|
||||
%Docstring
|
||||
Set server certificate object
|
||||
%End
|
||||
|
||||
/** Server host:port string */
|
||||
const QString sslHostPort() const;
|
||||
/** Set server host:port string */
|
||||
%Docstring
|
||||
Server host:port string
|
||||
:rtype: str
|
||||
%End
|
||||
void setSslHostPort( const QString &hostport );
|
||||
%Docstring
|
||||
Set server host:port string
|
||||
%End
|
||||
|
||||
/** SSL server protocol to use in connections */
|
||||
QSsl::SslProtocol sslProtocol() const;
|
||||
/** Set SSL server protocol to use in connections */
|
||||
%Docstring
|
||||
SSL server protocol to use in connections
|
||||
:rtype: QSsl.SslProtocol
|
||||
%End
|
||||
void setSslProtocol( QSsl::SslProtocol protocol );
|
||||
%Docstring
|
||||
Set SSL server protocol to use in connections
|
||||
%End
|
||||
|
||||
/** SSL server errors to ignore in connections */
|
||||
const QList<QSslError> sslIgnoredErrors() const;
|
||||
/** SSL server errors (as enum list) to ignore in connections */
|
||||
%Docstring
|
||||
SSL server errors to ignore in connections
|
||||
:rtype: list of QSslError
|
||||
%End
|
||||
const QList<QSslError::SslError> sslIgnoredErrorEnums() const;
|
||||
/** Set SSL server errors (as enum list) to ignore in connections */
|
||||
%Docstring
|
||||
SSL server errors (as enum list) to ignore in connections
|
||||
:rtype: list of QSslError.SslError
|
||||
%End
|
||||
void setSslIgnoredErrorEnums( const QList<QSslError::SslError> &errors );
|
||||
%Docstring
|
||||
Set SSL server errors (as enum list) to ignore in connections
|
||||
%End
|
||||
|
||||
/** SSL client's peer verify mode to use in connections */
|
||||
QSslSocket::PeerVerifyMode sslPeerVerifyMode() const;
|
||||
/** Set SSL client's peer verify mode to use in connections */
|
||||
%Docstring
|
||||
SSL client's peer verify mode to use in connections
|
||||
:rtype: QSslSocket.PeerVerifyMode
|
||||
%End
|
||||
void setSslPeerVerifyMode( QSslSocket::PeerVerifyMode mode );
|
||||
%Docstring
|
||||
Set SSL client's peer verify mode to use in connections
|
||||
%End
|
||||
|
||||
/** Number or SSL client's peer to verify in connections
|
||||
* @note When set to 0 = unlimited depth
|
||||
*/
|
||||
int sslPeerVerifyDepth() const;
|
||||
/** Set number or SSL client's peer to verify in connections
|
||||
* @note When set to 0 = unlimited depth
|
||||
*/
|
||||
%Docstring
|
||||
Number or SSL client's peer to verify in connections
|
||||
.. note::
|
||||
|
||||
When set to 0 = unlimited depth
|
||||
:rtype: int
|
||||
%End
|
||||
|
||||
void setSslPeerVerifyDepth( int depth );
|
||||
%Docstring
|
||||
Set number or SSL client's peer to verify in connections
|
||||
.. note::
|
||||
|
||||
When set to 0 = unlimited depth
|
||||
%End
|
||||
|
||||
/** Version of the configuration (used for future upgrading) */
|
||||
int version() const;
|
||||
/** Set version of the configuration (used for future upgrading) */
|
||||
%Docstring
|
||||
Version of the configuration (used for future upgrading)
|
||||
:rtype: int
|
||||
%End
|
||||
void setVersion( int version );
|
||||
%Docstring
|
||||
Set version of the configuration (used for future upgrading)
|
||||
%End
|
||||
|
||||
/** Qt version when the configuration was made (SSL protocols may differ) */
|
||||
int qtVersion() const;
|
||||
/** Set Qt version when the configuration was made (SSL protocols may differ) */
|
||||
%Docstring
|
||||
Qt version when the configuration was made (SSL protocols may differ)
|
||||
:rtype: int
|
||||
%End
|
||||
void setQtVersion( int version );
|
||||
%Docstring
|
||||
Set Qt version when the configuration was made (SSL protocols may differ)
|
||||
%End
|
||||
|
||||
/** Configuration as a concatenated string */
|
||||
const QString configString() const;
|
||||
/** Load concatenated string into configuration, e.g. from auth database */
|
||||
%Docstring
|
||||
Configuration as a concatenated string
|
||||
:rtype: str
|
||||
%End
|
||||
void loadConfigString( const QString &config = QString() );
|
||||
%Docstring
|
||||
Load concatenated string into configuration, e.g. from auth database
|
||||
%End
|
||||
|
||||
/** Whether configuration is null (missing components) */
|
||||
bool isNull() const;
|
||||
%Docstring
|
||||
Whether configuration is null (missing components)
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/auth/qgsauthconfig.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,21 +1,29 @@
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/auth/qgsauthmethod.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class QgsAuthMethod : QObject
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsauthmethod.h>
|
||||
%Docstring
|
||||
Abstract base class for authentication method plugins
|
||||
%End
|
||||
|
||||
%TypeHeaderCode
|
||||
#include "qgsauthmethod.h"
|
||||
%End
|
||||
public:
|
||||
|
||||
/** Flags that represent the update points (where authentication configurations are expanded)
|
||||
* supported by an authentication method. These equate to the 'update*()' virtual functions
|
||||
* below, and allow for update point code to skip calling an unused update by a method, because
|
||||
* the base virtual function will always return true, giving a false impression an update occurred.
|
||||
* @note When adding an 'update' member function, also add the corresponding Expansion flag.
|
||||
* @note These flags will be added to as new update points are added
|
||||
*/
|
||||
enum Expansion
|
||||
{
|
||||
// TODO: Figure out all different authentication expansions current layer providers use
|
||||
// TODO
|
||||
NetworkRequest,
|
||||
NetworkReply,
|
||||
DataSourceUri,
|
||||
@ -24,90 +32,142 @@ class QgsAuthMethod : QObject
|
||||
};
|
||||
typedef QFlags<QgsAuthMethod::Expansion> Expansions;
|
||||
|
||||
virtual ~QgsAuthMethod();
|
||||
|
||||
/** A non-translated short name representing the auth method */
|
||||
virtual QString key() const = 0;
|
||||
%Docstring
|
||||
A non-translated short name representing the auth method
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** A non-translated short description representing the auth method for use in debug output and About dialog */
|
||||
virtual QString description() const = 0;
|
||||
%Docstring
|
||||
A non-translated short description representing the auth method for use in debug output and About dialog
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Translatable display version of the 'description()' */
|
||||
virtual QString displayDescription() const = 0;
|
||||
%Docstring
|
||||
Translatable display version of the 'description()'
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg */
|
||||
int version() const;
|
||||
%Docstring
|
||||
Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg
|
||||
:rtype: int
|
||||
%End
|
||||
|
||||
/** Flags that represent the update points (where authentication configurations are expanded)
|
||||
* supported by an authentication method.
|
||||
* @note These should directly correlate to existing 'update*()' member functions
|
||||
*/
|
||||
QgsAuthMethod::Expansions supportedExpansions() const;
|
||||
%Docstring
|
||||
Flags that represent the update points (where authentication configurations are expanded)
|
||||
supported by an authentication method.
|
||||
.. note::
|
||||
|
||||
These should directly correlate to existing 'update*()' member functions
|
||||
:rtype: QgsAuthMethod.Expansions
|
||||
%End
|
||||
|
||||
/** The data providers that the method supports, allowing for filtering out authcfgs that are not
|
||||
* applicable to a given provider, or where the updating code is not currently implemented.
|
||||
*/
|
||||
QStringList supportedDataProviders() const;
|
||||
%Docstring
|
||||
The data providers that the method supports, allowing for filtering out authcfgs that are not
|
||||
applicable to a given provider, or where the updating code is not currently implemented.
|
||||
:rtype: list of str
|
||||
%End
|
||||
|
||||
/** Update a network request with authentication components
|
||||
* @param request The network request to update
|
||||
* @param authcfg Authentication configuration ID
|
||||
* @param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
|
||||
* for custom updater code specific to the provider
|
||||
* @return Whether the update succeeded
|
||||
*/
|
||||
virtual bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
|
||||
const QString &dataprovider = QString() );
|
||||
%Docstring
|
||||
Update a network request with authentication components
|
||||
\param request The network request to update
|
||||
\param authcfg Authentication configuration ID
|
||||
\param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
|
||||
for custom updater code specific to the provider
|
||||
:return: Whether the update succeeded
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Update a network reply with authentication components
|
||||
* @param reply The network reply object to update
|
||||
* @param authcfg Authentication configuration ID
|
||||
* @param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
|
||||
* for custom updater code specific to the provider
|
||||
* @return Whether the update succeeded
|
||||
*/
|
||||
virtual bool updateNetworkReply( QNetworkReply *reply, const QString &authcfg,
|
||||
const QString &dataprovider = QString() );
|
||||
%Docstring
|
||||
Update a network reply with authentication components
|
||||
\param reply The network reply object to update
|
||||
\param authcfg Authentication configuration ID
|
||||
\param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
|
||||
for custom updater code specific to the provider
|
||||
:return: Whether the update succeeded
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Update data source connection items with authentication components
|
||||
* @param connectionItems QStringlist of 'key=value' pairs, as utilized in QgsDataSourceUri::connectionInfo()
|
||||
* @param authcfg Authentication configuration ID
|
||||
* @param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
|
||||
* for custom updater code specific to the provider
|
||||
* @return Whether the update succeeded
|
||||
*/
|
||||
virtual bool updateDataSourceUriItems( QStringList &connectionItems, const QString &authcfg,
|
||||
const QString &dataprovider = QString() );
|
||||
%Docstring
|
||||
Update data source connection items with authentication components
|
||||
\param connectionItems QStringlist of 'key=value' pairs, as utilized in QgsDataSourceUri.connectionInfo()
|
||||
\param authcfg Authentication configuration ID
|
||||
\param dataprovider Textual key for a data provider, e.g. 'postgres', that allows
|
||||
for custom updater code specific to the provider
|
||||
:return: Whether the update succeeded
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
/** Clear any cached configuration. Called when the QgsAuthManager deletes an authentication configuration (authcfg).
|
||||
* @note It is highly recommended that a cache of authentication components (per requested authcfg)
|
||||
* be implemented, to avoid excessive queries on the auth database. Such a cache could be as
|
||||
* simple as a QHash or QMap of authcfg -> QgsAuthMethodConfig. See 'Basic' auth method plugin for example.
|
||||
*/
|
||||
virtual void clearCachedConfig( const QString &authcfg ) = 0;
|
||||
%Docstring
|
||||
Clear any cached configuration. Called when the QgsAuthManager deletes an authentication configuration (authcfg).
|
||||
.. note::
|
||||
|
||||
It is highly recommended that a cache of authentication components (per requested authcfg)
|
||||
be implemented, to avoid excessive queries on the auth database. Such a cache could be as
|
||||
simple as a QHash or QMap of authcfg -> QgsAuthMethodConfig. See 'Basic' auth method plugin for example.
|
||||
%End
|
||||
|
||||
/** Update an authentication configuration in place
|
||||
* @note Useful for updating previously stored authcfgs, when an authentication method has been significantly updated
|
||||
*/
|
||||
virtual void updateMethodConfig( QgsAuthMethodConfig &mconfig ) = 0;
|
||||
%Docstring
|
||||
Update an authentication configuration in place
|
||||
.. note::
|
||||
|
||||
Useful for updating previously stored authcfgs, when an authentication method has been significantly updated
|
||||
%End
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Construct a default authentication method
|
||||
* @note Non-public since this is an abstract base class
|
||||
*/
|
||||
|
||||
explicit QgsAuthMethod();
|
||||
%Docstring
|
||||
Construct a default authentication method
|
||||
.. note::
|
||||
|
||||
Non-public since this is an abstract base class
|
||||
%End
|
||||
|
||||
/** Tag signifying that this is an authentcation method (e.g. for use as title in message log panel output) */
|
||||
static QString authMethodTag();
|
||||
%Docstring
|
||||
Tag signifying that this is an authentcation method (e.g. for use as title in message log panel output)
|
||||
:rtype: str
|
||||
%End
|
||||
|
||||
/** Set the version of the auth method (useful for future upgrading) */
|
||||
void setVersion( int version );
|
||||
%Docstring
|
||||
Set the version of the auth method (useful for future upgrading)
|
||||
%End
|
||||
|
||||
/** Set the support expansions (points in providers where the authentication is injected) of the auth method */
|
||||
void setExpansions( QgsAuthMethod::Expansions expansions );
|
||||
/** Set list of data providers this auth method supports */
|
||||
%Docstring
|
||||
Set the support expansions (points in providers where the authentication is injected) of the auth method
|
||||
%End
|
||||
void setDataProviders( const QStringList &dataproviders );
|
||||
};
|
||||
%Docstring
|
||||
Set list of data providers this auth method supports
|
||||
%End
|
||||
|
||||
typedef QHash<QString, QgsAuthMethod*> QgsAuthMethodsMap;
|
||||
};
|
||||
QFlags<QgsAuthMethod::Expansion> operator|(QgsAuthMethod::Expansion f1, QFlags<QgsAuthMethod::Expansion> f2);
|
||||
|
||||
|
||||
typedef QHash<QString, QgsAuthMethod *> QgsAuthMethodsMap;
|
||||
|
||||
/************************************************************************
|
||||
* This file has been generated automatically from *
|
||||
* *
|
||||
* src/core/auth/qgsauthmethod.h *
|
||||
* *
|
||||
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||
************************************************************************/
|
||||
|
||||
@ -291,6 +291,58 @@ class CORE_EXPORT QgsPkiConfigBundle
|
||||
};
|
||||
|
||||
|
||||
|
||||
#ifdef SIP_RUN
|
||||
% MappedType QList<QSslError::SslError>
|
||||
{
|
||||
% TypeHeaderCode
|
||||
#include <QList>
|
||||
% End
|
||||
|
||||
% ConvertFromTypeCode
|
||||
// Create the list.
|
||||
PyObject *l;
|
||||
|
||||
if ( ( l = PyList_New( sipCpp->size() ) ) == NULL )
|
||||
return NULL;
|
||||
|
||||
// Set the list elements.
|
||||
QList<QSslError::SslError>::iterator it = sipCpp->begin();
|
||||
for ( int i = 0; it != sipCpp->end(); ++it, ++i )
|
||||
{
|
||||
PyObject *tobj;
|
||||
|
||||
if ( ( tobj = sipConvertFromEnum( *it, sipType_QSslError_SslError ) ) == NULL )
|
||||
{
|
||||
Py_DECREF( l );
|
||||
return NULL;
|
||||
}
|
||||
PyList_SET_ITEM( l, i, tobj );
|
||||
}
|
||||
|
||||
return l;
|
||||
% End
|
||||
|
||||
% ConvertToTypeCode
|
||||
// Check the type if that is all that is required.
|
||||
if ( sipIsErr == NULL )
|
||||
return PyList_Check( sipPy );
|
||||
|
||||
QList<QSslError::SslError> *qlist = new QList<QSslError::SslError>;
|
||||
|
||||
for ( int i = 0; i < PyList_GET_SIZE( sipPy ); ++i )
|
||||
{
|
||||
*qlist << ( QSslError::SslError )SIPLong_AsLong( PyList_GET_ITEM( sipPy, i ) );
|
||||
}
|
||||
|
||||
*sipCppPtr = qlist;
|
||||
return sipGetState( sipTransferObj );
|
||||
% End
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/** \ingroup core
|
||||
* \brief Configuration container for SSL server connection exceptions or overrides
|
||||
*/
|
||||
|
||||
@ -41,10 +41,12 @@
|
||||
// Qt5KeyChain library
|
||||
#include "keychain.h"
|
||||
|
||||
#ifndef SIP_RUN
|
||||
namespace QCA
|
||||
{
|
||||
class Initializer;
|
||||
}
|
||||
#endif
|
||||
class QgsAuthMethod;
|
||||
class QgsAuthMethodEdit;
|
||||
class QgsAuthProvider;
|
||||
@ -142,7 +144,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* \param keepbackup Whether to keep the generated backup of current database
|
||||
* \param backuppath Where the backup is located, if kept
|
||||
*/
|
||||
bool resetMasterPassword( const QString &newpass, const QString &oldpass, bool keepbackup, QString *backuppath = nullptr );
|
||||
bool resetMasterPassword( const QString &newpass, const QString &oldpass, bool keepbackup, QString *backuppath SIP_INOUT = nullptr );
|
||||
|
||||
/** Whether there is a scheduled opitonal erase of authentication database.
|
||||
* \note not available in Python bindings
|
||||
@ -252,7 +254,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* \param mconfig Associated authentication config id
|
||||
* \returns Whether operation succeeded
|
||||
*/
|
||||
bool storeAuthenticationConfig( QgsAuthMethodConfig &mconfig );
|
||||
bool storeAuthenticationConfig( QgsAuthMethodConfig &mconfig SIP_INOUT );
|
||||
|
||||
/**
|
||||
* Update an authentication config in the database
|
||||
@ -268,7 +270,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* \param full Whether to decrypt and populate all sensitive data in subclass
|
||||
* \returns Whether operation succeeded
|
||||
*/
|
||||
bool loadAuthenticationConfig( const QString &authcfg, QgsAuthMethodConfig &mconfig, bool full = false );
|
||||
bool loadAuthenticationConfig( const QString &authcfg, QgsAuthMethodConfig &mconfig SIP_INOUT, bool full = false );
|
||||
|
||||
/**
|
||||
* Remove an authentication config in the database
|
||||
@ -287,7 +289,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* Close connection to current authentication database and back it up
|
||||
* \returns Path to backup
|
||||
*/
|
||||
bool backupAuthenticationDatabase( QString *backuppath = nullptr );
|
||||
bool backupAuthenticationDatabase( QString *backuppath SIP_INOUT = nullptr );
|
||||
|
||||
/**
|
||||
* Erase all rows from all tables in authentication database
|
||||
@ -295,7 +297,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* \param backuppath Where the backup is locate
|
||||
* \returns Whether operation succeeded
|
||||
*/
|
||||
bool eraseAuthenticationDatabase( bool backup, QString *backuppath = nullptr );
|
||||
bool eraseAuthenticationDatabase( bool backup, QString *backuppath SIP_INOUT = nullptr );
|
||||
|
||||
|
||||
////////////////// Auth Method calls ///////////////////////
|
||||
@ -307,7 +309,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* \param dataprovider Provider key filter, offering logic branching in authentication method
|
||||
* \returns Whether operation succeeded
|
||||
*/
|
||||
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
|
||||
bool updateNetworkRequest( QNetworkRequest &request SIP_INOUT, const QString &authcfg,
|
||||
const QString &dataprovider = QString() );
|
||||
|
||||
/**
|
||||
@ -327,7 +329,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* \param dataprovider Provider key filter, offering logic branching in authentication method
|
||||
* \returns Whether operation succeeded
|
||||
*/
|
||||
bool updateDataSourceUriItems( QStringList &connectionItems, const QString &authcfg,
|
||||
bool updateDataSourceUriItems( QStringList &connectionItems SIP_INOUT, const QString &authcfg,
|
||||
const QString &dataprovider = QString() );
|
||||
|
||||
////////////////// Generic settings ///////////////////////
|
||||
@ -555,7 +557,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* \param tag Associated tag (title)
|
||||
* \param level Message log level
|
||||
*/
|
||||
void messageOut( const QString &message, const QString &tag = AUTH_MAN_TAG, QgsAuthManager::MessageLevel level = INFO ) const;
|
||||
void messageOut( const QString &message, const QString &tag = QgsAuthManager::AUTH_MAN_TAG, QgsAuthManager::MessageLevel level = QgsAuthManager::INFO ) const;
|
||||
|
||||
/**
|
||||
* Custom logging signal to inform the user about master password <-> password manager interactions
|
||||
@ -564,7 +566,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
|
||||
* @param tag Associated tag (title)
|
||||
* @param level Message log level
|
||||
*/
|
||||
void passwordHelperMessageOut( const QString &message, const QString &tag = AUTH_MAN_TAG, QgsAuthManager::MessageLevel level = INFO ) const;
|
||||
void passwordHelperMessageOut( const QString &message, const QString &tag = QgsAuthManager::AUTH_MAN_TAG, QgsAuthManager::MessageLevel level = QgsAuthManager::INFO ) const;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user