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

Container for user data retrieved from an AuthenticationStore. More...

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

Public Member Functions

 AuthenticationUser ()
 
 AuthenticationUser (const QVariant &id)
 
virtual ~AuthenticationUser ()
 
QString authRealm ()
 
QVariantMap data () const
 
QVariant id () const
 
void insert (const QString &key, const QVariant &value)
 
bool isNull () const
 
 operator QVariant () const
 
void setAuthRealm (const QString &authRealm)
 
void setData (const QVariantMap &data)
 
void setId (const QVariant &id)
 
QVariant value (const QString &key, const QVariant &defaultValue=QVariant()) const
 

Protected Attributes

QVariantMap m_data
 

Detailed Description

Create this object in your reimplementation of AuthenticationStore::findUser() and populate it with the data retrieved from your store.

For an example implementation see Authentication overview.

Definition at line 29 of file authenticationuser.h.

Constructor & Destructor Documentation

◆ AuthenticationUser() [1/2]

AuthenticationUser::AuthenticationUser ( )

Constructs a new AuthenticationUser object.

Definition at line 12 of file authenticationuser.cpp.

◆ AuthenticationUser() [2/2]

AuthenticationUser::AuthenticationUser ( const QVariant id)

Constructs a new AuthenticationUser object with the given id.

Definition at line 16 of file authenticationuser.cpp.

References setId().

◆ ~AuthenticationUser()

AuthenticationUser::~AuthenticationUser ( )
virtual

Destroys the AuthenticationUser object.

Definition at line 21 of file authenticationuser.cpp.

Member Function Documentation

◆ authRealm()

QString AuthenticationUser::authRealm ( )

Returns the authentication realm from which this user was retrieved.

Definition at line 40 of file authenticationuser.cpp.

Referenced by Cutelyst::AuthenticationRealm::findUser(), and setAuthRealm().

◆ data()

QVariantMap Cutelyst::AuthenticationUser::data ( ) const
inline

Returns the internal data object.

Definition at line 106 of file authenticationuser.h.

Referenced by setData().

◆ id()

QVariant AuthenticationUser::id ( ) const

A unique ID by which a AuthenticationUser can be retrieved from the store.

Definition at line 25 of file authenticationuser.cpp.

Referenced by Cutelyst::StoreHtpasswd::forSession(), and Cutelyst::StoreMinimal::forSession().

◆ insert()

void Cutelyst::AuthenticationUser::insert ( const QString key,
const QVariant value 
)
inline

Inserts a new item with the key key and a value of value.

If there is already an item with the key key, that item's value is replaced with value.

Definition at line 116 of file authenticationuser.h.

References value().

Referenced by Cutelyst::StoreHtpasswd::findUser().

◆ isNull()

◆ operator QVariant()

Cutelyst::AuthenticationUser::operator QVariant ( ) const
inline

Definition at line 100 of file authenticationuser.h.

◆ setAuthRealm()

void AuthenticationUser::setAuthRealm ( const QString authRealm)

Sets the authentication realm from which this user was retrieved.

Definition at line 45 of file authenticationuser.cpp.

References authRealm().

Referenced by Cutelyst::AuthenticationRealm::findUser(), and Cutelyst::AuthenticationRealm::restoreUser().

◆ setData()

void Cutelyst::AuthenticationUser::setData ( const QVariantMap &  data)
inline

Directly sets the internal data object.

Definition at line 111 of file authenticationuser.h.

References data().

◆ setId()

void AuthenticationUser::setId ( const QVariant id)

Sets the unique user id restored from the store

Definition at line 30 of file authenticationuser.cpp.

Referenced by AuthenticationUser(), and Cutelyst::StoreHtpasswd::findUser().

◆ value()

QVariant Cutelyst::AuthenticationUser::value ( const QString key,
const QVariant defaultValue = QVariant() 
) const
inline

Returns the value associated with the key key.

If the internal map contains no item with key key, the function returns defaultValue. If no defaultValue is specified, the function returns a default-constructed value.

Definition at line 121 of file authenticationuser.h.

Referenced by Cutelyst::RoleACL::canVisit(), insert(), Cutelyst::Authentication::user(), and Cutelyst::Authentication::userInRealm().

Member Data Documentation

◆ m_data

QVariantMap Cutelyst::AuthenticationUser::m_data
protected

Definition at line 103 of file authenticationuser.h.