Leosac  0.8.0
Open Source Access Control
WebServiceNotifier.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2014-2016 Leosac
3 
4  This file is part of Leosac.
5 
6  Leosac is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Affero General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Leosac is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Affero General Public License for more details.
15 
16  You should have received a copy of the GNU Affero General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 #include "core/auth/AuthFwd.hpp"
23 #include "modules/BaseModule.hpp"
25 
26 namespace Leosac
27 {
28 namespace Module
29 {
30 namespace WSNotifier
31 {
33 {
34  public:
35  WebServiceNotifier(zmqpp::context &ctx, zmqpp::socket *pipe,
36  const boost::property_tree::ptree &cfg, CoreUtilsPtr utils);
37 
39 
40  private:
44  void handle_msg_bus();
45 
49  void process_config();
50 
55  void send_card_info_to_remote(const std::string &auth_source,
56  const std::string &card, int nb_bits);
57 
58 
62  zmqpp::socket bus_sub_;
63 
67  struct TargetInfo
68  {
69  std::string url_;
83  std::string CA_info_file_;
84  };
85 
86  std::vector<TargetInfo> targets_;
87 
88  void send_to_target(void *curl, const std::string &auth_source,
89  const Cred::RFIDCard &card,
90  const TargetInfo &target) noexcept;
91 };
92 }
93 }
94 }
Leosac::Module::WSNotifier::WebServiceNotifier::TargetInfo::url_
std::string url_
Definition: WebServiceNotifier.hpp:69
Leosac::Module::WSNotifier::WebServiceNotifier::handle_msg_bus
void handle_msg_bus()
Process a message that was read on the bus.
Definition: WebServiceNotifier.cpp:55
Leosac::Module::BaseModule
Base class for module implementation.
Definition: BaseModule.hpp:110
Leosac::Module::WSNotifier::WebServiceNotifier::TargetInfo::verify_peer_
bool verify_peer_
If SSL is enabled, do we perform certificate validation ?
Definition: WebServiceNotifier.hpp:79
AuthFwd.hpp
Leosac::Module::WSNotifier::WebServiceNotifier::WebServiceNotifier
WebServiceNotifier(zmqpp::context &ctx, zmqpp::socket *pipe, const boost::property_tree::ptree &cfg, CoreUtilsPtr utils)
Definition: WebServiceNotifier.cpp:29
RFIDCard.hpp
BaseModule.hpp
Leosac::Module::WSNotifier::WebServiceNotifier::TargetInfo::request_timeout_
int request_timeout_
Definition: WebServiceNotifier.hpp:71
Leosac::Module::WSNotifier::WebServiceNotifier::~WebServiceNotifier
~WebServiceNotifier()
Definition: WebServiceNotifier.cpp:50
Leosac::Cred::RFIDCard
An RFID card credential.
Definition: RFIDCard.hpp:33
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Module::WSNotifier::WebServiceNotifier::send_to_target
void send_to_target(void *curl, const std::string &auth_source, const Cred::RFIDCard &card, const TargetInfo &target) noexcept
Definition: WebServiceNotifier.cpp:148
Leosac::Module::WSNotifier::WebServiceNotifier::bus_sub_
zmqpp::socket bus_sub_
Read internal message bus.
Definition: WebServiceNotifier.hpp:62
Leosac::Module::WSNotifier::WebServiceNotifier
Definition: WebServiceNotifier.hpp:32
Leosac::Module::WSNotifier::WebServiceNotifier::targets_
std::vector< TargetInfo > targets_
Definition: WebServiceNotifier.hpp:86
Leosac::Module::WSNotifier::WebServiceNotifier::TargetInfo::connect_timeout_
int connect_timeout_
Definition: WebServiceNotifier.hpp:70
Leosac::Module::WSNotifier::WebServiceNotifier::TargetInfo
Some information for each webservice target.
Definition: WebServiceNotifier.hpp:67
Leosac::Module::WSNotifier::WebServiceNotifier::process_config
void process_config()
Process the configuration file.
Definition: WebServiceNotifier.cpp:79
Leosac::Module::WSNotifier::WebServiceNotifier::TargetInfo::CA_info_file_
std::string CA_info_file_
Path to a CA bundle file.
Definition: WebServiceNotifier.hpp:83
Leosac::Module::WSNotifier::WebServiceNotifier::TargetInfo::verify_host_
bool verify_host_
If SSL is enabled, do we perform certificate hostname validation ?
Definition: WebServiceNotifier.hpp:75
Leosac::Module::WSNotifier::WebServiceNotifier::send_card_info_to_remote
void send_card_info_to_remote(const std::string &auth_source, const std::string &card, int nb_bits)
Send an HTTP request to the remote webservice to let it know a card was read.
Definition: WebServiceNotifier.cpp:108
Leosac::CoreUtilsPtr
std::shared_ptr< CoreUtils > CoreUtilsPtr
Definition: LeosacFwd.hpp:35