Leosac
0.8.0
Open Source Access Control
|
An instance of an authentication handler that use files to check whether or not access is granted or denied. More...
#include <AuthFileInstance.hpp>
Public Member Functions | |
AuthFileInstance (zmqpp::context &ctx, const std::string &auth_ctx_name, const std::list< std::string > &auth_sources_names, const std::string &auth_target_name, const std::string &input_file, CoreUtilsPtr core_utils) | |
Create a new Authenticator that watch a device and emit authentication message. More... | |
~AuthFileInstance () | |
AuthFileInstance (const AuthFileInstance &)=delete | |
AuthFileInstance & | operator= (const AuthFileInstance &)=delete |
void | handle_bus_msg () |
Something happened on the bus that we have interest into. More... | |
zmqpp::socket & | bus_sub () |
Returns the socket subscribed to the message bus. More... | |
const std::string & | auth_file_name () const |
Return the name of the file associated with the authenticator. More... | |
std::string | auth_file_content () const |
Return the content of the configuration file use for user/group and permission mapping. More... | |
Private Member Functions | |
bool | handle_kernel_message (const zmqpp::message &msg) |
Handle the message if its from Leosac's kernel, or does nothing. More... | |
void | reload_auth_config () |
Schedule an asynchronous reload of the module configuration file. More... | |
AuthResult | handle_auth (zmqpp::message *msg) noexcept |
Prepare auth source object, map them to profile and check if access is granted. More... | |
Private Attributes | |
std::mutex | mutex_ |
A mutex used only internally. More... | |
FileAuthSourceMapperPtr | mapper_ |
Authentication config file parser. More... | |
zmqpp::socket | bus_push_ |
Socket to write to the bus. More... | |
zmqpp::socket | bus_sub_ |
Socket to read from the bus. More... | |
std::string | name_ |
Name of this auth context instance. More... | |
std::string | target_name_ |
Name of the target we auth against. More... | |
std::string | file_path_ |
Path to the auth data file. More... | |
CoreUtilsPtr | core_utils_ |
An instance of an authentication handler that use files to check whether or not access is granted or denied.
This class is for INTERNAL use only (by AuthFileModule).
Definition at line 71 of file AuthFileInstance.hpp.
AuthFileInstance::AuthFileInstance | ( | zmqpp::context & | ctx, |
const std::string & | auth_ctx_name, | ||
const std::list< std::string > & | auth_sources_names, | ||
const std::string & | auth_target_name, | ||
const std::string & | input_file, | ||
CoreUtilsPtr | core_utils | ||
) |
Create a new Authenticator that watch a device and emit authentication message.
ctx | the ZeroMQ context |
auth_ctx_name | name of this authentication context. |
auth_sources_names | names of the sources devices we watch (ie wiegand reader). |
auth_target_name | name of the target (ie door) we auth against. |
input_file | path to file contain auth configuration |
core_utils | Core utilities |
Definition at line 37 of file AuthFileInstance.cpp.
AuthFileInstance::~AuthFileInstance | ( | ) |
Definition at line 62 of file AuthFileInstance.cpp.
|
delete |
std::string AuthFileInstance::auth_file_content | ( | ) | const |
Return the content of the configuration file use for user/group and permission mapping.
Definition at line 155 of file AuthFileInstance.cpp.
const std::string & AuthFileInstance::auth_file_name | ( | ) | const |
Return the name of the file associated with the authenticator.
Definition at line 164 of file AuthFileInstance.cpp.
zmqpp::socket & AuthFileInstance::bus_sub | ( | ) |
Returns the socket subscribed to the message bus.
Definition at line 104 of file AuthFileInstance.cpp.
|
privatenoexcept |
Prepare auth source object, map them to profile and check if access is granted.
noexcept
method. Will return false in case something went wrong. true
value for the boolean means access shall be granted, otherwise it shall not. The IAccessProfilePtr points to the profile used to resolve the authentication request: it may be null. Definition at line 109 of file AuthFileInstance.cpp.
void AuthFileInstance::handle_bus_msg | ( | ) |
Something happened on the bus that we have interest into.
Definition at line 67 of file AuthFileInstance.cpp.
|
private |
Handle the message if its from Leosac's kernel, or does nothing.
Returns true
if the message was handled.
Definition at line 201 of file AuthFileInstance.cpp.
|
delete |
|
private |
Schedule an asynchronous reload of the module configuration file.
Definition at line 169 of file AuthFileInstance.cpp.
|
private |
Socket to write to the bus.
Definition at line 158 of file AuthFileInstance.hpp.
|
private |
Socket to read from the bus.
Definition at line 163 of file AuthFileInstance.hpp.
|
private |
Definition at line 180 of file AuthFileInstance.hpp.
|
private |
Path to the auth data file.
Definition at line 178 of file AuthFileInstance.hpp.
|
private |
Authentication config file parser.
Definition at line 153 of file AuthFileInstance.hpp.
|
private |
A mutex used only internally.
It's needed in order to safely replace the mapper_ when reloading the configuration.
Definition at line 148 of file AuthFileInstance.hpp.
|
private |
Name of this auth context instance.
Definition at line 168 of file AuthFileInstance.hpp.
|
private |
Name of the target we auth against.
Definition at line 173 of file AuthFileInstance.hpp.