cutelyst 4.8.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
11namespace Cutelyst {
12
13class Context;
16
29class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT AuthenticationRealm : public Component
30{
32public:
36 static char *defaultRealm;
37
42 explicit AuthenticationRealm(std::shared_ptr<AuthenticationStore> store,
43 std::shared_ptr<AuthenticationCredential> credential,
45 QObject *parent = nullptr);
46 ~AuthenticationRealm() override;
47
51 [[nodiscard]] std::shared_ptr<AuthenticationStore> store() const noexcept;
52
56 [[nodiscard]] std::shared_ptr<AuthenticationCredential> credential() const noexcept;
57
61 [[nodiscard]] virtual AuthenticationUser findUser(Context *c, const ParamsMultiMap &userinfo);
62
67 [[nodiscard]] virtual AuthenticationUser authenticate(Context *c,
68 const ParamsMultiMap &authinfo);
69
74
79
83 [[nodiscard]] AuthenticationUser restoreUser(Context *c, const QVariant &frozenUser);
84
88 [[nodiscard]] QVariant userIsRestorable(Context *c);
89
90private:
91 friend class Authentication;
92 friend class AuthenticationPrivate;
93
94 std::shared_ptr<AuthenticationStore> m_store;
95 std::shared_ptr<AuthenticationCredential> m_credential;
96};
97
98} // namespace Cutelyst
99
100#endif // AUTHENTICATIONREALM_H
Abstract class to validate authentication credentials like user name and password.
std::shared_ptr< AuthenticationCredential > credential() const noexcept
std::shared_ptr< AuthenticationStore > store() const noexcept
virtual AuthenticationUser authenticate(Context *c, const ParamsMultiMap &authinfo)
AuthenticationRealm(std::shared_ptr< AuthenticationStore > store, std::shared_ptr< AuthenticationCredential > credential, const QString &name=QLatin1String(defaultRealm), QObject *parent=nullptr)
AuthenticationUser persistUser(Context *c, const AuthenticationUser &user)
virtual AuthenticationUser findUser(Context *c, const ParamsMultiMap &userinfo)
AuthenticationUser restoreUser(Context *c, const QVariant &frozenUser)
Abstract class to retrieve user data from a store.
Container for user data retrieved from an AuthenticationStore.
Component(QObject *parent=nullptr)
Definition component.cpp:11
QString name() const noexcept
Definition component.cpp:33
The Cutelyst Context.
Definition context.h:42
QMultiMap< QString, QString > ParamsMultiMap
The Cutelyst namespace holds all public Cutelyst API.
QObject(QObject *parent)
Q_OBJECTQ_OBJECT
QObject * parent() const const