signon  8.54
signonidentityinfo.h
Go to the documentation of this file.
1 /*
2  * This file is part of signon
3  *
4  * Copyright (C) 2009-2010 Nokia Corporation.
5  *
6  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
7  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * version 2.1 as published by the Free Software Foundation.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23 #ifndef SIGNONIDENTITYINFO_H
24 #define SIGNONIDENTITYINFO_H
25 
26 #include <QMap>
27 #include <QStringList>
28 #include <QVariant>
29 
30 #include "signond/signoncommon.h"
31 
32 namespace SignonDaemonNS {
33 
34 typedef QString MethodName;
35 typedef QStringList MechanismsList;
37 
44 {
46  SignonIdentityInfo(const QVariantMap &info);
47  SignonIdentityInfo(const quint32 id,
48  const QString &userName,
49  const QString &password,
50  const bool storePassword,
51  const QString &caption,
52  const MethodMap &methods,
53  const QStringList &realms = QStringList(),
54  const QStringList &accessControlList = QStringList(),
55  const QStringList &ownerList = QStringList(),
56  int type = 0,
57  int refCount = 0,
58  bool validated = false);
59 
60  const QVariantMap toMap() const;
61 
62  bool operator== (const SignonIdentityInfo &other) const;
64 
65  void setNew() { m_id = SIGNOND_NEW_IDENTITY; }
66  bool isNew() const { return m_id == SIGNOND_NEW_IDENTITY; }
67  void setId(quint32 id) { m_id = id; }
68  quint32 id() const { return m_id; }
69 
70  void setUserName(const QString &userName) { m_userName = userName; }
71  QString userName() const { return m_userName; }
72  void setUserNameSecret(bool secret) { m_isUserNameSecret = secret; }
73  bool isUserNameSecret() const { return m_isUserNameSecret; }
74 
75  void setPassword(const QString &password) { m_password = password; }
76  QString password() const { return m_password; }
77  void setStorePassword(bool storePassword) {
78  m_storePassword = storePassword;
79  }
80  bool storePassword() const { return m_storePassword; }
81 
82  void setCaption(const QString &caption) { m_caption = caption; }
83  QString caption() const { return m_caption; }
84 
85  void setRealms(const QStringList &realms) { m_realms = realms; }
86  QStringList realms() const { return m_realms; }
87 
88  void setMethods(const MethodMap &methods)
89  { m_methods = methods; }
90  MethodMap methods() const { return m_methods; }
91 
92  void setAccessControlList(const QStringList &acl)
93  { m_accessControlList = acl; }
94  QStringList accessControlList() const { return m_accessControlList; }
95 
96  void setValidated(bool validated) { m_validated = validated; }
97  bool validated() const { return m_validated; }
98 
99  void setType(const int type) { m_type = type; }
100  int type() const { return m_type; }
101 
102  void setOwnerList(const QStringList &owner) { m_ownerList = owner; }
103  QStringList ownerList() const { return m_ownerList; }
104 
105  bool checkMethodAndMechanism(const QString &method,
106  const QString &mechanism,
107  QString &allowedMechanism);
108 
109 private:
110  quint32 m_id;
111  QString m_userName;
112  QString m_password;
113  bool m_storePassword;
114  QString m_caption;
115  MethodMap m_methods;
116  QStringList m_realms;
117  QStringList m_accessControlList;
118  QStringList m_ownerList;
119  int m_type;
120  int m_refCount;
121  bool m_validated;
122  bool m_isUserNameSecret;
123 }; //struct SignonIdentityInfo
124 
125 } //namespace SignonDaemonNS
126 
127 Q_DECLARE_METATYPE(SignonDaemonNS::MethodMap)
128 
129 #endif // SIGNONIDENTITYINFO_H
QStringList MechanismsList
void setRealms(const QStringList &realms)
void setStorePassword(bool storePassword)
void setMethods(const MethodMap &methods)
void setCaption(const QString &caption)
void setOwnerList(const QStringList &owner)
bool checkMethodAndMechanism(const QString &method, const QString &mechanism, QString &allowedMechanism)
void setPassword(const QString &password)
void setAccessControlList(const QStringList &acl)
QMap< MethodName, MechanismsList > MethodMap
Daemon side representation of identity information.
SignonIdentityInfo & operator=(const SignonIdentityInfo &other)
void setUserName(const QString &userName)
bool operator==(const SignonIdentityInfo &other) const