50 lines
1.5 KiB
C++
50 lines
1.5 KiB
C++
#include <security/pam_appl.h>
|
|
#include <security/pam_client.h>
|
|
#include <security/pam_ext.h>
|
|
#include <security/pam_misc.h>
|
|
#include <security/pam_modules.h>
|
|
|
|
#include <rapidjson/rapidjson.h>
|
|
|
|
#include <rublon/rublon.hpp>
|
|
#include <rublon/utils.hpp>
|
|
|
|
#define DLL_PUBLIC __attribute__ ((visibility ("default")))
|
|
|
|
using namespace std;
|
|
|
|
namespace {
|
|
|
|
template < typename T >
|
|
using Expected = tl::expected< T, rublon::PamAction >;
|
|
|
|
Expected< rublon::Method > chooseMethod() {}
|
|
|
|
Expected< rublon::Confirm > confirm() {}
|
|
|
|
} // namespace
|
|
|
|
DLL_PUBLIC int pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char ** argv) {
|
|
return PAM_SUCCESS;
|
|
}
|
|
|
|
DLL_PUBLIC int pam_sm_acct_mgmt(pam_handle_t * pamh, int flags, int argc, const char ** argv) {
|
|
return PAM_SUCCESS;
|
|
}
|
|
|
|
DLL_PUBLIC int pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, const char ** argv) {
|
|
auto rublonConfig = rublon::ConfigurationFactory{}.systemConfig();
|
|
rublon::CoreHandler CH{rublonConfig.value()};
|
|
|
|
auto action = rublon::Init{pamh, rublonConfig.value()}
|
|
.fire(CH) //
|
|
.and_then([](const auto & method) -> Expected< int > {
|
|
return tl::unexpected{rublon::PamAction::accept};
|
|
});
|
|
|
|
// .and_then([](const auto & value) { return tl::expected< rublon::Configuration, rublon::PamAction >{}; }) //
|
|
// .and_then([](const auto & conf) { return tl::expected< rublon::Configuration, rublon::PamAction >{}; });
|
|
|
|
return PAM_SUCCESS;
|
|
}
|