lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
lintel::AuthService Class Reference

#include <AuthService.h>

Inheritance diagram for lintel::AuthService:
lintel::IAuthService lintel::PropertyRegistration< AuthService > lintel::AbstractService< T > lintel::AbstractServiceInterface

Public Member Functions

 AuthService (const std::shared_ptr< ProcessName > &processName, std::shared_ptr< UserRepository > userRepository, std::shared_ptr< SchedulerService > schedulerService)
 
virtual ~AuthService ()=default
 
std::optional< UserToken > onLoginOf (const UserLogin &userLogin)
 
std::optional< UserToken > onAccessOf (const UserTokenLogin &userTokenLogin)
 
void onLogoutOf (const UserTokenLogin &userToken) override
 
std::vector< UserToken > allTokensOf (const std::string &userName) override
 
void revokeTokenOf (const std::string &id) override
 
void onInitialize () override
 
void onShutdown () override
 
- Public Member Functions inherited from lintel::IAuthService
virtual ~IAuthService ()=default
 
- Public Member Functions inherited from lintel::AbstractService< T >
 AbstractService ()=delete
 
 AbstractService (std::string processName, std::string instanceName)
 
 AbstractService (std::string processName)
 
ShutdownPriority shutdownPriorityOf () const override
 
const std::string & getProcessName () const override
 
const std::string & getInstanceName () const override
 
std::string_view getClassName () const override
 
- Public Member Functions inherited from lintel::AbstractServiceInterface
virtual ~AbstractServiceInterface ()=default
 

Additional Inherited Members

- Protected Member Functions inherited from lintel::PropertyRegistration< AuthService >
std::shared_ptr< Property< type > > registerProperty (std::string name, type defaultValue, std::string description, bool runtime, const std::string &fileName, int32_t position)
 
- Protected Attributes inherited from lintel::AbstractService< T >
std::vector< std::shared_ptr< PropertyBase > > m_properties
 

Detailed Description

Authentication service managing user login, access tokens, and session timeouts.

Constructor & Destructor Documentation

◆ AuthService()

lintel::AuthService::AuthService ( const std::shared_ptr< ProcessName > &  processName,
std::shared_ptr< UserRepository >  userRepository,
std::shared_ptr< SchedulerService >  schedulerService 
)

Constructor.

Parameters
processNamecurrent process name
userRepositoryuser repository
schedulerServicescheduler for periodic token checks

◆ ~AuthService()

virtual lintel::AuthService::~AuthService ( )
virtualdefault

Member Function Documentation

◆ allTokensOf()

std::vector< UserToken > lintel::AuthService::allTokensOf ( const std::string &  userName)
overridevirtual

Get all active sessions of a user.

Parameters
userNamethe username
Returns
list of active tokens of the user

Implements lintel::IAuthService.

◆ onAccessOf()

std::optional< UserToken > lintel::AuthService::onAccessOf ( const UserTokenLogin &  userTokenLogin)
virtual

Validate an existing user token for access.

Parameters
userTokenLogintoken to validate
Returns
the user token if valid

Implements lintel::IAuthService.

◆ onInitialize()

void lintel::AuthService::onInitialize ( )
overridevirtual

Default initialization does nothing; override in subclasses.

Reimplemented from lintel::AbstractService< T >.

◆ onLoginOf()

std::optional< UserToken > lintel::AuthService::onLoginOf ( const UserLogin &  userLogin)
virtual

Authenticate a user with username and password.

Parameters
userLoginlogin credentials
Returns
a user token if authentication succeeds

Implements lintel::IAuthService.

◆ onLogoutOf()

void lintel::AuthService::onLogoutOf ( const UserTokenLogin &  userToken)
overridevirtual

Log out and invalidate a user token.

Parameters
userTokentoken to invalidate

Implements lintel::IAuthService.

◆ onShutdown()

void lintel::AuthService::onShutdown ( )
overridevirtual

Default shutdown does nothing; override in subclasses.

Reimplemented from lintel::AbstractService< T >.

◆ revokeTokenOf()

void lintel::AuthService::revokeTokenOf ( const std::string &  id)
overridevirtual

Revoke a session by its token id.

Parameters
idthe token id to revoke

Implements lintel::IAuthService.


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