Skip to content
Permalink
Browse files
Remove need for GUI to build authentication methods (#43262)
* Remove need for GUI to build authentication methods

* Nyall and Denis know better, add the flag :)

* Fix header .cpp file name

* Remove needless include_directories

* separate gui/core parts of auth method libraries

* core part to add gui modules for auth methods

* move oauth resources to top level

* refactor methods to support both modules

* move qjsonwrapper to external

* some fixes

* revert separation of modules gui/core, just a better code separation

Co-authored-by: Denis Rouzaud <denis.rouzaud@gmail.com>
  • Loading branch information
3nids committed May 19, 2021
2 parents 0b8d683 + 18497e2 commit c85903e3184ec9b190738f5fa8c1bb5c9919c2f2
Showing with 447 additions and 331 deletions.
  1. +2 −0 CMakeLists.txt
  2. 0 {src/auth/oauth2 → }/cmake/DownloadO2.cmake
  3. 0 {src/auth/oauth2 → }/cmake/FindO2.cmake
  4. 0 {src/auth/oauth2 → external}/qjsonwrapper/Json.cpp
  5. +4 −0 {src/auth/oauth2 → external}/qjsonwrapper/Json.h
  6. 0 {src/auth/oauth2 → external}/qjsonwrapper/LICENSE
  7. 0 {src/auth/oauth2 → external}/qjsonwrapper/README.md
  8. +4 −1 src/CMakeLists.txt
  9. +30 −15 src/auth/basic/CMakeLists.txt
  10. +0 −9 src/auth/basic/{ → core}/qgsauthbasicmethod.cpp
  11. 0 src/auth/basic/{ → core}/qgsauthbasicmethod.h
  12. 0 src/auth/basic/{ → gui}/qgsauthbasicedit.cpp
  13. +1 −0 src/auth/basic/{ → gui}/qgsauthbasicedit.h
  14. 0 src/auth/basic/{ → gui}/qgsauthbasicedit.ui
  15. +25 −0 src/auth/basic/gui/qgsauthbasicmethodgui.cpp
  16. +32 −25 src/auth/esritoken/CMakeLists.txt
  17. +0 −9 src/auth/esritoken/{ → core}/qgsauthesritokenmethod.cpp
  18. 0 src/auth/esritoken/{ → core}/qgsauthesritokenmethod.h
  19. 0 src/auth/esritoken/{ → gui}/qgsauthesritokenedit.cpp
  20. 0 src/auth/esritoken/{ → gui}/qgsauthesritokenedit.h
  21. 0 src/auth/esritoken/{ → gui}/qgsauthesritokenedit.ui
  22. +27 −0 src/auth/esritoken/gui/qgsauthesritokenmethodgui.cpp
  23. +33 −25 src/auth/identcert/CMakeLists.txt
  24. +0 −9 src/auth/identcert/{ → core}/qgsauthidentcertmethod.cpp
  25. 0 src/auth/identcert/{ → core}/qgsauthidentcertmethod.h
  26. 0 src/auth/identcert/{ → gui}/qgsauthidentcertedit.cpp
  27. 0 src/auth/identcert/{ → gui}/qgsauthidentcertedit.h
  28. 0 src/auth/identcert/{ → gui}/qgsauthidentcertedit.ui
  29. +27 −0 src/auth/identcert/gui/qgsauthidentcertmethodgui.cpp
  30. +78 −91 src/auth/oauth2/CMakeLists.txt
  31. +0 −51 src/auth/oauth2/cmake/FindQtKeychain.cmake
  32. +1 −1 src/auth/oauth2/{ → core}/qgsauthoauth2config.cpp
  33. 0 src/auth/oauth2/{ → core}/qgsauthoauth2config.h
  34. +5 −11 src/auth/oauth2/{ → core}/qgsauthoauth2method.cpp
  35. 0 src/auth/oauth2/{ → core}/qgsauthoauth2method.h
  36. 0 src/auth/oauth2/{ → core}/qgso2.cpp
  37. 0 src/auth/oauth2/{ → core}/qgso2.h
  38. +2 −1 src/auth/oauth2/{ → gui}/qgsauthoauth2edit.cpp
  39. 0 src/auth/oauth2/{ → gui}/qgsauthoauth2edit.h
  40. 0 src/auth/oauth2/{ → gui}/qgsauthoauth2edit.ui
  41. +25 −0 src/auth/oauth2/gui/qgsauthoauth2methodgui.cpp
  42. +0 −12 src/auth/oauth2/oauth2_resources.qrc
  43. +12 −0 src/auth/oauth2/resources/oauth2_resources.qrc
  44. 0 src/auth/oauth2/{ → resources}/oauth2_verification_finished.html
  45. 0 src/auth/oauth2/{oauth2_resources → resources/svg}/close.svg
  46. 0 src/auth/oauth2/{oauth2_resources → resources/svg}/export.svg
  47. 0 src/auth/oauth2/{oauth2_resources → resources/svg}/fileopen.svg
  48. 0 src/auth/oauth2/{oauth2_resources → resources/svg}/hidden.svg
  49. 0 src/auth/oauth2/{oauth2_resources → resources/svg}/import.svg
  50. 0 src/auth/oauth2/{oauth2_resources → resources/svg}/visible.svg
  51. 0 src/auth/oauth2/{oauth2_resources → resources/svg}/visible_red.svg
  52. +33 −25 src/auth/pkipaths/CMakeLists.txt
  53. +0 −9 src/auth/pkipaths/{ → core}/qgsauthpkipathsmethod.cpp
  54. 0 src/auth/pkipaths/{ → core}/qgsauthpkipathsmethod.h
  55. 0 src/auth/pkipaths/{ → gui}/qgsauthpkipathsedit.cpp
  56. 0 src/auth/pkipaths/{ → gui}/qgsauthpkipathsedit.h
  57. 0 src/auth/pkipaths/{ → gui}/qgsauthpkipathsedit.ui
  58. +27 −0 src/auth/pkipaths/gui/qgsauthpkipathsmethodgui.cpp
  59. +33 −25 src/auth/pkipkcs12/CMakeLists.txt
  60. +0 −9 src/auth/pkipkcs12/{ → core}/qgsauthpkcs12method.cpp
  61. 0 src/auth/pkipkcs12/{ → core}/qgsauthpkcs12method.h
  62. 0 src/auth/pkipkcs12/{ → gui}/qgsauthpkcs12edit.cpp
  63. 0 src/auth/pkipkcs12/{ → gui}/qgsauthpkcs12edit.h
  64. 0 src/auth/pkipkcs12/{ → gui}/qgsauthpkcs12edit.ui
  65. +27 −0 src/auth/pkipkcs12/gui/qgsauthpkcs12methodgui.cpp
  66. +3 −0 src/core/CMakeLists.txt
  67. +3 −1 tests/src/CMakeLists.txt
  68. +5 −1 tests/src/auth/CMakeLists.txt
  69. +8 −1 tests/src/auth/testqgsauthoauth2method.cpp
@@ -144,6 +144,8 @@ 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_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")

set (WITH_DESKTOP TRUE CACHE BOOL "Determines whether QGIS desktop should be built")
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -19,6 +19,10 @@
* SOFTWARE.
*/


#define SIP_NO_FILE


#pragma once
#ifndef QJSONWRAPPER_JSON_H
#define QJSONWRAPPER_JSON_H
File renamed without changes.
File renamed without changes.
@@ -1,14 +1,17 @@
add_subdirectory(native)
add_subdirectory(core)

if (WITH_AUTH)
add_subdirectory(auth)
endif()

if (WITH_ANALYSIS)
add_subdirectory(analysis)
endif()

if (WITH_GUI)
add_subdirectory(ui)
add_subdirectory(gui)
add_subdirectory(auth)
endif()

add_subdirectory(providers)
@@ -1,32 +1,47 @@
set(AUTH_BASIC_SRCS
qgsauthbasicmethod.cpp
qgsauthbasicedit.cpp
core/qgsauthbasicmethod.cpp
)

set(AUTH_BASIC_HDRS
qgsauthbasicedit.h
qgsauthbasicmethod.h
core/qgsauthbasicmethod.h
)

set(AUTH_BASIC_UIS qgsauthbasicedit.ui)
set(AUTH_BASIC_UIS_H "")

include_directories (
${CMAKE_CURRENT_BINARY_DIR}
)
if (WITH_GUI)
set(AUTH_BASIC_SRCS ${AUTH_BASIC_SRCS}
gui/qgsauthbasicmethodgui.cpp
gui/qgsauthbasicedit.cpp
)
set(AUTH_BASIC_HDRS ${AUTH_BASIC_HDRS}
gui/qgsauthbasicedit.h
)
set(AUTH_BASIC_UIS gui/qgsauthbasicedit.ui)
QT5_WRAP_UI(AUTH_BASIC_UIS_H ${AUTH_BASIC_UIS})
endif()

QT5_WRAP_UI (AUTH_BASIC_UIS_H ${AUTH_BASIC_UIS})
add_library(basicauthmethod MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})

add_library (basicauthmethod MODULE ${AUTH_BASIC_SRCS} ${AUTH_BASIC_HDRS} ${AUTH_BASIC_UIS_H})
target_include_directories(basicauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)

# require c++17
target_compile_features(basicauthmethod PRIVATE cxx_std_17)

target_link_libraries (basicauthmethod
qgis_core
qgis_gui
)
target_link_libraries(basicauthmethod qgis_core)

if (WITH_GUI)
target_include_directories(basicauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(basicauthmethod qgis_gui)
endif()

target_compile_definitions(basicauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS basicauthmethod
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
@@ -15,7 +15,6 @@
***************************************************************************/

#include "qgsauthbasicmethod.h"
#include "qgsauthbasicedit.h"

#include "qgsauthmanager.h"
#include "qgslogger.h"
@@ -409,14 +408,6 @@ QGISEXTERN bool isAuthMethod()
return true;
}

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthBasicEdit *editWidget( QWidget *parent )
{
return new QgsAuthBasicEdit( parent );
}

/**
* Required cleanup function
*/
File renamed without changes.
File renamed without changes.
@@ -18,6 +18,7 @@
#define QGSAUTHBASICEDIT_H

#include <QWidget>

#include "qgsauthmethodedit.h"
#include "ui_qgsauthbasicedit.h"

File renamed without changes.
@@ -0,0 +1,25 @@
/***************************************************************************
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 );
}
@@ -1,40 +1,47 @@
set(AUTH_ESRI_TOKEN_SRCS
qgsauthesritokenmethod.cpp
qgsauthesritokenedit.cpp
set(AUTH_ESRITOKEN_SRCS
core/qgsauthesritokenmethod.cpp
)

set(AUTH_ESRI_TOKEN_HDRS
qgsauthesritokenedit.h
qgsauthesritokenmethod.h
set(AUTH_ESRITOKEN_HDRS
core/qgsauthesritokenmethod.h
)

set(AUTH_ESRI_TOKEN_UIS qgsauthesritokenedit.ui)
set(AUTH_ESRITOKEN_UIS_H "")

include_directories (
../../core
../../core/auth
../../core/geometry
../../core/metadata
)
include_directories (
../../gui
../../gui/auth
${CMAKE_CURRENT_BINARY_DIR}
)
if (WITH_GUI)
set(AUTH_ESRITOKEN_SRCS ${AUTH_ESRITOKEN_SRCS}
gui/qgsauthesritokenmethodgui.cpp
gui/qgsauthesritokenedit.cpp
)
set(AUTH_ESRITOKEN_HDRS ${AUTH_ESRITOKEN_HDRS}
gui/qgsauthesritokenedit.h
)
set(AUTH_ESRITOKEN_UIS gui/qgsauthesritokenedit.ui)
QT5_WRAP_UI(AUTH_ESRITOKEN_UIS_H ${AUTH_ESRITOKEN_UIS})
endif()

QT5_WRAP_UI (AUTH_ESRI_TOKEN_UIS_H ${AUTH_ESRI_TOKEN_UIS})
add_library(esritokenauthmethod MODULE ${AUTH_ESRITOKEN_SRCS} ${AUTH_ESRITOKEN_HDRS} ${AUTH_ESRITOKEN_UIS_H})

add_library (esritokenauthmethod MODULE ${AUTH_ESRI_TOKEN_SRCS} ${AUTH_ESRI_TOKEN_HDRS} ${AUTH_ESRI_TOKEN_UIS_H})
target_include_directories(esritokenauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)

# require c++17
target_compile_features(esritokenauthmethod PRIVATE cxx_std_17)

target_link_libraries (esritokenauthmethod
qgis_core
qgis_gui
)
target_link_libraries(esritokenauthmethod qgis_core)

if (WITH_GUI)
target_include_directories(esritokenauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(esritokenauthmethod qgis_gui)
endif()

target_compile_definitions(esritokenauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS esritokenauthmethod
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
@@ -15,7 +15,6 @@
***************************************************************************/

#include "qgsauthesritokenmethod.h"
#include "qgsauthesritokenedit.h"

#include "qgsauthmanager.h"
#include "qgslogger.h"
@@ -171,14 +170,6 @@ QGISEXTERN bool isAuthMethod()
return true;
}

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthEsriTokenEdit *editWidget( QWidget *parent )
{
return new QgsAuthEsriTokenEdit( parent );
}

/**
* Required cleanup function
*/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,27 @@
/***************************************************************************
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 );
}

@@ -1,44 +1,52 @@
set(AUTH_IDENTCERT_SRCS
qgsauthidentcertmethod.cpp
qgsauthidentcertedit.cpp
core/qgsauthidentcertmethod.cpp
)

set(AUTH_IDENTCERT_HDRS
qgsauthidentcertedit.h
qgsauthidentcertmethod.h
core/qgsauthidentcertmethod.h
)

set(AUTH_IDENTCERT_UIS qgsauthidentcertedit.ui)
set(AUTH_IDENTCERT_UIS_H "")

include_directories (
../../core
../../core/auth
../../core/geometry
../../core/metadata
)
include_directories (SYSTEM
if (WITH_GUI)
set(AUTH_IDENTCERT_SRCS ${AUTH_IDENTCERT_SRCS}
gui/qgsauthidentcertmethodgui.cpp
gui/qgsauthidentcertedit.cpp
)
set(AUTH_IDENTCERT_HDRS ${AUTH_IDENTCERT_HDRS}
gui/qgsauthidentcertedit.h
)
set(AUTH_IDENTCERT_UIS gui/qgsauthidentcertedit.ui)
QT5_WRAP_UI(AUTH_IDENTCERT_UIS_H ${AUTH_IDENTCERT_UIS})
endif()

add_library(identcertauthmethod MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})

target_include_directories(identcertauthmethod SYSTEM PUBLIC
${QCA_INCLUDE_DIR}
${QTKEYCHAIN_INCLUDE_DIR}
)
include_directories (
../../gui
../../gui/auth
${CMAKE_CURRENT_BINARY_DIR}
)

QT5_WRAP_UI (AUTH_IDENTCERT_UIS_H ${AUTH_IDENTCERT_UIS})

add_library (identcertauthmethod MODULE ${AUTH_IDENTCERT_SRCS} ${AUTH_IDENTCERT_HDRS} ${AUTH_IDENTCERT_UIS_H})
target_include_directories(identcertauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/core
)

# require c++17
target_compile_features(identcertauthmethod PRIVATE cxx_std_17)

target_link_libraries (identcertauthmethod
qgis_core
qgis_gui
)
target_link_libraries(identcertauthmethod qgis_core)

if (WITH_GUI)
target_include_directories(identcertauthmethod PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/gui
${CMAKE_CURRENT_BINARY_DIR}
)
target_link_libraries(identcertauthmethod qgis_gui)
endif()

target_compile_definitions(identcertauthmethod PRIVATE "-DQT_NO_FOREACH")

install(TARGETS identcertauthmethod
RUNTIME DESTINATION ${QGIS_PLUGIN_DIR}
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR})
LIBRARY DESTINATION ${QGIS_PLUGIN_DIR}
)
@@ -15,7 +15,6 @@
***************************************************************************/

#include "qgsauthidentcertmethod.h"
#include "qgsauthidentcertedit.h"

#include <QDir>
#include <QFile>
@@ -333,14 +332,6 @@ QGISEXTERN bool isAuthMethod()
return true;
}

/**
* Optional class factory to return a pointer to a newly created edit widget
*/
QGISEXTERN QgsAuthIdentCertEdit *editWidget( QWidget *parent )
{
return new QgsAuthIdentCertEdit( parent );
}

/**
* Required cleanup function
*/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c85903e

Please sign in to comment.