- Main Page
- Related Pages
- Classes
- Files

- File List

identity.cpp
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
24 #include "identityimpl.h"
25 #include "identity.h"
26
27 namespace SignOn {
28
29 Identity::Identity(const quint32 id, QObject *parent):
30 QObject(parent)
31 {
32 qRegisterMetaType<Error>("SignOn::Error");
33 qRegisterMetaType<Error>("Error");
34
35 if (qMetaTypeId<Error>() < QMetaType::User)
36 BLAME() << "Identity::Identity() - "
37 "SignOn::Error meta type not registered.";
38
39 impl = new IdentityImpl(this, id);
40 }
41
42 Identity *Identity::newIdentity(const IdentityInfo &info, QObject *parent)
43 {
44 Identity *identity = new Identity(SSO_NEW_IDENTITY, parent);
45 identity->impl->copyInfo(info);
46 return identity;
47 }
48
49 Identity *Identity::existingIdentity(const quint32 id, QObject *parent)
50 {
51 if (id == 0)
52 return NULL;
53 return new Identity(id, parent);
54 }
55
56 Identity::~Identity()
57 {
58 }
59
60 quint32 Identity::id() const
61 {
62 return impl->id();
63 }
64
65 void Identity::queryAvailableMethods()
66 {
67 impl->queryAvailableMethods();
68 }
69
70 AuthSessionP Identity::createSession(const QString &methodName)
71 {
72 if (methodName.isEmpty())
73 return NULL;
74
75 return AuthSessionP(impl->createSession(methodName, this));
76 }
77
78 void Identity::destroySession(const AuthSessionP &session)
79 {
80 if (session.isNull())
81 return;
82
83 impl->destroySession(session.data());
84 }
85
86 void Identity::requestCredentialsUpdate(const QString &message)
87 {
88 impl->requestCredentialsUpdate(message);
89 }
90
91 void Identity::storeCredentials(const IdentityInfo &info)
92 {
93 impl->storeCredentials(info);
94 }
95
96 void Identity::remove()
97 {
98 impl->remove();
99 }
100
101 void Identity::addReference(const QString &reference)
102 {
103 impl->addReference(reference);
104 }
105
106 void Identity::removeReference(const QString &reference)
107 {
108 impl->removeReference(reference);
109 }
110
111 void Identity::queryInfo()
112 {
113 impl->queryInfo();
114 }
115
116 void Identity::verifyUser(const QString &message)
117 {
118 impl->verifyUser(message);
119 }
120
121 void Identity::verifyUser(const QVariantMap &params)
122 {
123 impl->verifyUser(params);
124 }
125
126 void Identity::verifySecret(const QString &secret)
127 {
128 impl->verifySecret(secret);
129 }
130
131 void Identity::signOut()
132 {
133 impl->signOut();
134 }
135
136 } //namespace SignOn
SignOn::Identity::remove
void remove()
Removes this identity from database.
Definition: identity.cpp:96
SignOn::Identity::Identity
Identity(const quint32 id=SSO_NEW_IDENTITY, QObject *parent=0)
Definition: identity.cpp:29
SignOn::Identity::verifyUser
void verifyUser(const QString &message=QString())
Gets a secret verification from the user and compares it to the stored secret.
Definition: identity.cpp:116
SignOn::Identity::~Identity
virtual ~Identity()
Destructor.
Definition: identity.cpp:56
SignOn::Identity::destroySession
void destroySession(const AuthSessionP &session)
Destroys an authentication session.
Definition: identity.cpp:78
SignOn::Identity::queryInfo
void queryInfo()
Query stored credential parameters for this authentication identity.
Definition: identity.cpp:111
SignOn::Identity::queryAvailableMethods
void queryAvailableMethods()
Query list of available authentication methods for given identity.
Definition: identity.cpp:65
SignOn::Identity::verifySecret
void verifySecret(const QString &secret)
Verifies if the given secret match the stored secret.
Definition: identity.cpp:126
SignOn::Identity::storeCredentials
void storeCredentials(const IdentityInfo &info=IdentityInfo())
Stores credential parameters for this authentication identity.
Definition: identity.cpp:91
SignOn::Identity::requestCredentialsUpdate
void requestCredentialsUpdate(const QString &message=QString())
Requests the user to give a new secret into database.
Definition: identity.cpp:86
SignOn::Identity::signOut
void signOut()
Signs out Identity from all services.
Definition: identity.cpp:131
SignOn::Identity::createSession
AuthSessionP createSession(const QString &methodName)
Creates a new session for authentication.
Definition: identity.cpp:70
SignOn::Identity::addReference
void addReference(const QString &reference=QString())
Adds the named reference to identity into the database.
Definition: identity.cpp:101
SignOn::IdentityInfo
Contains identity information.
Definition: identityinfo.h:57
SignOn::Identity::removeReference
void removeReference(const QString &reference=QString())
Removes a named reference to identity from the database.
Definition: identity.cpp:106
SignOn::Identity::existingIdentity
static Identity * existingIdentity(const quint32 id, QObject *parent=0)
Constructs an identity object associated with an existing identity record.
Definition: identity.cpp:49
SignOn::Identity::id
quint32 id() const
Unique id of given identity.
Definition: identity.cpp:60
SignOn::Identity
Represents a database entry for a single identity.
Definition: identity.h:57
SignOn::Identity::newIdentity
static Identity * newIdentity(const IdentityInfo &info=IdentityInfo(), QObject *parent=0)
Constructs a new identity object.
Definition: identity.cpp:42