* Remove unused options from rublon default config * Remove safe|secure options * Allow 9 digits long passcode for passcode bypass * Change name of 'Mobile Passcode' to 'Passcode' * Do not display any prompt when user is waiting * remove unused alloca.h header * Add autopushPrompt option * Change name OTP method * Change enrolement message handling * ad static string ctor * Addded postrm script * Rename 01_rublon_ssh.conf to 01-rublon-ssh.conf * restart sshd service after rublon package instalation * Fix sshd not restarting bug on ubuntu 24.04 * disable logging from websocket-io * change package name to match old package name * Fix compilation issue when using non owning ptr * Set version to 2.0.0
36 lines
1.2 KiB
C++
Executable File
36 lines
1.2 KiB
C++
Executable File
#pragma once
|
|
|
|
#include <tl/expected.hpp>
|
|
|
|
#include <rublon/authentication_step_interface.hpp>
|
|
#include <rublon/configuration.hpp>
|
|
#include <rublon/pam.hpp>
|
|
#include <rublon/pam_action.hpp>
|
|
|
|
#include <rublon/websockets.hpp>
|
|
|
|
namespace rublon::method {
|
|
|
|
class WebsocketBasedAuth : public AuthenticationStep {
|
|
public:
|
|
const char * _name = "";
|
|
const bool _autopushPrompt = true;
|
|
|
|
WebsocketBasedAuth(std::string systemToken, std::string tid, const char * name, bool autopushPrompt = true)
|
|
: AuthenticationStep(std::move(systemToken), std::move(tid)), _name{name}, _autopushPrompt{autopushPrompt} {}
|
|
|
|
template < typename Hander_t, typename PamInfo_t = LinuxPam >
|
|
tl::expected< AuthenticationStatus, Error > verify(const CoreHandlerInterface< Hander_t > & coreHandler, const PamInfo_t & pam) const {
|
|
log(LogLevel::Info, "starting WS");
|
|
auto listener = coreHandler.listen();
|
|
if(not _autopushPrompt)
|
|
pam.print("Autopush");
|
|
else
|
|
pam.scan([](const auto /*ignored userinput*/) { return ""; },
|
|
"Rublon authentication initiated. Complete the authentication and press Enter to proceed");
|
|
return listener->waitForEvent();
|
|
}
|
|
};
|
|
|
|
} // namespace rublon::method
|