mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
537 lines
12 KiB
Plaintext
537 lines
12 KiB
Plaintext
/************************************************************************
|
|
* 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"
|
|
%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 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 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 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
|
|
|
|
};
|
|
|
|
typedef QHash<QString, QgsAuthMethodConfig> QgsAuthMethodConfigsMap;
|
|
|
|
|
|
|
|
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"
|
|
%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
|
|
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>
|
|
{
|
|
%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
|
|
};
|
|
|
|
|
|
|
|
class QgsAuthConfigSslServer
|
|
{
|
|
%Docstring
|
|
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.pl again *
|
|
************************************************************************/
|