cutelyst 4.0.0
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;
15class AuthenticationStore;
16class AuthenticationCredential;
17class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT AuthenticationRealm : public Component
18{
19 Q_OBJECT
20public:
22 static char *defaultRealm;
23
28 explicit AuthenticationRealm(std::shared_ptr<AuthenticationStore> store,
29 std::shared_ptr<AuthenticationCredential> credential,
30 const QString &name = QLatin1String(defaultRealm),
31 QObject *parent = nullptr);
32 ~AuthenticationRealm() override;
33
37 [[nodiscard]] std::shared_ptr<AuthenticationStore> store() const noexcept;
38
42 [[nodiscard]] std::shared_ptr<AuthenticationCredential> credential() const noexcept;
43
47 [[nodiscard]] virtual AuthenticationUser findUser(Context *c, const ParamsMultiMap &userinfo);
48
53 [[nodiscard]] virtual AuthenticationUser authenticate(Context *c,
54 const ParamsMultiMap &authinfo);
55
59 void removePersistedUser(Context *c);
60
64 AuthenticationUser persistUser(Context *c, const AuthenticationUser &user);
65
69 [[nodiscard]] AuthenticationUser restoreUser(Context *c, const QVariant &frozenUser);
70
74 [[nodiscard]] QVariant userIsRestorable(Context *c);
75
76private:
77 friend class Authentication;
78 friend class AuthenticationPrivate;
79
80 std::shared_ptr<AuthenticationStore> m_store;
81 std::shared_ptr<AuthenticationCredential> m_credential;
82};
83
84} // namespace Cutelyst
85
86#endif // AUTHENTICATIONREALM_H
static char * defaultRealm
default realm name
The Cutelyst Component base class.
Definition: component.h:26
The Cutelyst Context.
Definition: context.h:38
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:8
QMultiMap< QString, QString > ParamsMultiMap