cutelyst 5.0.1
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 13 of file authenticationuser.cpp.

◆ AuthenticationUser() [2/2]

AuthenticationUser::AuthenticationUser ( const QVariant & id)
explicit

Constructs a new AuthenticationUser object with the given id.

Definition at line 17 of file authenticationuser.cpp.

References setId().

◆ ~AuthenticationUser()

AuthenticationUser::~AuthenticationUser ( )
virtual

Destroys the AuthenticationUser object.

Definition at line 22 of file authenticationuser.cpp.

Member Function Documentation

◆ authRealm()

QString AuthenticationUser::authRealm ( )
nodiscard

Returns the authentication realm from which this user was retrieved.

Definition at line 41 of file authenticationuser.cpp.

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

◆ data()

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

Returns the internal data object.

Definition at line 106 of file authenticationuser.h.

Referenced by setData().

◆ id()

QVariant AuthenticationUser::id ( ) const
nodiscard

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

Definition at line 26 of file authenticationuser.cpp.

References QVariant::value().

Referenced by Cutelyst::StoreMinimal::findUser(), 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 46 of file authenticationuser.cpp.

References authRealm(), and QString::insert().

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 31 of file authenticationuser.cpp.

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

◆ value()

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

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.

References QVariant::value().

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

Member Data Documentation

◆ m_data

QVariantMap Cutelyst::AuthenticationUser::m_data
protected

Definition at line 103 of file authenticationuser.h.