Skip to content
Snippets Groups Projects
Verified Commit c456bbbf authored by Timm Fitschen's avatar Timm Fitschen
Browse files

WIP: conan

parent f0dfaae0
No related branches found
No related tags found
No related merge requests found
Pipeline #9516 failed
......@@ -54,7 +54,8 @@ if(NOT clang_tidy)
message(STATUS "clang-tidy: Not found")
else()
message(STATUS "clang-tidy: ${clang_tidy}")
set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}" "--header-filter=connection.h"
set(_CMAKE_CXX_CLANG_TIDY "${clang_tidy}"
"--header-filter=caosdb/.*[^\(\.pb\.h\)]$"
"--checks=*,-fuchsia-*,-llvm-include-order,-llvmlibc-*"
"--warnings-as-errors=*")
endif()
......@@ -68,12 +69,12 @@ set_target_properties(caosdb PROPERTIES
CXX_CLANG_TIDY "${_CMAKE_CXX_CLANG_TIDY}"
CXX_INCLUDE_WHAT_YOU_USE "${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE}"
)
add_executable(caosdbcli src/caosdbcli.cpp)
set_target_properties(caosdbcli PROPERTIES
CXX_CLANG_TIDY "${_CMAKE_CXX_CLANG_TIDY}"
CXX_INCLUDE_WHAT_YOU_USE "${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE}"
)
target_link_libraries(caosdbcli caosdb ${CONAN_LIBS})
#add_executable(caosdbcli src/caosdbcli.cpp)
#set_target_properties(caosdbcli PROPERTIES
#CXX_CLANG_TIDY "${_CMAKE_CXX_CLANG_TIDY}"
#CXX_INCLUDE_WHAT_YOU_USE "${_CMAKE_CXX_INCLUDE_WHAT_YOU_USE}"
#)
#target_link_libraries(caosdbcli caosdb caosdb_info_v1alpha1 ${CONAN_LIBS})
if("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
# supress warnings during build of gtest
......
......@@ -27,12 +27,15 @@
* @date 2021-06-28
* @brief Configuration and setup of the client authentication.
*/
#include <string>
#include <iosfwd>
#include <memory>
#include <grpc/grpc.h>
#include <grpcpp/security/credentials.h>
#include "caosdb/utils.h"
#include <grpcpp/security/credentials.h> // for MetadataCredentialsPlugin
#include <map> // for multimap
#include <memory> // for shared_ptr
#include <string> // for string
#include "caosdb/utils.h" // for base64_encode
#include "grpcpp/impl/codegen/status.h" // for Status
#include "grpcpp/impl/codegen/string_ref.h" // for string_ref
namespace grpc { class AuthContext; }
namespace caosdb {
namespace authentication {
......@@ -47,7 +50,7 @@ using grpc::string_ref;
*/
class Authenticator {
public:
virtual auto getCallCredentials() const
[[nodiscard]] virtual auto getCallCredentials() const
-> std::shared_ptr<grpc::CallCredentials> = 0;
};
......@@ -64,10 +67,10 @@ private:
public:
MetadataCredentialsPluginImpl(std::string key, std::string value);
Status
auto
GetMetadata(string_ref service_url, string_ref method_name,
const AuthContext &channel_auth_context,
std::multimap<grpc::string, grpc::string> *metadata) override;
std::multimap<grpc::string, grpc::string> *metadata) -> Status override;
};
class PlainPasswordAuthenticator : public Authenticator {
......@@ -78,7 +81,7 @@ public:
PlainPasswordAuthenticator(const std::string &username,
const std::string &password);
auto getCallCredentials() const
[[nodiscard]] auto getCallCredentials() const
-> std::shared_ptr<grpc::CallCredentials> override;
};
} // namespace authentication
......
......@@ -27,26 +27,13 @@
* @date 2021-05-18
* @brief Configuration and setup of the connection.
*/
#include <string>
#include <iosfwd>
#include "caosdb/authentication.h"
#include <memory>
#include <grpc/grpc.h>
#include <grpcpp/channel.h>
#include <grpcpp/client_context.h>
#include <grpcpp/create_channel.h>
#include <grpcpp/security/credentials.h>
#include "caosdb/info/v1alpha1/main.grpc.pb.h"
namespace grpc {
class ChannelCredentials;
} // namespace grpc
namespace caosdb {
namespace info {
namespace v1alpha1 {
class VersionInfo;
} // namespace v1alpha1
} // namespace info
} // namespace caosdb
#include <iosfwd> // for ostream
#include <memory> // for shared_ptr, unique_ptr
#include <string> // for string
#include "caosdb/info/v1alpha1/main.grpc.pb.h" // for GeneralInfoService
namespace caosdb { namespace authentication { class Authenticator; } }
namespace caosdb { namespace info { namespace v1alpha1 { class VersionInfo; } } }
namespace grpc { class ChannelCredentials; }
namespace caosdb::connection {
using caosdb::authentication::Authenticator;
......
......@@ -52,14 +52,14 @@ inline auto load_string_file(const std::string &path) -> std::string {
* fall_back value.
*/
inline auto get_env_var(const std::string &key, const std::string &fall_back)
-> const std::string {
-> std::string {
const char *val = getenv(key.c_str());
if (val == nullptr) {
return fall_back;
} else {
const auto result = std::string(val);
return result;
}
auto result = std::string(val);
return result;
}
/**
......
......@@ -18,13 +18,14 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include <string>
#include <memory>
#include "caosdb/authentication.h"
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/impl/codegen/string_ref.h>
#include <map>
#include <utility>
#include <grpcpp/impl/codegen/status.h> // for Status, Status::OK
#include <grpcpp/impl/codegen/string_ref.h> // for string_ref
#include <map> // for multimap
#include <memory> // for allocator, shared_ptr
#include <string> // for basic_string, operator+
#include <utility> // for pair, move, make_pair
#include "grpcpp/security/credentials.h" // for MetadataCredentialsFromP...
namespace caosdb::authentication {
using caosdb::utils::base64_encode;
......
......@@ -19,20 +19,21 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include <grpcpp/create_channel.h>
#include <grpcpp/impl/codegen/client_context.h>
#include <grpcpp/impl/codegen/status.h>
#include <grpcpp/security/credentials.h>
#include <iostream>
#include <stdexcept>
#include <string>
#include "caosdb/info/v1alpha1/main.grpc.pb.h"
#include "caosdb/info/v1alpha1/main.pb.h"
#include "caosdb/exceptions.h"
#include "caosdb/connection.h"
#include "caosdb/utils.h"
#include "caosdb/authentication.h"
#include <grpcpp/create_channel.h> // for CreateChannel
#include <grpcpp/impl/codegen/client_context.h> // for ClientContext
#include <grpcpp/impl/codegen/status.h> // for Status
#include <grpcpp/security/credentials.h> // for SslCredentials
#include <iostream> // for operator<<, basic_...
#include <stdexcept> // for runtime_error
#include <string> // for operator+, char_tr...
#include "caosdb/authentication.h" // for Authenticator
#include "caosdb/exceptions.h" // for AuthenticationError
#include "caosdb/info/v1alpha1/main.grpc.pb.h" // for GeneralInfoService
#include "caosdb/info/v1alpha1/main.pb.h" // for GetVersionInfoResp...
#include "caosdb/utils.h" // for load_string_file
#include "grpcpp/impl/codegen/status_code_enum.h" // for StatusCode, UNAUTH...
namespace grpc { class Channel; }
namespace caosdb::connection {
using caosdb::authentication::Authenticator;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment