![]() |
cutelyst 5.1.0
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|
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 () |
| bool | checkPassword (Context *c, AuthenticationRealm *realm, const QString &password, const QString &passwordField=QStringLiteral("password")) |
| 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 |
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 30 of file authenticationuser.h.
| AuthenticationUser::AuthenticationUser | ( | ) |
Constructs a new AuthenticationUser object.
Definition at line 15 of file authenticationuser.cpp.
|
explicit |
Constructs a new AuthenticationUser object with the given id.
Definition at line 19 of file authenticationuser.cpp.
References setId().
|
virtual |
Destroys the AuthenticationUser object.
Definition at line 24 of file authenticationuser.cpp.
| QString AuthenticationUser::authRealm | ( | ) |
Returns the authentication realm from which this user was retrieved.
Definition at line 43 of file authenticationuser.cpp.
Referenced by Cutelyst::AuthenticationRealm::findUser(), and setAuthRealm().
| bool AuthenticationUser::checkPassword | ( | Context * | c, |
| AuthenticationRealm * | realm, | ||
| const QString & | password, | ||
| const QString & | passwordField = QStringLiteral("password") |
||
| ) |
Validates the given password for this user in the specified realm.
This method delegates password validation to the realm, which may perform validation against the store (e.g., LDAP bind) or using the credential provider. Returns true if the password is valid.
Definition at line 53 of file authenticationuser.cpp.
References Cutelyst::AuthenticationRealm::checkPassword().
Referenced by Cutelyst::CredentialPassword::authenticate().
|
inline |
Returns the internal data object.
Definition at line 119 of file authenticationuser.h.
Referenced by Cutelyst::StoreLDAP::forSession(), and setData().
| QVariant AuthenticationUser::id | ( | ) | const |
A unique ID by which a AuthenticationUser can be retrieved from the store.
Definition at line 28 of file authenticationuser.cpp.
Referenced by Cutelyst::StoreMinimal::findUser(), Cutelyst::StoreHtpasswd::forSession(), and Cutelyst::StoreMinimal::forSession().
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 129 of file authenticationuser.h.
References value().
Referenced by Cutelyst::StoreHtpasswd::findUser().
| bool AuthenticationUser::isNull | ( | ) | const |
Returns true if the object is null.
Definition at line 38 of file authenticationuser.cpp.
Referenced by Cutelyst::CredentialHttp::authenticate(), Cutelyst::CredentialPassword::authenticate(), Cutelyst::Authentication::authenticate(), Cutelyst::AuthenticationRealm::findUser(), Cutelyst::AuthenticationRealm::restoreUser(), and Cutelyst::Authentication::user().
|
inline |
Definition at line 113 of file authenticationuser.h.
| void AuthenticationUser::setAuthRealm | ( | const QString & | authRealm | ) |
Sets the authentication realm from which this user was retrieved.
Definition at line 48 of file authenticationuser.cpp.
References authRealm().
Referenced by Cutelyst::AuthenticationRealm::findUser(), and Cutelyst::AuthenticationRealm::restoreUser().
|
inline |
Directly sets the internal data object.
Definition at line 124 of file authenticationuser.h.
References data().
Referenced by Cutelyst::StoreLDAP::fromSession().
| void AuthenticationUser::setId | ( | const QVariant & | id | ) |
Sets the unique user id restored from the store
Definition at line 33 of file authenticationuser.cpp.
Referenced by AuthenticationUser(), and Cutelyst::StoreHtpasswd::findUser().
|
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 134 of file authenticationuser.h.
Referenced by Cutelyst::RoleACL::canVisit(), insert(), Cutelyst::Authentication::user(), and Cutelyst::StoreLDAP::validatePassword().
|
protected |
Definition at line 116 of file authenticationuser.h.