cutelyst  4.5.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
Cutelyst::AuthenticationStore Class Referenceabstract

Abstract class to retrieve user data from a store. More...

#include <Cutelyst/Plugins/Authentication/authenticationstore.h>

Inheritance diagram for Cutelyst::AuthenticationStore:

Public Member Functions

 AuthenticationStore ()
 
virtual ~AuthenticationStore ()
 
virtual AuthenticationUser autoCreateUser (Context *c, const ParamsMultiMap &userinfo) const
 
virtual AuthenticationUser autoUpdateUser (Context *c, const ParamsMultiMap &userinfo) const
 
virtual bool canAutoCreateUser () const
 
virtual bool canAutoUpdateUser () const
 
virtual AuthenticationUser findUser (Context *c, const ParamsMultiMap &userinfo)=0
 
virtual QVariant forSession (Context *c, const AuthenticationUser &user)
 
virtual AuthenticationUser fromSession (Context *c, const QVariant &frozenUser)
 

Detailed Description

Use this class to create your own user store. Reimplement the pure virtual function findUser() to retrieve user data from a storage like a file or a database.

For an example implementation see Authentication overview.

Definition at line 21 of file authenticationstore.h.

Constructor & Destructor Documentation

◆ AuthenticationStore()

AuthenticationStore::AuthenticationStore ( )

Constructs a new AuthenticationStore object.

Definition at line 11 of file authenticationstore.cpp.

◆ ~AuthenticationStore()

AuthenticationStore::~AuthenticationStore ( )
virtual

Destroys the AuthenticationStore object.

Definition at line 15 of file authenticationstore.cpp.

Member Function Documentation

◆ autoCreateUser()

AuthenticationUser AuthenticationStore::autoCreateUser ( Context c,
const ParamsMultiMap userinfo 
) const
virtual

Reimplement this if your store supports automatic user creation.

Definition at line 24 of file authenticationstore.cpp.

◆ autoUpdateUser()

AuthenticationUser AuthenticationStore::autoUpdateUser ( Context c,
const ParamsMultiMap userinfo 
) const
virtual

Reimplement this if your store supports automatic user update.

Definition at line 37 of file authenticationstore.cpp.

◆ canAutoCreateUser()

bool AuthenticationStore::canAutoCreateUser ( ) const
virtual

Reimplement this if your store supports automatic user creation.

Definition at line 19 of file authenticationstore.cpp.

◆ canAutoUpdateUser()

bool AuthenticationStore::canAutoUpdateUser ( ) const
virtual

Reimplement this if your store supports automatic user update.

Definition at line 32 of file authenticationstore.cpp.

◆ findUser()

virtual AuthenticationUser Cutelyst::AuthenticationStore::findUser ( Context c,
const ParamsMultiMap userinfo 
)
pure virtual

Retrieve the user that matches the userinfo.

Implemented in Cutelyst::StoreMinimal, and Cutelyst::StoreHtpasswd.

◆ forSession()

QVariant AuthenticationStore::forSession ( Context c,
const AuthenticationUser user 
)
virtual

Reimplement this so that you return a serializable value that can be used to identify the user. The default implementation just returns the user.

Reimplemented in Cutelyst::StoreMinimal, and Cutelyst::StoreHtpasswd.

Definition at line 45 of file authenticationstore.cpp.

References QVariant::fromValue().

◆ fromSession()

AuthenticationUser AuthenticationStore::fromSession ( Context c,
const QVariant frozenUser 
)
virtual

Reimplement this so that you return a User that was stored in the session.

The default implementation just returns the user.

Reimplemented in Cutelyst::StoreMinimal, and Cutelyst::StoreHtpasswd.

Definition at line 51 of file authenticationstore.cpp.

References QVariant::value().