Leosac  0.8.0
Open Source Access Control
AuthSourceBuilder.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 
22 #include <zmqpp/message.hpp>
23 
24 #pragma once
25 
26 namespace Leosac
27 {
28 namespace Auth
29 {
38 {
39  public:
40  explicit AuthSourceBuilder() = default;
41  virtual ~AuthSourceBuilder() = default;
42  AuthSourceBuilder(const AuthSourceBuilder &) = delete;
46 
52  virtual Cred::ICredentialPtr create(zmqpp::message *msg);
53 
60  bool extract_source_name(const std::string &input, std::string *output) const;
61 
62  protected:
68  Cred::ICredentialPtr create_simple_wiegand(const std::string &name,
69  zmqpp::message *msg);
70 
74  Cred::ICredentialPtr create_pincode(const std::string &name,
75  zmqpp::message *msg);
76 
80  Cred::ICredentialPtr create_wiegand_card_pin(const std::string &name,
81  zmqpp::message *msg);
82 
83  Cred::ICredentialPtr create_simple_csn(const std::string &name,
84  zmqpp::message *msg);
85 };
86 }
87 }
Leosac::Auth::AuthSourceBuilder::AuthSourceBuilder
AuthSourceBuilder()=default
Leosac::Auth::AuthSourceBuilder::create
virtual Cred::ICredentialPtr create(zmqpp::message *msg)
Create a Credential object from a message.
Definition: AuthSourceBuilder.cpp:52
Leosac::Auth::AuthSourceBuilder::create_simple_csn
Cred::ICredentialPtr create_simple_csn(const std::string &name, zmqpp::message *msg)
Definition: AuthSourceBuilder.cpp:33
Leosac::Auth::AuthSourceBuilder::extract_source_name
bool extract_source_name(const std::string &input, std::string *output) const
Extract the source name from the frame.
Definition: AuthSourceBuilder.cpp:79
Leosac::Auth::AuthSourceBuilder::create_pincode
Cred::ICredentialPtr create_pincode(const std::string &name, zmqpp::message *msg)
Create an auth source from WIEGAND_PIN data type.
Definition: AuthSourceBuilder.cpp:109
ICredential.hpp
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Auth::AuthSourceBuilder::create_simple_wiegand
Cred::ICredentialPtr create_simple_wiegand(const std::string &name, zmqpp::message *msg)
Create an auth source from SIMPLE_WIEGAND data type.
Definition: AuthSourceBuilder.cpp:92
Leosac::Auth::AuthSourceBuilder
This class is some kind of factory to create IAuthenticationSource object from a zmqpp::message sent ...
Definition: AuthSourceBuilder.hpp:37
Leosac::Auth::AuthSourceBuilder::operator=
AuthSourceBuilder & operator=(const AuthSourceBuilder &)=delete
Leosac::Cred::ICredentialPtr
std::shared_ptr< ICredential > ICredentialPtr
Definition: CredentialFwd.hpp:32
Leosac::Auth::AuthSourceBuilder::create_wiegand_card_pin
Cred::ICredentialPtr create_wiegand_card_pin(const std::string &name, zmqpp::message *msg)
Create an auth source from a WiegandCard and PIN Code.
Definition: AuthSourceBuilder.cpp:126
Leosac::Auth::AuthSourceBuilder::~AuthSourceBuilder
virtual ~AuthSourceBuilder()=default
IAuthenticationSource.hpp