From 1d0944e340cab35ca4986906d5c4b486b386ce59 Mon Sep 17 00:00:00 2001 From: florian <f.spreckelsen@inidscale.com> Date: Fri, 9 Jul 2021 10:53:21 +0200 Subject: [PATCH] DRAFT: Add broken PlainPasswordAuthenticator --- jlcaosdb/jlcaosdb.cxx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/jlcaosdb/jlcaosdb.cxx b/jlcaosdb/jlcaosdb.cxx index 96e7b58..5fed1c2 100644 --- a/jlcaosdb/jlcaosdb.cxx +++ b/jlcaosdb/jlcaosdb.cxx @@ -29,6 +29,15 @@ #include "caosdb/constants.h" #include "caosdb/exceptions.h" +namespace jlcxx +{ + template<> + struct SuperType<caosdb::authentication::PlainPasswordAuthenticator> + { + typedef caosdb::authentication::Authenticator type; + }; +} + JLCXX_MODULE define_julia_module(jlcxx::Module& mod) { // Version info of libcaosdb against which this is built. @@ -37,10 +46,19 @@ JLCXX_MODULE define_julia_module(jlcxx::Module& mod) mod.method("get_libcaosdb_version_patch", []() {return caosdb::LIBCAOSDB_VERSION_PATCH;}); // exceptions inherit from abstract Julia exception types: - mod.add_type<caosdb::exceptions::AuthenticationError>("AuthenticationError", jlcxx::julia_type("AbstractAuthenticationError")) + mod.add_type<caosdb::exceptions::AuthenticationError>("AuthenticationError", + jlcxx::julia_type("AbstractAuthenticationError")) .constructor<const std::string&>() .method("what", &caosdb::exceptions::AuthenticationError::what); - mod.add_type<caosdb::exceptions::ConnectionError>("ConnectionError", jlcxx::julia_type("AbstractConnectionError")) + mod.add_type<caosdb::exceptions::ConnectionError>("ConnectionError", + jlcxx::julia_type("AbstractConnectionError")) .constructor<const std::string&>() .method("what", &caosdb::exceptions::ConnectionError::what); + + // authenticators + mod.add_type<caosdb::authentication::Authenticator>("CaosDBAuthenticator"); + mod.add_type<caosdb::authentication::PlainPasswordAuthenticator>("PlainPasswordAuthenticator", + jlcxx::julia_base_type<caosdb::authentication::Authenticator>()) + .constructor<const std::string&, const std::string&>() + .method("getCallCredentials", &caosdb::authentication::PlainPasswordAuthenticator::getCallCredentials); } -- GitLab