rublon-ssh/PAM/ssh/include/rublon/rublon.hpp
rublon-bwi 8ffa20fffa
Bwi/sms link (#8)
* generate user enrolement message

* cleanup

* Fix bugs found during testing

* Add yotp message [not verified]

* smsLink implementation

* implement SMS Link

* YOTP fixes

* Add SMS link
2024-02-13 16:50:45 +01:00

73 lines
1.7 KiB
C++

#pragma once
#include <rublon/init.hpp>
#include <rublon/json.hpp>
#include <rublon/pam.hpp>
#include <rublon/rublon.hpp>
#include <rublon/utils.hpp>
namespace rublon {
// template<typename Pam_t>
// static Configuration readConfig(const Pam_t&pam){
// auto rublonConfig = ConfigurationFactory{}.systemConfig();
// if(not rublonConfig.has_value()) {
// pam.print("\n");
// pam.print("Rublon configuration does not exists or is invalid");
// pam.print("\tcheck '%s' for more details\n", details::logPath());
// }
// }
class RublonSession {
public:
std::pmr::string _tid;
RublonSession() {
/// create memoryResource
///
}
void startTransaction(std::string_view tid) {}
};
class RublonExceptionHandler{
public:
};
template < typename Pam_T, typename CoreHandler_T >
class RublonBase {
const Pam_T & _pam;
Configuration _config{};
void initializeLogs() {
details::initLog();
}
public:
RublonBase(const Pam_T & pam, Configuration config) : _pam{pam}, _config{config} {}
AuthenticationStatus authenticate() const {
}
};
using RublonLinux = RublonBase< LinuxPam, CoreHandler< CURL > >;
class RublonFactory{
public:
template <typename Pam_t>
tl::expected<RublonLinux, bool> create(const Pam_t &pam){
auto config = ConfigurationFactory{}.systemConfig();
if(not config.has_value()) {
pam.print("\n");
pam.print("Rublon configuration does not exists or is invalid");
pam.print("\tcheck '%s' for more details\n", details::logPath());
return tl::unexpected{false};
}
return RublonLinux{pam, *config};
}
};
} // namespace rublon