cutelyst 3.9.1
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.
authenticationrealm.h
1/*
2 * SPDX-FileCopyrightText: (C) 2013-2022 Daniel Nicoletti <dantti12@gmail.com>
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5#ifndef AUTHENTICATIONREALM_H
6#define AUTHENTICATIONREALM_H
7
8#include <Cutelyst/Plugins/Authentication/authenticationuser.h>
9#include <Cutelyst/component.h>
10#include <Cutelyst/cutelyst_global.h>
11
12namespace Cutelyst {
13
14class Context;
17class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT AuthenticationRealm : public Component
18{
20public:
22 static char *defaultRealm;
23
31 QObject *parent = nullptr);
32 virtual ~AuthenticationRealm() override;
33
38
43
47 virtual AuthenticationUser findUser(Context *c, const ParamsMultiMap &userinfo);
48
53 virtual AuthenticationUser authenticate(Context *c, const ParamsMultiMap &authinfo);
54
59
64
68 AuthenticationUser restoreUser(Context *c, const QVariant &frozenUser);
69
74
75private:
76 friend class Authentication;
77 friend class AuthenticationPrivate;
78
79 AuthenticationStore *m_store;
80 AuthenticationCredential *m_credential;
81};
82
83} // namespace Cutelyst
84
85#endif // AUTHENTICATIONREALM_H
AuthenticationCredential * credential() const
Returns the authentication credential object.
AuthenticationRealm(AuthenticationStore *store, AuthenticationCredential *credential, const QString &name=QLatin1String(defaultRealm), QObject *parent=nullptr)
Constructs a new AuthenticationRealm object with the given parent.
void removePersistedUser(Context *c)
Removes the user from the session.
virtual AuthenticationUser authenticate(Context *c, const ParamsMultiMap &authinfo)
Tries to authenticate the user with authinfo returning a non null AuthenticationUser on success.
static char * defaultRealm
default realm name
AuthenticationStore * store() const
Returns the authentication store object.
QVariant userIsRestorable(Context *c)
Checks if user can be retrieved.
AuthenticationUser persistUser(Context *c, const AuthenticationUser &user)
Stores the user on the session.
virtual AuthenticationUser findUser(Context *c, const ParamsMultiMap &userinfo)
Tries to find the user with authinfo returning a non null AuthenticationUser on success.
AuthenticationUser restoreUser(Context *c, const QVariant &frozenUser)
Retrieves the user from the store.
Component(QObject *parent=nullptr)
Definition component.cpp:11
QString name() const
Definition component.cpp:33
The Cutelyst Context.
Definition context.h:39
The Cutelyst namespace holds all public Cutelyst API.
Definition Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const