* Add base PROXY support implementation * Remove some dynamic memory allocations * Rewrite configuration reading module * Make everything in core connector memory resource aware * Add logs to check is proxy is used * Add a proxy fallback, and read proxy from env * Add config entry to check application * Cleanup includes * Ddd configuration dump to check application * Update rhel8 packages * Fix http headers bug when using proxy server * Fix formatting * Fix bad optional access * Fix configuration check regresion * Fix memory management issue, remove strict allocators and make connector more polite to memory overflow errors * Fix initialization of core handler
36 lines
862 B
C++
36 lines
862 B
C++
#pragma once
|
|
|
|
#include <rublon/stdlib.hpp>
|
|
#include <rublon/static_string.hpp>
|
|
|
|
namespace rublon {
|
|
|
|
class AuthenticationStatus {
|
|
public:
|
|
using Token_t = std::optional< StaticString< 64 > >;
|
|
enum class Action { Denied, Confirmed, Bypass };
|
|
|
|
AuthenticationStatus(Action action, const char * token = nullptr)
|
|
: _action{action}, _authenticationToken{token == nullptr ? Token_t{std::nullopt} : Token_t{token}} {}
|
|
|
|
constexpr bool userAuthorized() const {
|
|
return _action == Action::Confirmed;
|
|
}
|
|
|
|
Action action() const {
|
|
return _action;
|
|
}
|
|
|
|
std::string_view accessToken() const {
|
|
if(not _authenticationToken)
|
|
return "";
|
|
return {_authenticationToken->c_str(), _authenticationToken->size()};
|
|
}
|
|
|
|
private:
|
|
Action _action;
|
|
Token_t _authenticationToken;
|
|
};
|
|
|
|
} // namespace rublon
|