Skip to content
Permalink
Browse files
put back virtual methods
  • Loading branch information
3nids committed Jun 24, 2021
1 parent cfb4241 commit 8915a0751a80f565223d50de1e9890dbeca1c9d4
@@ -34,6 +34,21 @@ Abstract base class for authentication method plugins
typedef QFlags<QgsAuthMethod::Expansion> Expansions;


virtual QString key() const = 0;
%Docstring
A non-translated short name representing the auth method
%End

virtual QString description() const = 0;
%Docstring
A non-translated short description representing the auth method for use in debug output and About dialog
%End

virtual QString displayDescription() const = 0;
%Docstring
Translatable display version of the ':py:func:`~QgsAuthMethod.description`'
%End

int version() const;
%Docstring
Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg
@@ -29,7 +29,8 @@
#include <QUuid>

const QString QgsAuthBasicMethod::AUTH_METHOD_KEY = QStringLiteral( "Basic" );
const QString QgsAuthBasicMethod::AUTH_METHOD_DESCRIPTION = tr( "Basic authentication" );
const QString QgsAuthBasicMethod::AUTH_METHOD_DESCRIPTION = QStringLiteral( "Basic authentication" );
const QString QgsAuthBasicMethod::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "Basic authentication" );

QMap<QString, QgsAuthMethodConfig> QgsAuthBasicMethod::sAuthConfigCache = QMap<QString, QgsAuthMethodConfig>();

@@ -52,16 +53,21 @@ QgsAuthBasicMethod::QgsAuthBasicMethod()

}

QString QgsAuthBasicMethod::key()
QString QgsAuthBasicMethod::key() const
{
return AUTH_METHOD_KEY;
}

QString QgsAuthBasicMethod::description()
QString QgsAuthBasicMethod::description() const
{
return AUTH_METHOD_DESCRIPTION;
}

QString QgsAuthBasicMethod::displayDescription() const
{
return AUTH_METHOD_DISPLAY_DESCRIPTION;
}


bool QgsAuthBasicMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
@@ -34,13 +34,16 @@ class QgsAuthBasicMethod : public QgsAuthMethod

static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
static const QString AUTH_METHOD_DISPLAY_DESCRIPTION;

explicit QgsAuthBasicMethod();

// QgsAuthMethod interface
static QString key();
QString key() const override;

static QString description();
QString description() const override;

QString displayDescription() const override;

bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;
@@ -29,7 +29,8 @@
#include <QUuid>

const QString QgsAuthEsriTokenMethod::AUTH_METHOD_KEY = QStringLiteral( "EsriToken" );
const QString QgsAuthEsriTokenMethod::AUTH_METHOD_DESCRIPTION = tr( "ESRI token" );
const QString QgsAuthEsriTokenMethod::AUTH_METHOD_DESCRIPTION = QStringLiteral( "ESRI token" );
const QString QgsAuthEsriTokenMethod::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "ESRI token" );

QMap<QString, QgsAuthMethodConfig> QgsAuthEsriTokenMethod::sAuthConfigCache = QMap<QString, QgsAuthMethodConfig>();

@@ -44,16 +45,21 @@ QgsAuthEsriTokenMethod::QgsAuthEsriTokenMethod()

}

QString QgsAuthEsriTokenMethod::key()
QString QgsAuthEsriTokenMethod::key() const
{
return AUTH_METHOD_KEY;
}

QString QgsAuthEsriTokenMethod::description()
QString QgsAuthEsriTokenMethod::description() const
{
return AUTH_METHOD_DESCRIPTION;
}

QString QgsAuthEsriTokenMethod::displayDescription() const
{
return AUTH_METHOD_DISPLAY_DESCRIPTION;
}

bool QgsAuthEsriTokenMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{
@@ -33,13 +33,16 @@ class QgsAuthEsriTokenMethod : public QgsAuthMethod

static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
static const QString AUTH_METHOD_DISPLAY_DESCRIPTION;

explicit QgsAuthEsriTokenMethod();

// QgsAuthMethod interface
static QString key();
QString key() const override;

static QString description();
QString description() const override;

QString displayDescription() const override;

bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;
@@ -36,7 +36,8 @@


const QString QgsAuthIdentCertMethod::AUTH_METHOD_KEY = QStringLiteral( "Identity-Cert" );
const QString QgsAuthIdentCertMethod::AUTH_METHOD_DESCRIPTION = tr( "Identity certificate authentication" );
const QString QgsAuthIdentCertMethod::AUTH_METHOD_DESCRIPTION = QStringLiteral( "Identity certificate authentication" );
const QString QgsAuthIdentCertMethod::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "Identity certificate authentication" );

QMap<QString, QgsPkiConfigBundle *> QgsAuthIdentCertMethod::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();

@@ -60,16 +61,21 @@ QgsAuthIdentCertMethod::~QgsAuthIdentCertMethod()
sPkiConfigBundleCache.clear();
}

QString QgsAuthIdentCertMethod::key()
QString QgsAuthIdentCertMethod::key() const
{
return AUTH_METHOD_KEY;
}

QString QgsAuthIdentCertMethod::description()
QString QgsAuthIdentCertMethod::description() const
{
return AUTH_METHOD_DESCRIPTION;
}

QString QgsAuthIdentCertMethod::displayDescription() const
{
return AUTH_METHOD_DISPLAY_DESCRIPTION;
}

bool QgsAuthIdentCertMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{
@@ -33,14 +33,17 @@ class QgsAuthIdentCertMethod : public QgsAuthMethod

static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
static const QString AUTH_METHOD_DISPLAY_DESCRIPTION;

explicit QgsAuthIdentCertMethod();
~QgsAuthIdentCertMethod() override;

// QgsAuthMethod interface
static QString key();
QString key() const override;

static QString description();
QString description() const override;

QString displayDescription() const override;

bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;
@@ -44,7 +44,8 @@
#endif

const QString QgsAuthOAuth2Method::AUTH_METHOD_KEY = QStringLiteral( "OAuth2" );
const QString QgsAuthOAuth2Method::AUTH_METHOD_DESCRIPTION = tr( "OAuth2 authentication" );
const QString QgsAuthOAuth2Method::AUTH_METHOD_DESCRIPTION = QStringLiteral( "OAuth2 authentication" );
const QString QgsAuthOAuth2Method::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "OAuth2 authentication" );

QMap<QString, QgsO2 * > QgsAuthOAuth2Method::sOAuth2ConfigCache =
QMap<QString, QgsO2 * >();
@@ -92,16 +93,21 @@ QgsAuthOAuth2Method::~QgsAuthOAuth2Method()
}
}

QString QgsAuthOAuth2Method::key()
QString QgsAuthOAuth2Method::key() const
{
return AUTH_METHOD_KEY;
}

QString QgsAuthOAuth2Method::description()
QString QgsAuthOAuth2Method::description() const
{
return AUTH_METHOD_DESCRIPTION;
}

QString QgsAuthOAuth2Method::displayDescription() const
{
return AUTH_METHOD_DISPLAY_DESCRIPTION;
}

bool QgsAuthOAuth2Method::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{
@@ -41,15 +41,18 @@ class QgsAuthOAuth2Method : public QgsAuthMethod

static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
static const QString AUTH_METHOD_DISPLAY_DESCRIPTION;

explicit QgsAuthOAuth2Method();
~QgsAuthOAuth2Method() override;

//! OAuth2 method key
static QString key();
QString key() const override;

//! OAuth2 method description
static QString description();
QString description() const override;

QString displayDescription() const override;

//! Update network \a request with given \a authcfg and optional \a dataprovider
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
@@ -35,7 +35,8 @@
#include <QMutexLocker>

const QString QgsAuthPkiPathsMethod::AUTH_METHOD_KEY = QStringLiteral( "PKI-Paths" );
const QString QgsAuthPkiPathsMethod::AUTH_METHOD_DESCRIPTION = tr( "PKI paths authentication" );
const QString QgsAuthPkiPathsMethod::AUTH_METHOD_DESCRIPTION = QStringLiteral( "PKI paths authentication" );
const QString QgsAuthPkiPathsMethod::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "PKI paths authentication" );

QMap<QString, QgsPkiConfigBundle *> QgsAuthPkiPathsMethod::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();

@@ -59,16 +60,21 @@ QgsAuthPkiPathsMethod::~QgsAuthPkiPathsMethod()
sPkiConfigBundleCache.clear();
}

QString QgsAuthPkiPathsMethod::key()
QString QgsAuthPkiPathsMethod::key() const
{
return AUTH_METHOD_KEY;
}

QString QgsAuthPkiPathsMethod::description()
QString QgsAuthPkiPathsMethod::description() const
{
return AUTH_METHOD_DESCRIPTION;
}

QString QgsAuthPkiPathsMethod::displayDescription() const
{
return AUTH_METHOD_DISPLAY_DESCRIPTION;
}


bool QgsAuthPkiPathsMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
@@ -33,14 +33,17 @@ class QgsAuthPkiPathsMethod : public QgsAuthMethod

static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
static const QString AUTH_METHOD_DISPLAY_DESCRIPTION;

explicit QgsAuthPkiPathsMethod();
~QgsAuthPkiPathsMethod() override;

// QgsAuthMethod interface
static QString key();
QString key() const override;

static QString description();
QString description() const override;

QString displayDescription() const override;

bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;
@@ -35,7 +35,8 @@
#endif

const QString QgsAuthPkcs12Method::AUTH_METHOD_KEY = QStringLiteral( "PKI-PKCS#12" );
const QString QgsAuthPkcs12Method::AUTH_METHOD_DESCRIPTION = tr( "PKI PKCS#12 authentication" );
const QString QgsAuthPkcs12Method::AUTH_METHOD_DESCRIPTION = QStringLiteral( "PKI PKCS#12 authentication" );
const QString QgsAuthPkcs12Method::AUTH_METHOD_DISPLAY_DESCRIPTION = tr( "PKI PKCS#12 authentication" );

QMap<QString, QgsPkiConfigBundle *> QgsAuthPkcs12Method::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();

@@ -58,16 +59,21 @@ QgsAuthPkcs12Method::~QgsAuthPkcs12Method()
sPkiConfigBundleCache.clear();
}

QString QgsAuthPkcs12Method::key()
QString QgsAuthPkcs12Method::key() const
{
return AUTH_METHOD_KEY;
}

QString QgsAuthPkcs12Method::description()
QString QgsAuthPkcs12Method::description() const
{
return AUTH_METHOD_DESCRIPTION;
}

QString QgsAuthPkcs12Method::displayDescription() const
{
return AUTH_METHOD_DISPLAY_DESCRIPTION;
}

bool QgsAuthPkcs12Method::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{
@@ -33,14 +33,17 @@ class QgsAuthPkcs12Method : public QgsAuthMethod

static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
static const QString AUTH_METHOD_DISPLAY_DESCRIPTION;

explicit QgsAuthPkcs12Method();
~QgsAuthPkcs12Method() override;

// QgsAuthMethod interface
static QString key();
QString key() const override;

static QString description();
QString description() const override;

QString displayDescription() const override;

bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;
@@ -65,6 +65,15 @@ class CORE_EXPORT QgsAuthMethod : public QObject
};
Q_DECLARE_FLAGS( Expansions, Expansion )

//! A non-translated short name representing the auth method
virtual QString key() const = 0;

//! A non-translated short description representing the auth method for use in debug output and About dialog
virtual QString description() const = 0;

//! Translatable display version of the 'description()'
virtual QString displayDescription() const = 0;

//! Increment this if method is significantly updated, allow updater code to be written for previously stored authcfg
int version() const { return mVersion; }

0 comments on commit 8915a07

Please sign in to comment.