mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-03 23:15:52 +00:00
df4ea34a56
* bump zmq static dep * lokimq -> oxenmq * llarp_nodedb -> llarp::NodeDB * remove all crufty api parts of NodeDB * make NodeDB rc selection api not suck * make path builder api not suck * propagate all above changes so that unit tests work and it all compiles
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <service/auth.hpp>
|
|
#include <oxenmq/oxenmq.h>
|
|
|
|
namespace llarp::service
|
|
{
|
|
struct Endpoint;
|
|
}
|
|
|
|
namespace llarp::rpc
|
|
{
|
|
struct EndpointAuthRPC : public llarp::service::IAuthPolicy,
|
|
public std::enable_shared_from_this<EndpointAuthRPC>
|
|
{
|
|
using LMQ_ptr = std::shared_ptr<oxenmq::OxenMQ>;
|
|
using Endpoint_ptr = std::shared_ptr<llarp::service::Endpoint>;
|
|
using Whitelist_t = std::unordered_set<llarp::service::Address, llarp::service::Address::Hash>;
|
|
|
|
explicit EndpointAuthRPC(
|
|
std::string url,
|
|
std::string method,
|
|
Whitelist_t whitelist,
|
|
LMQ_ptr lmq,
|
|
Endpoint_ptr endpoint);
|
|
virtual ~EndpointAuthRPC() = default;
|
|
|
|
void
|
|
Start();
|
|
|
|
void
|
|
AuthenticateAsync(
|
|
std::shared_ptr<llarp::service::ProtocolMessage> msg,
|
|
std::function<void(service::AuthResult)> hook) override;
|
|
|
|
private:
|
|
const std::string m_AuthURL;
|
|
const std::string m_AuthMethod;
|
|
const Whitelist_t m_AuthWhitelist;
|
|
LMQ_ptr m_LMQ;
|
|
Endpoint_ptr m_Endpoint;
|
|
std::optional<oxenmq::ConnectionID> m_Conn;
|
|
};
|
|
} // namespace llarp::rpc
|