enable static build of all auth methods

This commit is contained in:
Denis Rouzaud 2021-06-23 12:52:35 +02:00
parent a42df3b856
commit 019976e59c
27 changed files with 333 additions and 393 deletions

View File

@ -138,6 +138,11 @@ if(WITH_CORE)
set (WITH_GUI TRUE CACHE BOOL "Determines whether QGIS GUI library (and everything built on top of it) should be built")
set (WITH_OAUTH2_PLUGIN TRUE CACHE BOOL "Build OAuth2 authentication method plugin")
if(WITH_OAUTH2_PLUGIN)
set(HAVE_OAUTH2_PLUGIN TRUE)
endif()
set (WITH_AUTH TRUE CACHE BOOL "Determines whether QGIS authentication methods should be built")
set (WITH_ANALYSIS TRUE CACHE BOOL "Determines whether QGIS analysis library should be built")

View File

@ -69,6 +69,8 @@
#cmakedefine HAVE_SERVER_PYTHON_PLUGINS
#cmakedefine HAVE_OAUTH2_PLUGIN
#cmakedefine HAVE_OPENCL
#cmakedefine OPENCL_USE_NEW_HEADER

View File

@ -18,7 +18,6 @@ add_subdirectory(identcert)
add_subdirectory(pkipaths)
add_subdirectory(pkipkcs12)
set(WITH_OAUTH2_PLUGIN TRUE CACHE BOOL "Build OAuth2 authentication method plugin")
if (WITH_OAUTH2_PLUGIN)
add_subdirectory(oauth2)
endif()

View File

@ -10,7 +10,6 @@ set(AUTH_BASIC_UIS_H "")
if (WITH_GUI)
set(AUTH_BASIC_SRCS ${AUTH_BASIC_SRCS}
gui/qgsauthbasicmethodgui.cpp
gui/qgsauthbasicedit.cpp
)
set(AUTH_BASIC_HDRS ${AUTH_BASIC_HDRS}
@ -20,28 +19,51 @@ if (WITH_GUI)
QT5_WRAP_UI(AUTH_BASIC_UIS_H ${AUTH_BASIC_UIS})
endif()
add_library(authmethod_basic MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})
target_include_directories(authmethod_basic PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)
# static library
add_library(authmethod_basic_a STATIC ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})
target_include_directories(authmethod_basic_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/basic/core)
# require c++17
target_compile_features(authmethod_basic PRIVATE cxx_std_17)
target_compile_features(authmethod_basic_a PRIVATE cxx_std_17)
target_link_libraries(authmethod_basic qgis_core)
target_link_libraries(authmethod_basic_a qgis_core)
if (WITH_GUI)
target_include_directories(authmethod_basic PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(authmethod_basic_a PRIVATE
${CMAKE_SOURCE_DIR}/src/auth/basic/gui
${CMAKE_BINARY_DIR}/src/auth/basic
)
target_link_libraries(authmethod_basic qgis_gui)
target_link_libraries (authmethod_basic_a qgis_gui)
endif()
target_compile_definitions(authmethod_basic PRIVATE "-DQT_NO_FOREACH")
target_compile_definitions(authmethod_basic_a PRIVATE "-DQT_NO_FOREACH")
install(TARGETS authmethod_basic
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS authmethod_basic_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
else()
# dynamically loaded module
add_library(authmethod_basic MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})
# require c++17
target_compile_features(authmethod_basic PRIVATE cxx_std_17)
target_link_libraries(authmethod_basic qgis_core)
if (WITH_GUI)
target_link_libraries (authmethod_basic qgis_gui)
add_dependencies(authmethod_basic ui)
endif()
target_compile_definitions(authmethod_basic PRIVATE "-DQT_NO_FOREACH")
install (TARGETS authmethod_basic
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endif()

View File

@ -20,12 +20,16 @@
#include "qgslogger.h"
#include "qgsapplication.h"
#ifdef HAVE_GUI
#include "qgsauthbasicedit.h"
#endif
#include <QNetworkProxy>
#include <QMutexLocker>
#include <QUuid>
static const QString AUTH_METHOD_KEY = QStringLiteral( "Basic" );
static const QString AUTH_METHOD_DESCRIPTION = QStringLiteral( "Basic authentication" );
const QString QgsAuthBasicMethod::AUTH_METHOD_KEY = QStringLiteral( "Basic" );
const QString QgsAuthBasicMethod::AUTH_METHOD_DESCRIPTION = tr( "Basic authentication" );
QMap<QString, QgsAuthMethodConfig> QgsAuthBasicMethod::sAuthConfigCache = QMap<QString, QgsAuthMethodConfig>();
@ -48,20 +52,16 @@ QgsAuthBasicMethod::QgsAuthBasicMethod()
}
QString QgsAuthBasicMethod::key() const
QString QgsAuthBasicMethod::key()
{
return AUTH_METHOD_KEY;
}
QString QgsAuthBasicMethod::description() const
QString QgsAuthBasicMethod::description()
{
return AUTH_METHOD_DESCRIPTION;
}
QString QgsAuthBasicMethod::displayDescription() const
{
return tr( "Basic authentication" );
}
bool QgsAuthBasicMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
@ -313,6 +313,13 @@ void QgsAuthBasicMethod::updateMethodConfig( QgsAuthMethodConfig &mconfig )
// TODO: add updates as method version() increases due to config storage changes
}
#ifdef HAVE_GUI
QWidget *QgsAuthBasicMethod::editWidget( QWidget *parent ) const
{
return new QgsAuthBasicEdit( parent );
}
#endif
void QgsAuthBasicMethod::clearCachedConfig( const QString &authcfg )
{
removeMethodConfig( authcfg );
@ -375,42 +382,13 @@ QString QgsAuthBasicMethod::escapeUserPass( const QString &val, QChar delim ) co
// Plugin externals
//////////////////////////////////////////////
/**
* Required class factory to return a pointer to a newly created object
*/
QGISEXTERN QgsAuthBasicMethod *classFactory()
{
return new QgsAuthBasicMethod();
}
/**
* Required key function (used to map the plugin to a data store type)
*/
QGISEXTERN QString authMethodKey()
#ifndef HAVE_STATIC_PROVIDERS
QGISEXTERN QgsAuthMethodMetadata *authMethodMetadataFactory()
{
return AUTH_METHOD_KEY;
return new QgsAuthBasicMethodMetadata();
}
#endif
/**
* Required description function
*/
QGISEXTERN QString description()
{
return AUTH_METHOD_DESCRIPTION;
}
/**
* Required isAuthMethod function. Used to determine if this shared library
* is an authentication method plugin
*/
QGISEXTERN bool isAuthMethod()
{
return true;
}
/**
* Required cleanup function
*/
QGISEXTERN void cleanupAuthMethod() // pass QgsAuthMethod *method, then delete method ?
{
}

View File

@ -22,21 +22,25 @@
#include "qgsauthconfig.h"
#include "qgsauthmethod.h"
#include "qgsauthmethodmetadata.h"
class QWidget;
class QgsAuthBasicMethod : public QgsAuthMethod
{
Q_OBJECT
public:
static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
explicit QgsAuthBasicMethod();
// QgsAuthMethod interface
QString key() const override;
static QString key();
QString description() const override;
QString displayDescription() const override;
static QString description();
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;
@ -52,6 +56,10 @@ class QgsAuthBasicMethod : public QgsAuthMethod
void updateMethodConfig( QgsAuthMethodConfig &mconfig ) override;
#ifdef HAVE_GUI
QWidget *editWidget( QWidget *parent )const override;
#endif
private:
QgsAuthMethodConfig getMethodConfig( const QString &authcfg, bool fullconfig = true );
@ -62,7 +70,19 @@ class QgsAuthBasicMethod : public QgsAuthMethod
QString escapeUserPass( const QString &val, QChar delim = '\'' ) const;
static QMap<QString, QgsAuthMethodConfig> sAuthConfigCache;
};
class QgsAuthBasicMethodMetadata : public QgsAuthMethodMetadata
{
public:
QgsAuthBasicMethodMetadata()
: QgsAuthMethodMetadata( QgsAuthBasicMethod::AUTH_METHOD_KEY, QgsAuthBasicMethod::AUTH_METHOD_DESCRIPTION )
{}
QgsAuthBasicMethod *createAuthMethod() const override {return new QgsAuthBasicMethod;}
//QStringList supportedDataProviders() const override;
};
#endif // QGSAUTHBASICMETHOD_H

View File

@ -1,25 +0,0 @@
/***************************************************************************
qgsauthbasicmethodgui.cpp
---------------------
begin : September 1, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsauthbasicedit.h"
/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthBasicEdit *editWidget( QWidget *parent )
{
return new QgsAuthBasicEdit( parent );
}

View File

@ -10,7 +10,6 @@ set(AUTH_ESRITOKEN_UIS_H "")
if (WITH_GUI)
set(AUTH_ESRITOKEN_SRCS ${AUTH_ESRITOKEN_SRCS}
gui/qgsauthesritokenmethodgui.cpp
gui/qgsauthesritokenedit.cpp
)
set(AUTH_ESRITOKEN_HDRS ${AUTH_ESRITOKEN_HDRS}
@ -20,28 +19,49 @@ if (WITH_GUI)
QT5_WRAP_UI(AUTH_ESRITOKEN_UIS_H ${AUTH_ESRITOKEN_UIS})
endif()
add_library(authmethod_esritoken MODULE ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H})
target_include_directories(authmethod_esritoken PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)
# static library
add_library(authmethod_esritoken_a STATIC ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H})
target_include_directories(authmethod_esritoken_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/esritoken/core)
# require c++17
target_compile_features(authmethod_esritoken PRIVATE cxx_std_17)
target_compile_features(authmethod_esritoken_a PRIVATE cxx_std_17)
target_link_libraries(authmethod_esritoken qgis_core)
target_link_libraries(authmethod_esritoken_a qgis_core)
if (WITH_GUI)
target_include_directories(authmethod_esritoken PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(authmethod_esritoken_a PRIVATE
${CMAKE_SOURCE_DIR}/src/auth/esritoken/gui
${CMAKE_BINARY_DIR}/src/auth/esritoken
)
target_link_libraries(authmethod_esritoken qgis_gui)
target_link_libraries (authmethod_esritoken_a qgis_gui)
endif()
target_compile_definitions(authmethod_esritoken PRIVATE "-DQT_NO_FOREACH")
target_compile_definitions(authmethod_esritoken_a PRIVATE "-DQT_NO_FOREACH")
install(TARGETS authmethod_esritoken
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS authmethod_esritoken_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
else()
# dynamically loaded module
add_library(authmethod_esritoken MODULE ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H})
# require c++17
target_compile_features(authmethod_esritoken PRIVATE cxx_std_17)
target_link_libraries(authmethod_esritoken qgis_core)
if (WITH_GUI)
target_link_libraries (authmethod_esritoken qgis_gui)
add_dependencies(authmethod_esritoken ui)
endif()
target_compile_definitions(authmethod_esritoken PRIVATE "-DQT_NO_FOREACH")
install (TARGETS authmethod_esritoken
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endif()

View File

@ -24,8 +24,8 @@
#include <QMutexLocker>
#include <QUuid>
static const QString AUTH_METHOD_KEY = QStringLiteral( "EsriToken" );
static const QString AUTH_METHOD_DESCRIPTION = QStringLiteral( "ESRI token" );
const QString QgsAuthEsriTokenMethod::AUTH_METHOD_KEY = QStringLiteral( "EsriToken" );
const QString QgsAuthEsriTokenMethod::AUTH_METHOD_DESCRIPTION = tr( "ESRI token" );
QMap<QString, QgsAuthMethodConfig> QgsAuthEsriTokenMethod::sAuthConfigCache = QMap<QString, QgsAuthMethodConfig>();
@ -40,21 +40,16 @@ QgsAuthEsriTokenMethod::QgsAuthEsriTokenMethod()
}
QString QgsAuthEsriTokenMethod::key() const
QString QgsAuthEsriTokenMethod::key()
{
return AUTH_METHOD_KEY;
}
QString QgsAuthEsriTokenMethod::description() const
QString QgsAuthEsriTokenMethod::description()
{
return AUTH_METHOD_DESCRIPTION;
}
QString QgsAuthEsriTokenMethod::displayDescription() const
{
return tr( "ESRI token based authentication" );
}
bool QgsAuthEsriTokenMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{

View File

@ -29,14 +29,16 @@ class QgsAuthEsriTokenMethod : public QgsAuthMethod
Q_OBJECT
public:
static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
explicit QgsAuthEsriTokenMethod();
// QgsAuthMethod interface
QString key() const override;
static QString key();
QString description() const override;
QString displayDescription() const override;
static QString description();
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;

View File

@ -1,27 +0,0 @@
/***************************************************************************
qgsauthesritokenmethodgui.cpp
--------------------------
begin : October 2018
copyright : (C) 2018 by Nyall Dawson
author : Nyall Dawson
email : nyall dot dawson at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsauthesritokenedit.h"
/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthEsriTokenEdit *editWidget( QWidget *parent )
{
return new QgsAuthEsriTokenEdit( parent );
}

View File

@ -10,7 +10,6 @@ set(AUTH_IDENTCERT_UIS_H "")
if (WITH_GUI)
set(AUTH_IDENTCERT_SRCS ${AUTH_IDENTCERT_SRCS}
gui/qgsauthidentcertmethodgui.cpp
gui/qgsauthidentcertedit.cpp
)
set(AUTH_IDENTCERT_HDRS ${AUTH_IDENTCERT_HDRS}
@ -20,33 +19,51 @@ if (WITH_GUI)
QT5_WRAP_UI(AUTH_IDENTCERT_UIS_H ${AUTH_IDENTCERT_UIS})
endif()
add_library(authmethod_identcert MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})
target_include_directories(authmethod_identcert SYSTEM PUBLIC
${QCA_INCLUDE_DIR}
${QTKEYCHAIN_INCLUDE_DIR}
)
# static library
add_library(authmethod_identcert_a STATIC ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})
target_include_directories(authmethod_identcert PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)
target_include_directories(authmethod_identcert_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/identcert/core)
# require c++17
target_compile_features(authmethod_identcert PRIVATE cxx_std_17)
target_compile_features(authmethod_identcert_a PRIVATE cxx_std_17)
target_link_libraries(authmethod_identcert qgis_core)
target_link_libraries(authmethod_identcert_a qgis_core)
if (WITH_GUI)
target_include_directories(authmethod_identcert PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(authmethod_identcert_a PRIVATE
${CMAKE_SOURCE_DIR}/src/auth/identcert/gui
${CMAKE_BINARY_DIR}/src/auth/identcert
)
target_link_libraries(authmethod_identcert qgis_gui)
target_link_libraries (authmethod_identcert_a qgis_gui)
endif()
target_compile_definitions(authmethod_identcert PRIVATE "-DQT_NO_FOREACH")
target_compile_definitions(authmethod_identcert_a PRIVATE "-DQT_NO_FOREACH")
install(TARGETS authmethod_identcert
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS authmethod_identcert_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
else()
# dynamically loaded module
add_library(authmethod_identcert MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})
# require c++17
target_compile_features(authmethod_identcert PRIVATE cxx_std_17)
target_link_libraries(authmethod_identcert qgis_core)
if (WITH_GUI)
target_link_libraries (authmethod_identcert qgis_gui)
add_dependencies(authmethod_identcert ui)
endif()
target_compile_definitions(authmethod_identcert PRIVATE "-DQT_NO_FOREACH")
install (TARGETS authmethod_identcert
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endif()

View File

@ -31,8 +31,8 @@
#include "qgslogger.h"
#include "qgsapplication.h"
static const QString AUTH_METHOD_KEY = QStringLiteral( "Identity-Cert" );
static const QString AUTH_METHOD_DESCRIPTION = QStringLiteral( "Identity certificate authentication" );
const QString QgsAuthIdentCertMethod::AUTH_METHOD_KEY = QStringLiteral( "Identity-Cert" );
const QString QgsAuthIdentCertMethod::AUTH_METHOD_DESCRIPTION = tr( "Identity certificate authentication" );
QMap<QString, QgsPkiConfigBundle *> QgsAuthIdentCertMethod::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();
@ -56,21 +56,16 @@ QgsAuthIdentCertMethod::~QgsAuthIdentCertMethod()
sPkiConfigBundleCache.clear();
}
QString QgsAuthIdentCertMethod::key() const
QString QgsAuthIdentCertMethod::key()
{
return AUTH_METHOD_KEY;
}
QString QgsAuthIdentCertMethod::description() const
QString QgsAuthIdentCertMethod::description()
{
return AUTH_METHOD_DESCRIPTION;
}
QString QgsAuthIdentCertMethod::displayDescription() const
{
return tr( "PKI stored identity certificate" );
}
bool QgsAuthIdentCertMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{

View File

@ -29,15 +29,17 @@ class QgsAuthIdentCertMethod : public QgsAuthMethod
Q_OBJECT
public:
static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
explicit QgsAuthIdentCertMethod();
~QgsAuthIdentCertMethod() override;
// QgsAuthMethod interface
QString key() const override;
static QString key();
QString description() const override;
QString displayDescription() const override;
static QString description();
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;

View File

@ -1,27 +0,0 @@
/***************************************************************************
qgsauthidentcertmethodgui.cpp
---------------------
begin : September 1, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsauthidentcertedit.h"
/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthIdentCertEdit *editWidget( QWidget *parent )
{
return new QgsAuthIdentCertEdit( parent );
}

View File

@ -73,7 +73,6 @@ set(AUTH_OAUTH2_UIS_H "")
if (WITH_GUI)
set(AUTH_OAUTH2_SRCS ${AUTH_OAUTH2_SRCS}
gui/qgsauthoauth2edit.cpp
gui/qgsauthoauth2methodgui.cpp
)
set(AUTH_OAUTH2_HDRS ${AUTH_OAUTH2_HDRS}
@ -97,53 +96,72 @@ if(WITH_INTERNAL_O2 AND CMAKE_GENERATOR MATCHES "Ninja")
)
endif()
set(_library_suffix_MODULE "")
set(_library_suffix_STATIC "_static")
# static library
add_library(authmethod_oauth2_a STATIC ${AUTH_OAUTH2_SRCS} ${AUTH_OAUTH2_HDRS} ${AUTH_OAUTH2_UIS_H})
foreach(_library_type MODULE STATIC)
set(_library_name "authmethod_oauth2${_library_suffix_${_library_type}}")
target_include_directories(authmethod_oauth2_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/oauth2/core)
add_library(${_library_name} ${_library_type} ${AUTH_OAUTH2_SRCS} ${AUTH_OAUTH2_HDRS} ${AUTH_OAUTH2_UIS_H} ${AUTH_OAUTH2_RCCS})
# require c++17
target_compile_features(authmethod_oauth2_a PRIVATE cxx_std_17)
# require c++17
target_compile_features(${_library_name} PRIVATE cxx_std_17)
target_link_libraries(authmethod_oauth2_a qgis_core)
if(WITH_INTERNAL_O2)
target_include_directories(${_library_name} SYSTEM PUBLIC ${O2_INCLUDE_DIR})
if(WITH_INTERNAL_O2)
target_include_directories(authmethod_oauth2_a SYSTEM PUBLIC ${O2_INCLUDE_DIR})
else()
if(NOT "${O2_LIBRARY}" STREQUAL "")
# prefer dynamic linking
target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY})
else()
target_link_libraries(authmethod_oauth2_a ${O2_LIBRARY_STATIC})
endif()
endif()
target_include_directories(${_library_name} PUBLIC
${CMAKE_SOURCE_DIR}/external/qjsonwrapper
${CMAKE_CURRENT_SOURCE_DIR}/core
target_include_directories(authmethod_oauth2_a PRIVATE
${CMAKE_SOURCE_DIR}/external/qjsonwrapper
${CMAKE_SOURCE_DIR}/src/auth/oauth2/core
)
if (WITH_GUI)
target_include_directories(authmethod_oauth2_a PRIVATE
${CMAKE_SOURCE_DIR}/src/auth/oauth2/gui
${CMAKE_BINARY_DIR}/src/auth/oauth2
)
target_link_libraries(${_library_name} qgis_core)
target_link_libraries (authmethod_oauth2_a qgis_gui)
endif()
if (WITH_GUI)
target_include_directories(${_library_name} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(${_library_name} qgis_gui)
endif()
if(NOT WITH_INTERNAL_O2)
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS authmethod_oauth2_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
else()
# dynamically loaded module
add_library(authmethod_oauth2 MODULE ${AUTH_OAUTH2_SRCS} ${AUTH_OAUTH2_HDRS} ${AUTH_OAUTH2_UIS_H})
# require c++17
target_compile_features(authmethod_oauth2 PRIVATE cxx_std_17)
target_link_libraries(authmethod_oauth2 qgis_core)
if(WITH_INTERNAL_O2)
target_include_directories(authmethod_oauth2 SYSTEM PUBLIC ${O2_INCLUDE_DIR})
else()
if(NOT "${O2_LIBRARY}" STREQUAL "")
# prefer dynamic linking
target_link_libraries(${_library_name} ${O2_LIBRARY})
target_link_libraries(authmethod_oauth2 ${O2_LIBRARY})
else()
target_link_libraries(${_library_name} ${O2_LIBRARY_STATIC})
target_link_libraries(authmethod_oauth2 ${O2_LIBRARY_STATIC})
endif()
endif()
if(WIN32)
add_definitions(-DO2_DLL_EXPORT)
if (WITH_GUI)
target_link_libraries (authmethod_oauth2 qgis_gui)
add_dependencies(authmethod_oauth2 ui)
endif()
install(TARGETS ${_library_name}
install (TARGETS authmethod_oauth2
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endforeach()
endif()

View File

@ -40,8 +40,8 @@
#include <QInputDialog>
#endif
static const QString AUTH_METHOD_KEY = QStringLiteral( "OAuth2" );
static const QString AUTH_METHOD_DESCRIPTION = QStringLiteral( "OAuth2 authentication" );
const QString QgsAuthOAuth2Method::AUTH_METHOD_KEY = QStringLiteral( "OAuth2" );
const QString QgsAuthOAuth2Method::AUTH_METHOD_DESCRIPTION = tr( "OAuth2 authentication" );
QMap<QString, QgsO2 * > QgsAuthOAuth2Method::sOAuth2ConfigCache =
QMap<QString, QgsO2 * >();
@ -89,21 +89,16 @@ QgsAuthOAuth2Method::~QgsAuthOAuth2Method()
}
}
QString QgsAuthOAuth2Method::key() const
QString QgsAuthOAuth2Method::key()
{
return AUTH_METHOD_KEY;
}
QString QgsAuthOAuth2Method::description() const
QString QgsAuthOAuth2Method::description()
{
return AUTH_METHOD_DESCRIPTION;
}
QString QgsAuthOAuth2Method::displayDescription() const
{
return tr( "OAuth2 authentication" );
}
bool QgsAuthOAuth2Method::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{

View File

@ -37,17 +37,18 @@ class QgsAuthOAuth2Method : public QgsAuthMethod
Q_OBJECT
public:
static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
explicit QgsAuthOAuth2Method();
~QgsAuthOAuth2Method() override;
//! OAuth2 method key
QString key() const override;
static QString key();
//! OAuth2 method description
QString description() const override;
//! Human readable description
QString displayDescription() const override;
static QString description();
//! Update network \a request with given \a authcfg and optional \a dataprovider
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,

View File

@ -1,25 +0,0 @@
/***************************************************************************
qgsauthoauth2methodgui.cpp
---------------------
begin : July 13, 2016
copyright : (C) 2016 by Monsanto Company, USA
author : Larry Shaffer, Boundless Spatial
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsauthoauth2edit.h"
/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthOAuth2Edit *editWidget( QWidget *parent )
{
return new QgsAuthOAuth2Edit( parent );
}

View File

@ -10,7 +10,6 @@ set(AUTH_PKIPATHS_UIS_H "")
if (WITH_GUI)
set(AUTH_PKIPATHS_SRCS ${AUTH_PKIPATHS_SRCS}
gui/qgsauthpkipathsmethodgui.cpp
gui/qgsauthpkipathsedit.cpp
)
set(AUTH_PKIPATHS_HDRS ${AUTH_PKIPATHS_HDRS}
@ -20,33 +19,50 @@ if (WITH_GUI)
QT5_WRAP_UI(AUTH_PKIPATHS_UIS_H ${AUTH_PKIPATHS_UIS})
endif()
add_library(authmethod_pkipaths MODULE ${AUTH_PKIPATHS_SRCS} ${AUTH_PKIPATHS_HDRS} ${AUTH_PKIPATHS_UIS_H})
# static library
add_library(authmethod_pkipaths_a STATIC ${AUTH_PKIPATHS_SRCS} ${AUTH_PKIPATHS_HDRS} ${AUTH_PKIPATHS_UIS_H})
target_include_directories (authmethod_pkipaths SYSTEM PUBLIC
${QCA_INCLUDE_DIR}
${QTKEYCHAIN_INCLUDE_DIR}
)
target_include_directories(authmethod_pkipaths PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)
target_include_directories(authmethod_pkipaths_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipaths/core)
# require c++17
target_compile_features(authmethod_pkipaths PRIVATE cxx_std_17)
target_compile_features(authmethod_pkipaths_a PRIVATE cxx_std_17)
target_link_libraries(authmethod_pkipaths qgis_core)
target_link_libraries(authmethod_pkipaths_a qgis_core)
if (WITH_GUI)
target_include_directories(authmethod_pkipaths PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(authmethod_pkipaths_a PRIVATE
${CMAKE_SOURCE_DIR}/src/auth/pkipaths/gui
${CMAKE_BINARY_DIR}/src/auth/pkipaths
)
target_link_libraries(authmethod_pkipaths qgis_gui)
target_link_libraries (authmethod_pkipaths_a qgis_gui)
endif()
target_compile_definitions(authmethod_pkipaths PRIVATE "-DQT_NO_FOREACH")
target_compile_definitions(authmethod_pkipaths_a PRIVATE "-DQT_NO_FOREACH")
install(TARGETS authmethod_pkipaths
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS authmethod_pkipaths_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
else()
# dynamically loaded module
add_library(authmethod_pkipaths MODULE ${AUTH_PKIPATHS_SRCS} ${AUTH_PKIPATHS_HDRS} ${AUTH_PKIPATHS_UIS_H})
# require c++17
target_compile_features(authmethod_pkipaths PRIVATE cxx_std_17)
target_link_libraries(authmethod_pkipaths qgis_core)
if (WITH_GUI)
target_link_libraries (authmethod_pkipaths qgis_gui)
add_dependencies(authmethod_pkipaths ui)
endif()
target_compile_definitions(authmethod_pkipaths PRIVATE "-DQT_NO_FOREACH")
install (TARGETS authmethod_pkipaths
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endif()

View File

@ -32,8 +32,8 @@
#include "qgsapplication.h"
static const QString AUTH_METHOD_KEY = QStringLiteral( "PKI-Paths" );
static const QString AUTH_METHOD_DESCRIPTION = QStringLiteral( "PKI paths authentication" );
const QString QgsAuthPkiPathsMethod::AUTH_METHOD_KEY = QStringLiteral( "PKI-Paths" );
const QString QgsAuthPkiPathsMethod::AUTH_METHOD_DESCRIPTION = tr( "PKI paths authentication" );
QMap<QString, QgsPkiConfigBundle *> QgsAuthPkiPathsMethod::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();
@ -57,20 +57,16 @@ QgsAuthPkiPathsMethod::~QgsAuthPkiPathsMethod()
sPkiConfigBundleCache.clear();
}
QString QgsAuthPkiPathsMethod::key() const
QString QgsAuthPkiPathsMethod::key()
{
return AUTH_METHOD_KEY;
}
QString QgsAuthPkiPathsMethod::description() const
QString QgsAuthPkiPathsMethod::description()
{
return AUTH_METHOD_DESCRIPTION;
}
QString QgsAuthPkiPathsMethod::displayDescription() const
{
return tr( "PKI paths authentication" );
}
bool QgsAuthPkiPathsMethod::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )

View File

@ -29,15 +29,17 @@ class QgsAuthPkiPathsMethod : public QgsAuthMethod
Q_OBJECT
public:
static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
explicit QgsAuthPkiPathsMethod();
~QgsAuthPkiPathsMethod() override;
// QgsAuthMethod interface
QString key() const override;
static QString key();
QString description() const override;
QString displayDescription() const override;
static QString description();
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;

View File

@ -1,27 +0,0 @@
/***************************************************************************
qgsauthpkipathsmethodgui.cpp
---------------------
begin : September 1, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsauthpkipathsedit.h"
/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthPkiPathsEdit *editWidget( QWidget *parent )
{
return new QgsAuthPkiPathsEdit( parent );
}

View File

@ -10,7 +10,6 @@ set(AUTH_PKCS12_UIS_H "")
if (WITH_GUI)
set(AUTH_PKCS12_SRCS ${AUTH_PKCS12_SRCS}
gui/qgsauthpkcs12methodgui.cpp
gui/qgsauthpkcs12edit.cpp
)
set(AUTH_PKCS12_HDRS ${AUTH_PKCS12_HDRS}
@ -20,33 +19,50 @@ if (WITH_GUI)
QT5_WRAP_UI(AUTH_PKCS12_UIS_H ${AUTH_PKCS12_UIS})
endif()
add_library(authmethod_pkcs12 MODULE ${AUTH_PKCS12_SRCS} ${AUTH_PKCS12_HDRS} ${AUTH_PKCS12_UIS_H})
# static library
add_library(authmethod_pkcs12_a STATIC ${AUTH_PKCS12_SRCS} ${AUTH_PKCS12_HDRS} ${AUTH_PKCS12_UIS_H})
target_include_directories(authmethod_pkcs12 SYSTEM PUBLIC
${QCA_INCLUDE_DIR}
${QTKEYCHAIN_INCLUDE_DIR}
)
target_include_directories(authmethod_pkcs12 PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)
target_include_directories(authmethod_pkcs12_a PUBLIC ${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/core)
# require c++17
target_compile_features(authmethod_pkcs12 PRIVATE cxx_std_17)
target_compile_features(authmethod_pkcs12_a PRIVATE cxx_std_17)
target_link_libraries(authmethod_pkcs12 qgis_core)
target_link_libraries(authmethod_pkcs12_a qgis_core)
if (WITH_GUI)
target_include_directories(authmethod_pkcs12 PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
target_include_directories(authmethod_pkcs12_a PRIVATE
${CMAKE_SOURCE_DIR}/src/auth/pkipkcs12/gui
${CMAKE_BINARY_DIR}/src/auth/pkipkcs12
)
target_link_libraries(authmethod_pkcs12 qgis_gui)
target_link_libraries (authmethod_pkcs12_a qgis_gui)
endif()
target_compile_definitions(authmethod_pkcs12 PRIVATE "-DQT_NO_FOREACH")
target_compile_definitions(authmethod_pkcs12_a PRIVATE "-DQT_NO_FOREACH")
install(TARGETS authmethod_pkcs12
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
if (FORCE_STATIC_LIBS)
# for (external) mobile apps to be able to pick up provider for linking
install (TARGETS authmethod_pkcs12_a ARCHIVE DESTINATION ${QGIS_PLUGIN_DIR})
else()
# dynamically loaded module
add_library(authmethod_pkcs12 MODULE ${AUTH_PKCS12_SRCS} ${AUTH_PKCS12_HDRS} ${AUTH_PKCS12_UIS_H})
# require c++17
target_compile_features(authmethod_pkcs12 PRIVATE cxx_std_17)
target_link_libraries(authmethod_pkcs12 qgis_core)
if (WITH_GUI)
target_link_libraries (authmethod_pkcs12 qgis_gui)
add_dependencies(authmethod_pkcs12 ui)
endif()
target_compile_definitions(authmethod_pkcs12 PRIVATE "-DQT_NO_FOREACH")
install (TARGETS authmethod_pkcs12
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
endif()

View File

@ -32,8 +32,8 @@
#include "qgsapplication.h"
static const QString AUTH_METHOD_KEY = QStringLiteral( "PKI-PKCS#12" );
static const QString AUTH_METHOD_DESCRIPTION = QStringLiteral( "PKI PKCS#12 authentication" );
const QString QgsAuthPkcs12Method::AUTH_METHOD_KEY = QStringLiteral( "PKI-PKCS#12" );
const QString QgsAuthPkcs12Method::AUTH_METHOD_DESCRIPTION = tr( "PKI PKCS#12 authentication" );
QMap<QString, QgsPkiConfigBundle *> QgsAuthPkcs12Method::sPkiConfigBundleCache = QMap<QString, QgsPkiConfigBundle *>();
@ -56,21 +56,16 @@ QgsAuthPkcs12Method::~QgsAuthPkcs12Method()
sPkiConfigBundleCache.clear();
}
QString QgsAuthPkcs12Method::key() const
QString QgsAuthPkcs12Method::key()
{
return AUTH_METHOD_KEY;
}
QString QgsAuthPkcs12Method::description() const
QString QgsAuthPkcs12Method::description()
{
return AUTH_METHOD_DESCRIPTION;
}
QString QgsAuthPkcs12Method::displayDescription() const
{
return tr( "PKI PKCS#12 authentication" );
}
bool QgsAuthPkcs12Method::updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider )
{

View File

@ -29,15 +29,17 @@ class QgsAuthPkcs12Method : public QgsAuthMethod
Q_OBJECT
public:
static const QString AUTH_METHOD_KEY;
static const QString AUTH_METHOD_DESCRIPTION;
explicit QgsAuthPkcs12Method();
~QgsAuthPkcs12Method() override;
// QgsAuthMethod interface
QString key() const override;
static QString key();
QString description() const override;
QString displayDescription() const override;
static QString description();
bool updateNetworkRequest( QNetworkRequest &request, const QString &authcfg,
const QString &dataprovider = QString() ) override;

View File

@ -1,27 +0,0 @@
/***************************************************************************
qgsauthpkcs12methodgui.cpp
---------------------
begin : September 1, 2015
copyright : (C) 2015 by Boundless Spatial, Inc. USA
author : Larry Shaffer
email : lshaffer at boundlessgeo dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgsauthpkcs12edit.h"
/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthPkcs12Edit *editWidget( QWidget *parent )
{
return new QgsAuthPkcs12Edit( parent );
}