identity.h
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2012-2016 Canonical Ltd.
*
* Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* version 2.1 as published by the Free Software Foundation.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#ifndef IDENTITY_H
#define IDENTITY_H
#include <QObject>
#include <QByteArray>
#include <QMap>
#include <QString>
#include <QStringList>
#include <QVariant>
#include <QPointer>
#include "libsignoncommon.h"
#include "authsession.h"
#include "identityinfo.h"
#include "signonerror.h"
#define SSO_NEW_IDENTITY 0
namespace SignOn {
typedef QPointer<AuthSession> AuthSessionP;
class SIGNON_EXPORT Identity: public QObject
{
Q_OBJECT
Q_DISABLE_COPY(Identity)
friend class IdentityImpl;
public:
enum IdentityError {
UnknownError = 1,
InternalServerError = 2,
InternalCommunicationError = 3,
PermissionDeniedError = 4,
IdentityErr = 200, /* placeholder to rearrange
enumeration. */
MethodNotAvailableError,
NotFoundError,
StoreFailedError,
RemoveFailedError,
SignOutFailedError,
CanceledError,
CredentialsNotAvailableError
};
protected:
Identity(const quint32 id = SSO_NEW_IDENTITY,
QObject *parent = 0);
public:
static Identity *newIdentity(const IdentityInfo &info = IdentityInfo(),
QObject *parent = 0);
static Identity *existingIdentity(const quint32 id, QObject *parent = 0);
virtual ~Identity();
quint32 id() const;
void queryAvailableMethods();
AuthSessionP createSession(const QString &methodName);
void destroySession(const AuthSessionP &session);
void requestCredentialsUpdate(const QString &message = QString());
void storeCredentials(const IdentityInfo &info = IdentityInfo());
void remove();
void addReference(const QString &reference = QString());
void removeReference(const QString &reference = QString());
void queryInfo();
void verifyUser(const QString &message = QString());
void verifyUser(const QVariantMap &params);
void verifySecret(const QString &secret);
void signOut();
Q_SIGNALS:
void error(const SignOn::Error &err);
void methodsAvailable(const QStringList &methods);
void credentialsStored(const quint32 id);
void referenceAdded();
void referenceRemoved();
void info(const SignOn::IdentityInfo &info);
void userVerified(const bool valid);
void secretVerified(const bool valid);
void signedOut();
void removed();
private:
class IdentityImpl *impl;
};
} // namespace SignOn
#endif /* IDENTITY_H */
SignOn::Error
definition for Signon error handling.
Definition: signonerror.h:53
SignOn::IdentityInfo
Contains identity information.
Definition: identityinfo.h:65
SignOn::Identity
Represents a database entry for a single identity.
Definition: identity.h:58
SignOn::Identity::error
void error(const SignOn::Error &err)
Emitted when an error occurs while performing an operation.
SignOn::Identity::secretVerified
void secretVerified(const bool valid)
Emitted when secret verification is completed.
SignOn::Identity::IdentityError
IdentityError
Codes for errors that may be reported by Identity objects.
Definition: identity.h:70
SignOn::Identity::SignOutFailedError
@ SignOutFailedError
Definition: identity.h:88
SignOn::Identity::CanceledError
@ CanceledError
Definition: identity.h:89
SignOn::Identity::StoreFailedError
@ StoreFailedError
Definition: identity.h:86
SignOn::Identity::RemoveFailedError
@ RemoveFailedError
Definition: identity.h:87
SignOn::Identity::referenceAdded
void referenceAdded()
Emitted when references are added by addReference() method and change has been successfully stored on...
SignOn::Identity::info
void info(const SignOn::IdentityInfo &info)
Emitted when credentials passed by queryInfo() method.
SignOn::Identity::signedOut
void signedOut()
Emitted when the identity is signed out.
SignOn::Identity::methodsAvailable
void methodsAvailable(const QStringList &methods)
Emitted when the list of available mechanisms has been obtained for identity.
SignOn::Identity::referenceRemoved
void referenceRemoved()
Emitted when references are removed by removeReference() method and change has been successfully stor...
SignOn::Identity::credentialsStored
void credentialsStored(const quint32 id)
Emitted when credentials passed by storeCredentials() method have been successfully stored on the ser...
SignOn::Identity::removed
void removed()
Emitted when the identity is removed.
SignOn::Identity::userVerified
void userVerified(const bool valid)
Emitted when the user verification is completed.
SignOn
Definition: async-dbus-proxy.cpp:41