![]() |
cutelyst 5.0.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
|
Combines user store and credential validation into a named realm. More...
#include <Cutelyst/Plugins/Authentication/authenticationrealm.h>

Public Member Functions | |
| AuthenticationRealm (std::shared_ptr< AuthenticationStore > store, std::shared_ptr< AuthenticationCredential > credential, QStringView name=defaultRealm, QObject *parent=nullptr) | |
| virtual AuthenticationUser | authenticate (Context *c, const ParamsMultiMap &authinfo) |
| std::shared_ptr< AuthenticationCredential > | credential () const noexcept |
| virtual AuthenticationUser | findUser (Context *c, const ParamsMultiMap &userinfo) |
| AuthenticationUser | persistUser (Context *c, const AuthenticationUser &user) |
| void | removePersistedUser (Context *c) |
| AuthenticationUser | restoreUser (Context *c, const QVariant &frozenUser) |
| std::shared_ptr< AuthenticationStore > | store () const noexcept |
| QVariant | userIsRestorable (Context *c) |
| Public Member Functions inherited from Cutelyst::Component | |
| Component (QObject *parent=nullptr) | |
| virtual | ~Component () override |
| bool | execute (Context *c) |
| virtual bool | init (Application *application, const QVariantHash &args) |
| virtual Modifiers | modifiers () const |
| QString | name () const noexcept |
| QString | reverse () const noexcept |
| void | setName (const QString &name) |
| void | setReverse (const QString &reverse) |
Static Public Attributes | |
| static const QStringView | defaultRealm |
Friends | |
| class | Authentication |
| class | AuthenticationPrivate |
Additional Inherited Members | |
| Public Types inherited from Cutelyst::Component | |
| enum | Modifier { None , OnlyExecute , BeforeExecute , AroundExecute , AfterExecute } |
| Protected Member Functions inherited from Cutelyst::Component | |
| Component (ComponentPrivate *d, QObject *parent=nullptr) | |
| virtual bool | afterExecute (Context *c) |
| void | applyRoles (const QStack< Component * > &roles) |
| virtual bool | aroundExecute (Context *c, QStack< Component * > stack) |
| virtual bool | beforeExecute (Context *c) |
| virtual bool | dispatcherReady (const Dispatcher *dispatch, Controller *controller) |
| virtual bool | doExecute (Context *c) |
An AuthenticationRealm combines an AuthenticationStore with an AuthenticationCredential object to retrieve and validate user login data.
For an example implementation see Authentication overview.
Definition at line 29 of file authenticationrealm.h.
|
explicit |
Constructs a new AuthenticationRealm object with the given store, credential provider, name and parent.
Definition at line 20 of file authenticationrealm.cpp.
References Cutelyst::Component::Component(), credential(), Cutelyst::Component::name(), Cutelyst::Component::setName(), and store().
|
override |
Definition at line 35 of file authenticationrealm.cpp.
|
nodiscardvirtual |
Tries to authenticate the user with authinfo returning a non null AuthenticationUser on success.
Definition at line 70 of file authenticationrealm.cpp.
|
nodiscardnoexcept |
Returns the authentication credential object.
Definition at line 44 of file authenticationrealm.cpp.
Referenced by AuthenticationRealm().
|
nodiscardvirtual |
Tries to find the user with authinfo returning a non null AuthenticationUser on success.
Definition at line 49 of file authenticationrealm.cpp.
References Cutelyst::AuthenticationUser::authRealm(), Cutelyst::AuthenticationUser::isNull(), Cutelyst::Component::name(), and Cutelyst::AuthenticationUser::setAuthRealm().
Referenced by Cutelyst::CredentialPassword::authenticate().
| AuthenticationUser AuthenticationRealm::persistUser | ( | Context * | c, |
| const AuthenticationUser & | user ) |
Stores the user on the session.
Definition at line 82 of file authenticationrealm.cpp.
References Cutelyst::Session::setValue().
| void AuthenticationRealm::removePersistedUser | ( | Context * | c | ) |
Removes the user from the session.
Definition at line 75 of file authenticationrealm.cpp.
References Cutelyst::Session::deleteValues().
|
nodiscard |
Retrieves the user frozenUser from the store.
Definition at line 90 of file authenticationrealm.cpp.
References Cutelyst::AuthenticationUser::isNull(), Cutelyst::AuthenticationUser::setAuthRealm(), and userIsRestorable().
|
nodiscardnoexcept |
Returns the authentication store object.
Definition at line 39 of file authenticationrealm.cpp.
Referenced by AuthenticationRealm().
|
nodiscard |
Checks if user can be retrieved.
Definition at line 115 of file authenticationrealm.cpp.
References Cutelyst::Session::value().
Referenced by restoreUser().
|
friend |
Definition at line 91 of file authenticationrealm.h.
|
friend |
Definition at line 92 of file authenticationrealm.h.
|
static |
Default realm name.
Definition at line 36 of file authenticationrealm.h.