Cutelyst  1.11.0
authenticationuser.cpp
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 #include "authenticationuser.h"
19 
20 #include <QtCore/QDataStream>
21 
22 using namespace Cutelyst;
23 
25 {
26 
27 }
28 
30  m_id(id)
31 {
32 
33 }
34 
35 AuthenticationUser::~AuthenticationUser()
36 {
37 }
38 
39 QString AuthenticationUser::id() const
40 {
41  return m_id;
42 }
43 
44 void AuthenticationUser::setId(const QString &id)
45 {
46  m_id = id;
47 }
48 
50 {
51  return m_id.isEmpty();
52 }
53 
55 {
56  return m_realm;
57 }
58 
60 {
61  m_realm = authRealm;
62 }
63 
64 bool AuthenticationUser::checkPassword(const QString &password) const
65 {
66  Q_UNUSED(password)
67  return false;
68 }
69 
70 QDataStream &operator<<(QDataStream &out, const AuthenticationUser &user)
71 {
72  out << user.id() << static_cast<QVariantMap>(user);
73  return out;
74 }
75 
76 QDataStream &operator>>(QDataStream &in, AuthenticationUser &user)
77 {
78  QString id;
79  QVariantMap map;
80  in >> id >> map;
81  user.setId(id);
82  user.swap(map);
83  return in;
84 }
virtual bool checkPassword(const QString &password) const
Verifies the user password.
AuthenticationRealm * authRealm()
Returns the authentication realm from which this user was retrieved.
void setAuthRealm(AuthenticationRealm *authRealm)
Sets the authentication realm from which this user was retrieved.
The Cutelyst namespace holds all public Cutelyst API.
Definition: Mainpage.dox:7
bool isNull() const
Returns true if the object is null.
void setId(const QString &id)
Sets the unique user id restored from the store.
AuthenticationUser()
Constructs a new AuthenticationUser object.