00001 /* 00002 * This file is part of signon 00003 * 00004 * Copyright (C) 2009-2010 Nokia Corporation. 00005 * 00006 * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com> 00007 * Contact: Alberto Mardegan <alberto.mardegan@nokia.com> 00008 * 00009 * This library is free software; you can redistribute it and/or 00010 * modify it under the terms of the GNU Lesser General Public License 00011 * version 2.1 as published by the Free Software Foundation. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 00021 * 02110-1301 USA 00022 */ 00023 00024 #include "identityimpl.h" 00025 #include "identity.h" 00026 00027 namespace SignOn { 00028 00029 Identity::Identity(const quint32 id, QObject *parent) : QObject(parent) 00030 { 00031 qRegisterMetaType<Error>("SignOn::Error"); 00032 qRegisterMetaType<Error>("Error"); 00033 00034 if (qMetaTypeId<Error>() < QMetaType::User) 00035 BLAME() << "Identity::Identity() - SignOn::Error meta type not registered."; 00036 00037 impl = new IdentityImpl(this, id); 00038 } 00039 00040 Identity *Identity::newIdentity(const IdentityInfo &info, QObject *parent) 00041 { 00042 Identity *identity = new Identity(SSO_NEW_IDENTITY, parent); 00043 identity->impl->copyInfo(info); 00044 return identity; 00045 } 00046 00047 Identity *Identity::existingIdentity(const quint32 id, QObject *parent) 00048 { 00049 if (id == 0) 00050 return NULL; 00051 return new Identity(id, parent); 00052 } 00053 00054 Identity::~Identity() 00055 { 00056 } 00057 00058 quint32 Identity::id() const 00059 { 00060 return impl->id(); 00061 } 00062 00063 void Identity::queryAvailableMethods() 00064 { 00065 impl->queryAvailableMethods(); 00066 } 00067 00068 AuthSessionP Identity::createSession(const QString &methodName) 00069 { 00070 if (methodName.isEmpty()) 00071 return NULL; 00072 00073 return AuthSessionP(impl->createSession(methodName, this)); 00074 } 00075 00076 void Identity::destroySession(const AuthSessionP &session) 00077 { 00078 if (session.isNull()) 00079 return; 00080 00081 impl->destroySession(session.data()); 00082 } 00083 00084 void Identity::requestCredentialsUpdate(const QString &message) 00085 { 00086 impl->requestCredentialsUpdate(message); 00087 } 00088 00089 void Identity::storeCredentials(const IdentityInfo &info) 00090 { 00091 impl->storeCredentials(info); 00092 } 00093 00094 void Identity::remove() 00095 { 00096 impl->remove(); 00097 } 00098 00099 void Identity::addReference(const QString &reference) 00100 { 00101 impl->addReference(reference); 00102 } 00103 00104 void Identity::removeReference(const QString &reference) 00105 { 00106 impl->removeReference(reference); 00107 } 00108 00109 void Identity::queryInfo() 00110 { 00111 impl->queryInfo(); 00112 } 00113 00114 void Identity::verifyUser(const QString &message) 00115 { 00116 impl->verifyUser(message); 00117 } 00118 00119 void Identity::verifyUser(const QVariantMap ¶ms) 00120 { 00121 impl->verifyUser(params); 00122 } 00123 00124 void Identity::verifySecret(const QString &secret) 00125 { 00126 impl->verifySecret(secret); 00127 } 00128 00129 void Identity::signOut() 00130 { 00131 impl->signOut(); 00132 } 00133 00134 } //namespace SignOn