QGIS/python/core/auto_generated/auth/qgsauthconfig.sip.in

616 lines
14 KiB
Plaintext

/************************************************************************
* This file has been generated automatically from *
* *
* src/core/auth/qgsauthconfig.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsAuthMethodConfig
{
%Docstring(signature="appended")
Configuration storage class for authentication method configurations.
%End
%TypeHeaderCode
#include "qgsauthconfig.h"
%End
public:
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
bool operator==( const QgsAuthMethodConfig &other ) const;
bool operator!=( const QgsAuthMethodConfig &other ) const;
const QString id() const;
%Docstring
Gets 'authcfg' 7-character alphanumeric ID of the config
.. note::
This is set by :py:class:`QgsAuthManager` when the config is initially stored
%End
void setId( const QString &id );
%Docstring
Sets auth config ID
%End
const QString name() const;
%Docstring
Gets name of configuration
%End
void setName( const QString &name );
%Docstring
Sets name of configuration
%End
const QString uri() const;
%Docstring
A URI to auto-select a config when connecting to a resource
%End
void setUri( const QString &uri );
QString method() const;
%Docstring
Textual key of the associated authentication method
%End
void setMethod( const QString &method );
int version() const;
%Docstring
Gets version of the configuration
%End
void setVersion( int version );
%Docstring
Sets version of the configuration
%End
bool isValid( bool validateid = false ) const;
%Docstring
Whether the configuration is valid
:param validateid: Additionally verify the auth config ID is not empty
%End
const QString configString() const;
%Docstring
The extended configuration, as stored and retrieved from the
authentication database
.. note::
This is an internal construct used by :py:class:`QgsAuthManager` that should generally not be set by client code
%End
void loadConfigString( const QString &configstr );
%Docstring
Load existing extended configuration
:param configstr: Configuration string to load
%End
QgsStringMap configMap() const;
%Docstring
Gets extended configuration, mapped to key/value pairs of QStrings
%End
void setConfigMap( const QgsStringMap &map );
%Docstring
Set extended configuration map
:param map: Map to set
%End
void setConfig( const QString &key, const QString &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
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)
%End
QString config( const QString &key, const QString &defaultvalue = QString() ) const;
%Docstring
Returns a config's value
:param key: Config key
:param defaultvalue: Default value, if key not found
%End
QStringList configList( const QString &key ) const;
%Docstring
Returns a config's list of values
:param key:
%End
bool hasConfig( const QString &key ) const;
%Docstring
Whether a config key exists in config map
:param key:
%End
void clearConfigMap();
%Docstring
Clear all configs
%End
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 :py:func:`~QgsAuthMethodConfig.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
%End
bool writeXml( QDomElement &parentElement, QDomDocument &document );
%Docstring
Stores the configuration in a DOM
:param parentElement: parent DOM element
:param document: DOM document
.. seealso:: :py:func:`readXml`
.. versionadded:: 3.20
%End
bool readXml( const QDomElement &element );
%Docstring
from a DOM element.
:param element: is the DOM node corresponding to item (e.g. 'LayoutItem'
element)
.. versionadded:: 3.20
%End
};
typedef QHash<QString, QgsAuthMethodConfig> QgsAuthMethodConfigsMap;
class QgsPkiBundle
{
%Docstring(signature="appended")
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"
%End
public:
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
static const QgsPkiBundle fromPemPaths( const QString &certPath,
const QString &keyPath,
const QString &keyPass = QString(),
const QList<QSslCertificate> &caChain = QList<QSslCertificate>() );
%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
%End
static const QgsPkiBundle fromPkcs12Paths( const QString &bundlepath,
const QString &bundlepass = QString() );
%Docstring
Construct a bundle of PKI components from a PKCS#12 file path
:param bundlepath: Bundle file path
:param bundlepass: Optional bundle passphrase
%End
bool isNull() const;
%Docstring
Whether the bundle, either its certificate or private key, is null
%End
bool isValid() const;
%Docstring
Whether the bundle is valid
%End
const QString certId() const;
%Docstring
The sha hash of the client certificate
%End
const QSslCertificate clientCert() const;
%Docstring
Client certificate object
%End
void setClientCert( const QSslCertificate &cert );
%Docstring
Sets client certificate object
%End
const QSslKey clientKey() const;
%Docstring
Private key object
%End
void setClientKey( const QSslKey &certkey );
%Docstring
Sets private key object
%End
const QList<QSslCertificate> caChain() const;
%Docstring
Chain of Certificate Authorities for client certificate
%End
void setCaChain( const QList<QSslCertificate> &cachain );
%Docstring
Sets chain of Certificate Authorities for client certificate
%End
};
class QgsPkiConfigBundle
{
%Docstring(signature="appended")
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,
const QList<QSslCertificate> &cachain = QList<QSslCertificate>( ) );
%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
:param cachain: list of CA certificates
%End
bool isValid();
%Docstring
Whether the bundle is valid
%End
const QgsAuthMethodConfig config() const;
%Docstring
Authentication method configuration
%End
void setConfig( const QgsAuthMethodConfig &config );
%Docstring
Sets authentication method configuration
%End
const QSslCertificate clientCert() const;
%Docstring
Client certificate object
%End
void setClientCert( const QSslCertificate &cert );
%Docstring
Sets client certificate object
%End
const QSslKey clientCertKey() const;
%Docstring
Private key object
%End
void setClientCertKey( const QSslKey &certkey );
%Docstring
Sets private key object
%End
QList<QSslCertificate> caChain() const;
%Docstring
caChain return the CA chain
:return: list of CA certificates
%End
void setCaChain( const QList<QSslCertificate> &caChain );
%Docstring
setCaChain set the CA chain
:param caChain:
%End
};
%MappedType QList<QSslError::SslError> /TypeHintIn = "Iterable[QSslError.SslError]",TypeHintOut = "List[QSslError.SslError]", TypeHintValue = "[]"/
{
%TypeHeaderCode
#include <QList>
#include <QSslError>
%End
%ConvertFromTypeCode
PyObject *l = PyList_New( sipCpp->size() );
if ( !l )
return 0;
for ( int i = 0; i < sipCpp->size(); ++i )
{
PyObject *eobj = sipConvertFromEnum( static_cast<int>( sipCpp->at( i ) ), sipType_QSslError_SslError );
if ( !eobj )
{
Py_DECREF( l );
return 0;
}
PyList_SetItem( l, i, eobj );
}
return l;
%End
%ConvertToTypeCode
PyObject *iter = PyObject_GetIter( sipPy );
if ( !sipIsErr )
{
PyErr_Clear();
Py_XDECREF( iter );
return ( iter && !PyBytes_Check( sipPy ) && !PyUnicode_Check( sipPy ) );
}
if ( !iter )
{
*sipIsErr = 1;
return 0;
}
QList<QSslError::SslError> *ql = new QList<QSslError::SslError>;
for ( Py_ssize_t i = 0;; ++i )
{
PyErr_Clear();
PyObject *itm = PyIter_Next( iter );
if ( !itm )
{
if ( PyErr_Occurred() )
{
delete ql;
Py_DECREF( iter );
*sipIsErr = 1;
return 0;
}
break;
}
int v = sipConvertToEnum( itm, sipType_QSslError_SslError );
if ( PyErr_Occurred() )
{
PyErr_Format( PyExc_TypeError, "index %zd has type '%s' but 'QSslError.SslError' is expected", i, sipPyTypeName( Py_TYPE( itm ) ) );
Py_DECREF( itm );
delete ql;
Py_DECREF( iter );
*sipIsErr = 1;
return 0;
}
ql->append( static_cast<QSslError::SslError>( v ) );
Py_DECREF( itm );
}
Py_DECREF( iter );
*sipCppPtr = ql;
return sipGetState( sipTransferObj );
%End
};
class QgsAuthConfigSslServer
{
%Docstring(signature="appended")
Configuration container for SSL server connection exceptions or
overrides.
%End
%TypeHeaderCode
#include "qgsauthconfig.h"
%End
public:
QgsAuthConfigSslServer();
%Docstring
Construct a default SSL server configuration
%End
const QSslCertificate sslCertificate() const;
%Docstring
Server certificate object
%End
void setSslCertificate( const QSslCertificate &cert );
%Docstring
Sets server certificate object
%End
const QString sslHostPort() const;
%Docstring
Server host:port string
%End
void setSslHostPort( const QString &hostport );
%Docstring
Sets server host:port string
%End
QSsl::SslProtocol sslProtocol() const;
%Docstring
SSL server protocol to use in connections
%End
void setSslProtocol( QSsl::SslProtocol protocol );
%Docstring
Sets SSL server protocol to use in connections
%End
const QList<QSslError> sslIgnoredErrors() const;
%Docstring
SSL server errors to ignore in connections
%End
const QList<QSslError::SslError> sslIgnoredErrorEnums() const;
%Docstring
SSL server errors (as enum list) to ignore in connections
%End
void setSslIgnoredErrorEnums( const QList<QSslError::SslError> &errors );
%Docstring
Sets SSL server errors (as enum list) to ignore in connections
%End
QSslSocket::PeerVerifyMode sslPeerVerifyMode() const;
%Docstring
SSL client's peer verify mode to use in connections
%End
void setSslPeerVerifyMode( QSslSocket::PeerVerifyMode mode );
%Docstring
Sets SSL client's peer verify mode to use in connections
%End
int sslPeerVerifyDepth() const;
%Docstring
Number or SSL client's peer to verify in connections
.. note::
When set to 0 = unlimited depth
%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
int version() const;
%Docstring
Version of the configuration (used for future upgrading)
%End
void setVersion( int version );
%Docstring
Sets version of the configuration (used for future upgrading)
%End
int qtVersion() const;
%Docstring
Qt version when the configuration was made (SSL protocols may differ)
%End
void setQtVersion( int version );
%Docstring
Sets Qt version when the configuration was made (SSL protocols may
differ)
%End
const QString configString() const;
%Docstring
Configuration as a concatenated string
%End
void loadConfigString( const QString &config = QString() );
%Docstring
Load concatenated string into configuration, e.g. from auth database
%End
bool isNull() const;
%Docstring
Whether configuration is null (missing components)
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/auth/qgsauthconfig.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/