My Project
identityinfo.h
1 /*
2  * This file is part of signon
3  *
4  * Copyright (C) 2009-2010 Nokia Corporation.
5  * Copyright (C) 2011-2016 Canonical Ltd.
6  *
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 <QMetaType>
32 #include <QStringList>
33 
34 #include "libsignoncommon.h"
35 #include "securitycontext.h"
36 
37 namespace SignOn {
38 
43 typedef QString MethodName;
44 
49 typedef QStringList MechanismsList;
50 
55 typedef QList<SecurityContext> SecurityContextList;
56 
64 class SIGNON_EXPORT IdentityInfo
65 {
66  friend class AuthServiceImpl;
67  friend class IdentityImpl;
68 
69 public:
77  Other = 0,
78  Application = 1 << 0,
79  Web = 1 << 1,
80  Network = 1 << 2
81  };
82 
83 public:
87  IdentityInfo();
88 
92  IdentityInfo(const IdentityInfo &other);
93 
97  IdentityInfo &operator=(const IdentityInfo &other);
98 
105  IdentityInfo(const QString &caption, const QString &userName,
106  const QMap<MethodName,MechanismsList> &methods);
107 
111  ~IdentityInfo();
112 
119  void setId(const quint32 id);
120 
125  quint32 id() const;
126 
141  void setSecret(const QString &secret, const bool storeSecret = true);
142 
148  QString secret() const;
149 
154  bool isStoringSecret() const;
155 
160  void setStoreSecret(const bool storeSecret);
161 
168  void setUserName(const QString &userName);
169 
174  const QString userName() const;
175 
180  void setCaption(const QString &caption);
181 
186  const QString caption() const;
187 
194  void setRealms(const QStringList &realms);
195 
202  QStringList realms() const;
203 
210  void setOwner(const QString &ownerToken);
211 
221  QString owner() const;
222 
230  void setAccessControlList(const QStringList &accessControlList);
231 
239  void setAccessControlList(const SecurityContextList &accessControlList);
240 
250  QStringList accessControlList() const;
251 
261  SecurityContextList accessControlListFull() const;
262 
273  void setMethod(const MethodName &method,
274  const MechanismsList &mechanismsList);
275 
280  void removeMethod(const MethodName &method);
281 
292  void setType(CredentialsType type);
293 
298  CredentialsType type() const;
299 
304  QList<MethodName> methods() const;
305 
311  MechanismsList mechanisms(const MethodName &method) const;
312 
322  void setRefCount(qint32 refCount);
323 
328  qint32 refCount() const;
329 
330 private:
331  class IdentityInfoImpl *impl;
332 };
333 
334 } // namespace SignOn
335 
336 Q_DECLARE_METATYPE(SignOn::IdentityInfo)
337 
338 #endif /* IDENTITY_INFO_H */
Contains identity information.
Definition: identityinfo.h:65
CredentialsType
Values used to describe the type of the identity.
Definition: identityinfo.h:76
QString MethodName
Defines a string as an authentication method.
Definition: identityinfo.h:43
QStringList MechanismsList
Defines a string list as a list of mechanisms.
Definition: identityinfo.h:49
QList< SecurityContext > SecurityContextList
Defines a list of security contexts.
Definition: identityinfo.h:55