Leosac  0.8.0
Open Source Access Control
Leosac::Auth::IAuthSourceMapper Class Referenceabstract

Base class to perform abstracted mapping operation over various AuthSource object. More...

#include <IAuthSourceMapper.hpp>

+ Inheritance diagram for Leosac::Auth::IAuthSourceMapper:
+ Collaboration diagram for Leosac::Auth::IAuthSourceMapper:

Public Member Functions

virtual ~IAuthSourceMapper ()=default
 
virtual void mapToUser (Cred::ICredentialPtr cred)=0
 Must map the ICredential data to a User. More...
 
virtual IAccessProfilePtr buildProfile (Cred::ICredentialPtr auth_source)=0
 Build an AccessProfile object given a Credential. More...
 
virtual std::vector< Leosac::Auth::GroupPtrgroups () const =0
 Return the groups this mapper is aware of. More...
 
- Public Member Functions inherited from Leosac::Tools::Visitor< WiegandCard >
virtual void visit (const VisitableT &)
 
virtual void visit (VisitableT &visitable)
 
- Public Member Functions inherited from Leosac::Tools::BaseVisitor
virtual ~BaseVisitor ()=default
 
virtual void cannot_visit (const IVisitable &)
 Invoked when the visitable cannot be visited by the visitor. More...
 
- Public Member Functions inherited from Leosac::Tools::Visitor< PINCode >
virtual void visit (const VisitableT &)
 
virtual void visit (VisitableT &visitable)
 
- Public Member Functions inherited from Leosac::Tools::Visitor< WiegandCardPin >
virtual void visit (const VisitableT &)
 
virtual void visit (VisitableT &visitable)
 

Additional Inherited Members

- Public Types inherited from Leosac::Tools::Visitor< WiegandCard >
using VisitableT = std::remove_reference_t< std::remove_const_t< WiegandCard > >
 
- Public Types inherited from Leosac::Tools::Visitor< PINCode >
using VisitableT = std::remove_reference_t< std::remove_const_t< PINCode > >
 
- Public Types inherited from Leosac::Tools::Visitor< WiegandCardPin >
using VisitableT = std::remove_reference_t< std::remove_const_t< WiegandCardPin > >
 

Detailed Description

Base class to perform abstracted mapping operation over various AuthSource object.

It uses the visitor pattern to provide a somewhat low-coupling. Each module are free to use their own implementation of IAuthSourceMapper with various backend (database, file, ...). Theses shall be able to operate on various AuthSource (card, pin code, fingerprint).

Definition at line 43 of file IAuthSourceMapper.hpp.

Constructor & Destructor Documentation

◆ ~IAuthSourceMapper()

virtual Leosac::Auth::IAuthSourceMapper::~IAuthSourceMapper ( )
virtualdefault

Member Function Documentation

◆ buildProfile()

virtual IAccessProfilePtr Leosac::Auth::IAuthSourceMapper::buildProfile ( Cred::ICredentialPtr  auth_source)
pure virtual

Build an AccessProfile object given a Credential.

How the profile is built (ie, based only on user-id, based on auth source and user-id, group membership, etc) is implementation-defined.

The caller expect a valid profile object that will behave correctly or nullptr if no profile could be built.

Implemented in Leosac::Module::Auth::FileAuthSourceMapper.

◆ groups()

virtual std::vector<Leosac::Auth::GroupPtr> Leosac::Auth::IAuthSourceMapper::groups ( ) const
pure virtual

Return the groups this mapper is aware of.

Implemented in Leosac::Module::Auth::FileAuthSourceMapper.

◆ mapToUser()

virtual void Leosac::Auth::IAuthSourceMapper::mapToUser ( Cred::ICredentialPtr  cred)
pure virtual

Must map the ICredential data to a User.

This is done by calling the owner() method on the auth source object. In case it fails, the field shall be set to nullptr.

Note
The User may be newed.

Implemented in Leosac::Module::Auth::FileAuthSourceMapper.


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