diff --git a/CMakeLists.txt b/CMakeLists.txt index cb436fb..7ad9851 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,35 +8,42 @@ find_package(yaml-cpp) set(CMAKE_CXX_STANDARD 20) -add_library(utils SHARED src/utils.cpp) -target_include_directories(utils PUBLIC +add_library(j7s-plugin-utils SHARED src/utils.cpp) +target_include_directories(j7s-plugin-utils PUBLIC $ $ ) -target_link_libraries(utils OpenSSL::Crypto jwt-cpp) +target_link_libraries(j7s-plugin-utils OpenSSL::Crypto jwt-cpp) add_library(Authorizer SHARED src/Authorizer.cpp src/AuthList.cpp) target_include_directories(Authorizer PUBLIC $ $ ) -target_link_libraries(Authorizer utils yaml-cpp) +target_link_libraries(Authorizer j7s-plugin-utils yaml-cpp) add_library(j7s-plugin SHARED src/j7s-plugin.cpp) target_include_directories(j7s-plugin PUBLIC $ $ ) -target_link_libraries(j7s-plugin utils Authorizer) +target_link_libraries(j7s-plugin j7s-plugin-utils Authorizer) -add_executable(gen-token src/gen-token.cpp) -target_include_directories(gen-token PUBLIC +add_executable(j7s-gen-token src/gen-token.cpp) +target_include_directories(j7s-gen-token PUBLIC $ $ ) -target_link_libraries(gen-token utils argparse::argparse) +target_link_libraries(j7s-gen-token j7s-plugin-utils argparse::argparse) if(BUILD_TESTING) + FetchContent_Declare(googletest + GIT_REPOSITORY "https://github.com/google/googletest.git" + GIT_TAG "release-1.11.0" + GIT_SHALLOW "True" + ) + FetchContent_MakeAvailable(googletest) + include(GoogleTest) enable_testing() @@ -46,6 +53,19 @@ if(BUILD_TESTING) $ $ ) - target_link_libraries(token_test utils GTest::gtest_main) + target_link_libraries(token_test j7s-plugin-utils GTest::gtest_main) gtest_discover_tests(token_test) endif() + +install( + TARGETS + j7s-plugin + Authorizer + j7s-plugin-utils + j7s-gen-token + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + INCLUDES DESTINATION include + COMPONENT Plugin +) diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..bda0192 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +j7s-mosquitto-plugin (0.0.1-1) unstable; urgency=medium + + * Initial release. + + -- James Pace Sat, 26 Mar 2022 23:49:28 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..35a77e7 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: j7s-mosquitto-plugin +Maintainer: James Pace +Build-Depends: cmake, dh-cmake, dh-cmake-compat (= 1), dh-sequence-cmake, debhelper-compat (= 12), + mosquitto-dev, libmosquitto-dev, libssl-dev, libyaml-cpp-dev +Standards-Version: 4.1.5 +Homepage: https://github.com/jpace121/j7s-jwt-mosquitto-auth +Section: misc +Priority: optional + +Package: j7s-mosquitto-plugin +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: Authentication plugin for mosquitto for the j7s project. + Authentication plugin for mosquitto for the j7s project. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..30dd35c --- /dev/null +++ b/debian/copyright @@ -0,0 +1,17 @@ +Files: * +Copyright: 2021-2022 James Pace +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + On Debian systems, the full text of the Apache Software License version 2 can + be found in the file `/usr/share/common-licenses/Apache-2.0'. \ No newline at end of file diff --git a/debian/files b/debian/files new file mode 100644 index 0000000..bee65d9 --- /dev/null +++ b/debian/files @@ -0,0 +1,3 @@ +j7s-mosquitto-plugin-dbgsym_0.0.1-1_amd64.deb debug optional automatic=yes +j7s-mosquitto-plugin_0.0.1-1_amd64.buildinfo misc optional +j7s-mosquitto-plugin_0.0.1-1_amd64.deb misc optional diff --git a/debian/j7s-mosquitto-plugin.cmake-components b/debian/j7s-mosquitto-plugin.cmake-components new file mode 100644 index 0000000..d399cc0 --- /dev/null +++ b/debian/j7s-mosquitto-plugin.cmake-components @@ -0,0 +1 @@ +Plugin \ No newline at end of file diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..050e29a --- /dev/null +++ b/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ --buildsystem=cmake diff --git a/debian/triggers b/debian/triggers new file mode 100644 index 0000000..dd86603 --- /dev/null +++ b/debian/triggers @@ -0,0 +1 @@ +activate-noawait ldconfig diff --git a/examples/mosquitto.conf b/examples/mosquitto.conf index c471e7b..6734a4e 100644 --- a/examples/mosquitto.conf +++ b/examples/mosquitto.conf @@ -1,17 +1,17 @@ per_listener_settings true log_type all -listener 8082 +listener 9000 protocol websockets allow_anonymous false -auth_plugin /home/jimmy/Develop/mosquitto-plugin/build/libj7s-plugin.so -auth_opt_key_file /home/jimmy/Develop/mosquitto-plugin/examples/keys.yaml -auth_opt_acl_file /home/jimmy/Develop/mosquitto-plugin/examples/acl.yaml +auth_plugin /opt/libj7s-plugin.so +auth_opt_key_file /opt/websocket-keys.yaml +auth_opt_acl_file /opt/websocket-acl.yaml -listener 8081 +listener 9001 protocol mqtt allow_anonymous false -auth_plugin /home/jimmy/Develop/mosquitto-plugin/build/libj7s-plugin.so +auth_plugin /opt/libj7s-plugin.so auth_opt_key_file /home/jimmy/Develop/mosquitto-plugin/examples/keys.yaml auth_opt_acl_file /home/jimmy/Develop/mosquitto-plugin/examples/acl.yaml diff --git a/external-deps.cmake b/external-deps.cmake index 7e2458b..3e524e9 100644 --- a/external-deps.cmake +++ b/external-deps.cmake @@ -1,12 +1,5 @@ include(FetchContent) -FetchContent_Declare(googletest - GIT_REPOSITORY "https://github.com/google/googletest.git" - GIT_TAG "release-1.11.0" - GIT_SHALLOW "True" -) -FetchContent_MakeAvailable(googletest) - FetchContent_Declare(jwt-cpp GIT_REPOSITORY "https://github.com/Thalhammer/jwt-cpp.git" GIT_TAG "v0.5.2"