Cutelyst  3.5.0
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/cutelyst_global.h>
9 #include <Cutelyst/Plugins/Authentication/authenticationuser.h>
10 #include <Cutelyst/component.h>
11 
12 namespace Cutelyst {
13 
14 class Context;
15 class AuthenticationStore;
16 class AuthenticationCredential;
17 class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT AuthenticationRealm : public Component
18 {
19  Q_OBJECT
20 public:
22  static char *defaultRealm;
23 
28  explicit AuthenticationRealm(AuthenticationStore *store, AuthenticationCredential *credential, const QString &name = QLatin1String(defaultRealm), QObject *parent = nullptr);
29  virtual ~AuthenticationRealm() override;
30 
34  AuthenticationStore *store() const;
35 
39  AuthenticationCredential *credential() const;
40 
44  virtual AuthenticationUser findUser(Context *c, const ParamsMultiMap &userinfo);
45 
49  virtual AuthenticationUser authenticate(Context *c, const ParamsMultiMap &authinfo);
50 
54  void removePersistedUser(Context *c);
55 
59  AuthenticationUser persistUser(Context *c, const AuthenticationUser &user);
60 
64  AuthenticationUser restoreUser(Context *c, const QVariant &frozenUser);
65 
69  QVariant userIsRestorable(Context *c);
70 
71 private:
72  friend class Authentication;
73  friend class AuthenticationPrivate;
74 
75  AuthenticationStore *m_store;
76  AuthenticationCredential *m_credential;
77 };
78 
79 }
80 
81 #endif // AUTHENTICATIONREALM_H
static char * defaultRealm
default realm name
The Cutelyst Component base class.
Definition: component.h:25
The Cutelyst Context.
Definition: context.h:38
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7