Leosac  0.8.0
Open Source Access Control
IAuthenticationSource.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 "tools/IVisitable.hpp"
24 #include <memory>
25 
26 namespace Leosac
27 {
28 namespace Auth
29 {
30 class IAuthenticationSource;
31 
32 using IAuthenticationSourcePtr = std::shared_ptr<IAuthenticationSource>;
33 
41 {
42  public:
43  virtual ~IAuthenticationSource() = default;
44 
48  virtual void addAuthSource(IAuthenticationSourcePtr source) = 0;
49 
53  virtual void owner(UserPtr user) = 0;
54 
58  virtual UserPtr owner() const = 0;
59 
67  virtual IAccessProfilePtr profile() const = 0;
68 
74  virtual void profile(IAccessProfilePtr p) = 0;
75 
80  virtual const std::string &name() const = 0;
81 
85  virtual std::string to_string() const = 0;
86 
91  virtual const std::string &id() const = 0;
92 
93  virtual void id(const std::string &new_id) = 0;
94 
98  virtual const ValidityInfo &validity() const = 0;
99 
103  virtual void validity(const ValidityInfo &c) = 0;
104 };
105 }
106 }
Leosac::Auth::IAuthenticationSource::name
virtual const std::string & name() const =0
Return the name of the source.
Leosac::Auth::IAuthenticationSource::to_string
virtual std::string to_string() const =0
Returns a string representation of the authentication source content.
Leosac::Auth::IAuthenticationSource::validity
virtual const ValidityInfo & validity() const =0
Get the object that store info about the credential's validity.
Leosac::Auth::IAuthenticationSource::addAuthSource
virtual void addAuthSource(IAuthenticationSourcePtr source)=0
Adds a new authentication sources as a subsource of this one.
Leosac::Auth::IAuthenticationSource::id
virtual const std::string & id() const =0
Returns the ID of the credentials.
AuthFwd.hpp
Leosac::Auth::UserPtr
std::shared_ptr< User > UserPtr
Definition: AuthFwd.hpp:31
Leosac::Auth::IAuthenticationSource::owner
virtual UserPtr owner() const =0
Retrieve the user that map to this source.
Leosac::Auth::IAccessProfilePtr
std::shared_ptr< IAccessProfile > IAccessProfilePtr
Definition: AuthFwd.hpp:88
Leosac::Auth::IAuthenticationSource::~IAuthenticationSource
virtual ~IAuthenticationSource()=default
Leosac
This is the header file for a generated source file, GitSHA1.cpp.
Definition: APIStatusCode.hpp:22
Leosac::Auth::IAuthenticationSourcePtr
std::shared_ptr< IAuthenticationSource > IAuthenticationSourcePtr
Definition: AuthFwd.hpp:96
Leosac::Tools::IVisitable
Base class to make an object visitable.
Definition: IVisitable.hpp:43
Leosac::Auth::IAuthenticationSource
An Auth source is a card id, a pin code, a fingerprint, etc...
Definition: IAuthenticationSource.hpp:40
Leosac::Auth::IAuthenticationSource::profile
virtual IAccessProfilePtr profile() const =0
Return (or generate) an Access Profile that make sense based on the data available in this Authentica...
IVisitable.hpp
Leosac::Auth::ValidityInfo
A simple class that stores (and can be queried for) the validity of some objects.
Definition: ValidityInfo.hpp:42