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 
110  quint32 id() const;
111 
126  void setSecret(const QString &secret, const bool storeSecret = true);
127 
132  bool isStoringSecret() const;
133 
138  void setStoreSecret(const bool storeSecret);
139 
146  void setUserName(const QString &userName);
147 
152  const QString userName() const;
153 
158  void setCaption(const QString &caption);
159 
164  const QString caption() const;
165 
172  void setRealms(const QStringList &realms);
173 
180  QStringList realms() const;
181 
188  void setOwner(const QString &ownerToken);
189 
199  QString owner() const;
200 
208  void setAccessControlList(const QStringList &accessControlList);
209 
219  QStringList accessControlList() const;
220 
231  void setMethod(const MethodName &method,
232  const MechanismsList &mechanismsList);
233 
238  void removeMethod(const MethodName &method);
239 
250  void setType(CredentialsType type);
251 
256  CredentialsType type() const;
257 
262  QList<MethodName> methods() const;
263 
269  MechanismsList mechanisms(const MethodName &method) const;
270 
280  void setRefCount(qint32 refCount);
281 
286  qint32 refCount() const;
287 
288 private:
289  void setId(const quint32 id);
290  const QString secret() const;
291 
292 private:
293  class IdentityInfoImpl *impl;
294 };
295 
296 } // namespace SignOn
297 
298 Q_DECLARE_METATYPE(SignOn::IdentityInfo)
299 
300 #endif /* IDENTITY_INFO_H */