fix initialization of core handler
This commit is contained in:
parent
5ab6a47efb
commit
e228f241bf
@ -1,3 +1,4 @@
|
|||||||
|
#include "rublon/bits.hpp"
|
||||||
#include <security/pam_appl.h>
|
#include <security/pam_appl.h>
|
||||||
#include <security/pam_client.h>
|
#include <security/pam_client.h>
|
||||||
#include <security/pam_ext.h>
|
#include <security/pam_ext.h>
|
||||||
@ -46,7 +47,7 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] const char ** argv) {
|
|||||||
g_level = LogLevel::Warning;
|
g_level = LogLevel::Warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto & CH = session.coreHandler();
|
CoreHandler_t CH{session.config()};
|
||||||
|
|
||||||
auto selectMethod = [&](const MethodSelect & selector) { //
|
auto selectMethod = [&](const MethodSelect & selector) { //
|
||||||
return selector.create(pam);
|
return selector.create(pam);
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class Configuration {
|
|||||||
std::pmr::memory_resource * memoryResource;
|
std::pmr::memory_resource * memoryResource;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Configuration(std::pmr::memory_resource * mr = memory::default_resource()) : memoryResource{mr} {}
|
Configuration(std::pmr::memory_resource * mr) : memoryResource{mr} {}
|
||||||
|
|
||||||
// change to StaticString
|
// change to StaticString
|
||||||
std::pmr::string systemToken{memoryResource};
|
std::pmr::string systemToken{memoryResource};
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "rublon/memory.hpp"
|
#include "rublon/memory.hpp"
|
||||||
|
#include <memory>
|
||||||
#include <memory_resource>
|
#include <memory_resource>
|
||||||
#include <rapidjson/document.h>
|
#include <rapidjson/document.h>
|
||||||
#include <rublon/bits.hpp>
|
#include <rublon/bits.hpp>
|
||||||
@ -94,18 +95,15 @@ class DefaultResource {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class Session :public DefaultResource {
|
class Session : public DefaultResource {
|
||||||
std::pmr::memory_resource * mr;
|
std::pmr::memory_resource * mr;
|
||||||
const Pam_t & _pam;
|
const Pam_t & _pam;
|
||||||
Configuration _config;
|
Configuration _config;
|
||||||
|
|
||||||
std::pmr::string _tid;
|
std::pmr::string _tid;
|
||||||
std::pmr::string _accessToken;
|
std::pmr::string _accessToken;
|
||||||
|
|
||||||
CoreHandler_t _coreHandler;
|
|
||||||
/// TODO log
|
|
||||||
public:
|
public:
|
||||||
Session(const Pam_t & pam) : DefaultResource{}, mr{memory::default_resource()}, _pam{pam}, _config{mr}, _coreHandler{_config} {
|
Session(const Pam_t & pam) : DefaultResource{}, mr{memory::default_resource()}, _pam{pam}, _config{mr}, _tid{mr}, _accessToken{mr} {
|
||||||
details::initLog();
|
details::initLog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,9 +113,6 @@ class Session :public DefaultResource {
|
|||||||
Session & operator=(Session &&) noexcept = delete;
|
Session & operator=(Session &&) noexcept = delete;
|
||||||
Session & operator=(const Session &) = delete;
|
Session & operator=(const Session &) = delete;
|
||||||
|
|
||||||
const auto & coreHandler() const {
|
|
||||||
return _coreHandler;
|
|
||||||
}
|
|
||||||
const auto & pam() const {
|
const auto & pam() const {
|
||||||
return _pam;
|
return _pam;
|
||||||
}
|
}
|
||||||
@ -167,12 +162,7 @@ class Session :public DefaultResource {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const char * ctransactionID() const {
|
const char * ctransactionID() const {
|
||||||
if(_tid.empty()) {
|
return transactionID().data();
|
||||||
log(LogLevel::Warning, "Transaction ID is not defined, but requested");
|
|
||||||
return "";
|
|
||||||
} else {
|
|
||||||
return _tid.data();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,7 @@ pam_sm_authenticate(pam_handle_t * pamh, [[maybe_unused]] int flags, [[maybe_unu
|
|||||||
g_level = LogLevel::Warning;
|
g_level = LogLevel::Warning;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto & CH = session.coreHandler();
|
CoreHandler_t CH{session.config()};
|
||||||
|
|
||||||
auto selectMethod = [&](const MethodSelect & selector) { //
|
auto selectMethod = [&](const MethodSelect & selector) { //
|
||||||
return selector.create(pam);
|
return selector.create(pam);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user