Cutelyst  2.13.0
authenticationrealm.h
1 /*
2  * Copyright (C) 2013-2017 Daniel Nicoletti <dantti12@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 #ifndef AUTHENTICATIONREALM_H
19 #define AUTHENTICATIONREALM_H
20 
21 #include <Cutelyst/cutelyst_global.h>
22 #include <Cutelyst/Plugins/Authentication/authenticationuser.h>
23 #include <Cutelyst/component.h>
24 
25 namespace Cutelyst {
26 
27 class Context;
28 class AuthenticationStore;
29 class AuthenticationCredential;
30 class CUTELYST_PLUGIN_AUTHENTICATION_EXPORT AuthenticationRealm : public Component
31 {
32  Q_OBJECT
33 public:
35  static char *defaultRealm;
36 
41  explicit AuthenticationRealm(AuthenticationStore *store, AuthenticationCredential *credential, const QString &name = QLatin1String(defaultRealm), QObject *parent = nullptr);
42  virtual ~AuthenticationRealm() override;
43 
47  AuthenticationStore *store() const;
48 
52  AuthenticationCredential *credential() const;
53 
57  virtual AuthenticationUser findUser(Context *c, const ParamsMultiMap &userinfo);
58 
62  virtual AuthenticationUser authenticate(Context *c, const ParamsMultiMap &authinfo);
63 
67  void removePersistedUser(Context *c);
68 
72  AuthenticationUser persistUser(Context *c, const AuthenticationUser &user);
73 
77  AuthenticationUser restoreUser(Context *c, const QVariant &frozenUser);
78 
82  QVariant userIsRestorable(Context *c);
83 
84 private:
85  friend class Authentication;
86  friend class AuthenticationPrivate;
87 
88  AuthenticationStore *m_store;
89  AuthenticationCredential *m_credential;
90 };
91 
92 }
93 
94 #endif // AUTHENTICATIONREALM_H
Cutelyst::ParamsMultiMap
QMap< QString, QString > ParamsMultiMap
Definition: paramsmultimap.h:36
Cutelyst::AuthenticationCredential
Definition: authentication.h:31
Cutelyst::Context
The Cutelyst Context.
Definition: context.h:50
Cutelyst::AuthenticationUser
Definition: authenticationuser.h:31
Cutelyst::Component
The Cutelyst Component base class.
Definition: component.h:38
Cutelyst::AuthenticationStore
Definition: authenticationstore.h:26
Cutelyst::AuthenticationRealm
Definition: authenticationrealm.h:30
Cutelyst::Authentication
Definition: authentication.h:49
Cutelyst
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
Cutelyst::AuthenticationRealm::defaultRealm
static char * defaultRealm
default realm name
Definition: authenticationrealm.h:35