Leosac  0.8.0
Open Source Access Control
Leosac::Module::Doorman::DoormanInstance Class Reference

Implements a Doorman, that is, a component that will listen to authentication event and react accordingly. More...

#include <DoormanInstance.hpp>

+ Collaboration diagram for Leosac::Module::Doorman::DoormanInstance:

Public Member Functions

 DoormanInstance (DoormanModule &module, zmqpp::context &ctx, const std::string &name, const std::vector< std::string > &auth_contexts, const std::vector< DoormanAction > &actions)
 Create a new doorman. More...
 
 DoormanInstance (const DoormanInstance &)=delete
 
DoormanInstanceoperator= (const DoormanInstance &)=delete
 
zmqpp::socket & bus_sub ()
 
void handle_bus_msg ()
 Activity we care about happened on the bus. More...
 
const std::vector< std::shared_ptr< DoormanDoor > > & doors () const
 

Private Member Functions

bool ignore_action (const DoormanAction &action, Auth::AccessStatus status) const
 Should we ignore this action. More...
 
Auth::AuthTargetPtr find_target (const std::string &name) const
 
void command_send_recv (const std::string &target_name, zmqpp::message msg)
 Send a command to a target and wait for response. More...
 

Private Attributes

std::vector< std::shared_ptr< DoormanDoor > > doors_
 
std::string name_
 
std::vector< DoormanActionactions_
 
zmqpp::socket bus_sub_
 
std::map< std::string, zmqpp::socket > targets_
 Socket (REP) connected to each target this doorman may have. More...
 

Detailed Description

Implements a Doorman, that is, a component that will listen to authentication event and react accordingly.

The reaction is somehow scriptable through the configuration file.

Definition at line 64 of file DoormanInstance.hpp.

Constructor & Destructor Documentation

◆ DoormanInstance() [1/2]

DoormanInstance::DoormanInstance ( DoormanModule module,
zmqpp::context &  ctx,
const std::string &  name,
const std::vector< std::string > &  auth_contexts,
const std::vector< DoormanAction > &  actions 
)

Create a new doorman.

Parameters
ctxZeroMQ context
namethe name of this doorman
auth_contextslist of authentication context (by name) that we wish to watch
actionslist of action to do when an event

Definition at line 27 of file DoormanInstance.cpp.

◆ DoormanInstance() [2/2]

Leosac::Module::Doorman::DoormanInstance::DoormanInstance ( const DoormanInstance )
delete

Member Function Documentation

◆ bus_sub()

zmqpp::socket & DoormanInstance::bus_sub ( )

Definition at line 58 of file DoormanInstance.cpp.

◆ command_send_recv()

void DoormanInstance::command_send_recv ( const std::string &  target_name,
zmqpp::message  msg 
)
private

Send a command to a target and wait for response.

Parameters
target_namename of target object
msgmessage containing command (and command parameter) to send

Definition at line 105 of file DoormanInstance.cpp.

◆ doors()

const std::vector< std::shared_ptr< DoormanDoor > > & DoormanInstance::doors ( ) const

Definition at line 152 of file DoormanInstance.cpp.

◆ find_target()

Leosac::Auth::AuthTargetPtr DoormanInstance::find_target ( const std::string &  name) const
private

Definition at line 124 of file DoormanInstance.cpp.

◆ handle_bus_msg()

void DoormanInstance::handle_bus_msg ( )

Activity we care about happened on the bus.

Definition at line 63 of file DoormanInstance.cpp.

◆ ignore_action()

bool DoormanInstance::ignore_action ( const DoormanAction action,
Auth::AccessStatus  status 
) const
private

Should we ignore this action.

There are multiple reason why we might wanna ignore an action:

  1. The expected status (granted / denied) does not match the received status.
  2. The door is in always_open (or alway_closed) mode.

Definition at line 134 of file DoormanInstance.cpp.

◆ operator=()

DoormanInstance& Leosac::Module::Doorman::DoormanInstance::operator= ( const DoormanInstance )
delete

Member Data Documentation

◆ actions_

std::vector<DoormanAction> Leosac::Module::Doorman::DoormanInstance::actions_
private

Definition at line 119 of file DoormanInstance.hpp.

◆ bus_sub_

zmqpp::socket Leosac::Module::Doorman::DoormanInstance::bus_sub_
private

Definition at line 121 of file DoormanInstance.hpp.

◆ doors_

std::vector<std::shared_ptr<DoormanDoor> > Leosac::Module::Doorman::DoormanInstance::doors_
private

Definition at line 107 of file DoormanInstance.hpp.

◆ name_

std::string Leosac::Module::Doorman::DoormanInstance::name_
private

Definition at line 117 of file DoormanInstance.hpp.

◆ targets_

std::map<std::string, zmqpp::socket> Leosac::Module::Doorman::DoormanInstance::targets_
private

Socket (REP) connected to each target this doorman may have.

Definition at line 126 of file DoormanInstance.hpp.


The documentation for this class was generated from the following files: