identityinfo.h
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  */
28 #ifndef IDENTITY_INFO_H
29 #define IDENTITY_INFO_H
30 
31 #include <QStringList>
32 #include <QMetaType>
33 
34 #include "libsignoncommon.h"
35 
36 namespace SignOn {
37 
42 typedef QString MethodName;
43 
48 typedef QStringList MechanismsList;
49 
57 class SIGNON_EXPORT IdentityInfo
58 {
59  friend class AuthServiceImpl;
60  friend class IdentityImpl;
61 
62 public:
70  Other = 0,
71  Application = 1 << 0,
72  Web = 1 << 1,
73  Network = 1 << 2
74  };
75 
76 public:
80  IdentityInfo();
81 
85  IdentityInfo(const IdentityInfo &other);
86 
90  IdentityInfo &operator=(const IdentityInfo &other);
91 
98  IdentityInfo(const QString &caption, const QString &userName,
99  const QMap<MethodName,MechanismsList> &methods);
100 
104  ~IdentityInfo();
105 
112  void setId(const quint32 id);
113 
118  quint32 id() const;
119 
134  void setSecret(const QString &secret, const bool storeSecret = true);
135 
141  QString secret() const;
142 
147  bool isStoringSecret() const;
148 
153  void setStoreSecret(const bool storeSecret);
154 
161  void setUserName(const QString &userName);
162 
167  const QString userName() const;
168 
173  void setCaption(const QString &caption);
174 
179  const QString caption() const;
180 
187  void setRealms(const QStringList &realms);
188 
195  QStringList realms() const;
196 
203  void setOwner(const QString &ownerToken);
204 
214  QString owner() const;
215 
223  void setAccessControlList(const QStringList &accessControlList);
224 
234  QStringList accessControlList() const;
235 
246  void setMethod(const MethodName &method,
247  const MechanismsList &mechanismsList);
248 
253  void removeMethod(const MethodName &method);
254 
265  void setType(CredentialsType type);
266 
271  CredentialsType type() const;
272 
277  QList<MethodName> methods() const;
278 
284  MechanismsList mechanisms(const MethodName &method) const;
285 
295  void setRefCount(qint32 refCount);
296 
301  qint32 refCount() const;
302 
303 private:
304  class IdentityInfoImpl *impl;
305 };
306 
307 } // namespace SignOn
308 
309 Q_DECLARE_METATYPE(SignOn::IdentityInfo)
310 
311 #endif /* IDENTITY_INFO_H */
QStringList MechanismsList
Defines a string list as a list of mechanisms.
Definition: identityinfo.h:48
QString MethodName
Defines a string as an authentication method.
Definition: identityinfo.h:42
CredentialsType
Values used to describe the type of the identity.
Definition: identityinfo.h:69
Contains identity information.
Definition: identityinfo.h:57