rublon-ssh/PAM/ssh/include/rublon/authentication_step_interface.hpp
2024-06-17 14:41:07 +02:00

35 lines
1.0 KiB
C++
Executable File

#pragma once
#include <rublon/core_handler_interface.hpp>
#include <rublon/pam_action.hpp>
#include <rublon/utils.hpp>
namespace rublon {
class AuthenticationStep {
protected:
std::string _systemToken;
std::string _tid;
public:
AuthenticationStep() = default;
AuthenticationStep(std::string systemToken, std::string tid) : _systemToken{std::move(systemToken)}, _tid{std::move(tid)} {}
protected:
void addSystemToken(Document & body) const {
auto & alloc = body.GetAllocator();
body.AddMember("systemToken", Value{this->_systemToken.c_str(), alloc}, alloc);
}
void addTid(Document & body) const {
auto & alloc = body.GetAllocator();
body.AddMember("tid", Value{this->_tid.c_str(), alloc}, alloc);
}
void addAccessToken(Document & body, std::string_view token) const {
auto & alloc = body.GetAllocator();
body.AddMember("accessToken", Value{token.data(), static_cast< unsigned >(token.length()), alloc}, alloc);
}
};
} // namespace rublon