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

WIP: authentication

parent 3e7fbed2
No related branches found
No related tags found
No related merge requests found
Pipeline #9454 passed with warnings
Pipeline: caosdb-cppinttest

#9457

    ......@@ -27,6 +27,7 @@
    #include "caosdb/info/v1alpha1/main.pb.h"
    #include "constants.h"
    #include "connection.h"
    #include "authentication.h"
    #include "utils.h"
    auto main() -> int {
    ......@@ -36,24 +37,19 @@ auto main() -> int {
    << caosdb::LIBCAOSDB_VERSION_PATCH << ")" << std::endl;
    std::cout << "We don't miss the H of caos." << std::endl;
    const auto pem_file_path =
    caosdb::utils::get_env_var("CAOSDB_SERVER_CA_PEM", std::string());
    std::string pem = caosdb::utils::load_string_file(pem_file_path);
    const auto pem_file = caosdb::utils::get_env_var("CAOSDB_SERVER_CA_PEM", std::string());
    const auto host = caosdb::utils::get_env_var("CAOSDB_SERVER_HOST", "localhost");
    const auto port_str = caosdb::utils::get_env_var("CAOSDB_SERVER_PORT", "8000");
    const auto port = std::stoi(port_str);
    std::cout << "PEM" << pem << "\n";
    const std::string host =
    caosdb::utils::get_env_var("CAOSDB_SERVER_HOST", "localhost");
    const std::string port_str =
    caosdb::utils::get_env_var("CAOSDB_SERVER_PORT", "8000");
    const int port = std::stoi(port_str);
    auto cacert = std::make_shared<caosdb::PemCACertProvider>(pem);
    auto auth = std::make_shared<caosdb::authentication::PlainPasswordAuthenticator>("tf", "vuY36moa");
    auto cacert = std::make_shared<caosdb::PemFileCACertProvider>(pem_file);
    auto config =
    std::make_shared<caosdb::SslCaosDBConnectionConfig>(host, port, cacert);
    std::make_shared<caosdb::SslCaosDBConnectionConfig>(host, port, cacert, auth);
    caosdb::CaosDBConnection connection(config);
    std::cout << std::endl << connection << std::endl;
    const auto &v_info = connection.getVersionInfo();
    const auto &build = v_info.build();
    // const auto &build = v_info.build();
    // std::cout << "BUILD(" << build[0] << ")" << std::endl;
    std::cout << "VersionInfo(" << v_info.major() << "." << v_info.minor() << "."
    << v_info.patch() << ")" << std::endl;
    ......
    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