signon-8.56+14.04.20140307/ 0000755 0000152 0177776 00000000000 12306320634 015345 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/tests/ 0000755 0000152 0177776 00000000000 12306320634 016507 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/tests/com.google.code.AccountsSSO.SingleSignOn.service.in 0000644 0000152 0177776 00000000144 12306320366 030142 0 ustar pbuser nogroup 0000000 0000000 [D-BUS Service]
Name=com.google.code.AccountsSSO.SingleSignOn
Exec=$${TOP_SRC_DIR}/tests/signond.sh
signon-8.56+14.04.20140307/tests/tests.pro 0000644 0000152 0177776 00000000710 12306320366 020373 0 ustar pbuser nogroup 0000000 0000000 include( ../common-project-config.pri )
include( ../common-vars.pri )
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
passwordplugintest \
libsignon-qt-tests \
signond-tests \
extensions
QMAKE_SUBSTITUTES += com.google.code.AccountsSSO.SingleSignOn.service.in
# copy testsession.conf to the build directory
system($$QMAKE_COPY testsession.conf.in $${TOP_BUILD_DIR}/tests/testsession.conf)
QMAKE_DISTCLEAN += \
testsession.conf
signon-8.56+14.04.20140307/tests/testsession.conf.in 0000644 0000152 0177776 00000003147 12306320366 022355 0 ustar pbuser nogroup 0000000 0000000
session
unix:tmpdir=/tmp
.
60000
1000000000
1000000000
1000000000
120000
240000
100000
10000
100000
10000
50000
50000
50000
300000
signon-8.56+14.04.20140307/tests/passwordplugintest/ 0000755 0000152 0177776 00000000000 12306320634 022470 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/tests/passwordplugintest/passwordplugintest.h 0000644 0000152 0177776 00000003424 12306320366 026627 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 PASSWORD_PLUGIN_TEST
#define PASSWORD_PLUGIN_TEST
#include
#include "passwordplugin.h"
using namespace PasswordPluginNS;
class PasswordPluginTest: public QObject
{
Q_OBJECT
public slots:
void result(const SignOn::SessionData &data);
void pluginError(const SignOn::Error &err);
void uiRequest(const SignOn::UiSessionData &data);
private slots:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
//test cases
void testPlugin();
void testPluginType();
void testPluginMechanisms();
void testPluginCancel();
void testPluginProcess();
void testPluginUserActionFinished();
void testPluginRefresh();
//end test cases
private:
PasswordPlugin *m_testPlugin;
int m_error;
SignOn::SessionData m_response;
SignOn::UiSessionData m_uiResponse;
QEventLoop m_loop;
};
#endif //PASSWORD_PLUGIN_TEST
signon-8.56+14.04.20140307/tests/passwordplugintest/.gitignore 0000644 0000152 0177776 00000000034 12306320366 024457 0 ustar pbuser nogroup 0000000 0000000 signon-passwordplugin-tests
signon-8.56+14.04.20140307/tests/passwordplugintest/passwordplugintest.cpp 0000644 0000152 0177776 00000015654 12306320366 027172 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Aurel Popirtac
* Contact: Alberto Mardegan
*
* 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
*/
#include
#include "passwordplugin.h"
#include "passwordplugin.cpp"
#include "passwordplugintest.h"
using namespace PasswordPluginNS;
#define TEST_START qDebug("\n\n\n\n ----------------- %s ----------------\n\n", __func__);
#define TEST_DONE qDebug("\n\n ----------------- %s DONE ----------------\n\n", __func__);
void PasswordPluginTest::initTestCase()
{
TEST_START
qRegisterMetaType();
qRegisterMetaType();
TEST_DONE
}
void PasswordPluginTest::cleanupTestCase()
{
TEST_START
TEST_DONE
}
//prepare each test by creating new plugin
void PasswordPluginTest::init()
{
m_testPlugin = new PasswordPlugin();
}
//finnish each test by deleting plugin
void PasswordPluginTest::cleanup()
{
delete m_testPlugin;
m_testPlugin=NULL;
}
//slot for receiving result
void PasswordPluginTest::result(const SignOn::SessionData &data)
{
qDebug() << "got result";
m_response = data;
m_loop.exit();
}
//slot for receiving error
void PasswordPluginTest::pluginError(const SignOn::Error &err)
{
qDebug() << "got error" << err.type() << ": " << err.message();
m_error = err.type();
m_loop.exit();
}
//slot for receiving result
void PasswordPluginTest::uiRequest(const SignOn::UiSessionData &data)
{
qDebug() << "got ui request";
m_uiResponse = data;
m_loop.exit();
}
//test cases
void PasswordPluginTest::testPlugin()
{
TEST_START
qDebug() << "Checking plugin integrity.";
QVERIFY(m_testPlugin);
TEST_DONE
}
void PasswordPluginTest::testPluginType()
{
TEST_START
qDebug() << "Checking plugin type.";
QCOMPARE(m_testPlugin->type(), QString("password"));
TEST_DONE
}
void PasswordPluginTest::testPluginMechanisms()
{
TEST_START
qDebug() << "Checking plugin mechanisms.";
QStringList mechs = m_testPlugin->mechanisms();
QVERIFY(!mechs.isEmpty());
QVERIFY(mechs.contains(QString("password")));
qDebug() << mechs;
TEST_DONE
}
void PasswordPluginTest::testPluginCancel()
{
TEST_START
//no cancel functionality
TEST_DONE
}
void PasswordPluginTest::testPluginProcess()
{
TEST_START
SignOn::SessionData info;
SignOn::SessionData info2;
QObject::connect(m_testPlugin, SIGNAL(result(const SignOn::SessionData&)),
this, SLOT(result(const SignOn::SessionData&)),
Qt::QueuedConnection);
QObject::connect(m_testPlugin, SIGNAL(error(const SignOn::Error & )),
this, SLOT(pluginError(const SignOn::Error & )),
Qt::QueuedConnection);
QObject::connect(m_testPlugin,
SIGNAL(userActionRequired(const SignOn::UiSessionData&)),
this, SLOT(uiRequest(const SignOn::UiSessionData&)),
Qt::QueuedConnection);
QTimer::singleShot(10*1000, &m_loop, SLOT(quit()));
//try with password
info.setSecret(QString("pass"));
m_testPlugin->process(info);
m_loop.exec();
QVERIFY(m_response.Secret() == QString("pass"));
QVERIFY(m_response.UserName().isEmpty());
//try with username
info.setUserName(QString("user"));
m_testPlugin->process(info);
m_loop.exec();
QVERIFY(m_response.Secret() == QString("pass"));
QVERIFY(m_response.UserName() == QString("user"));
//try without params to open ui
m_testPlugin->process(info2);
m_loop.exec();
QVERIFY(m_uiResponse.QueryUserName() );
QVERIFY(m_uiResponse.QueryPassword() );
//try without password to open ui
info2.setUserName(QString("user"));
m_testPlugin->process(info2);
m_loop.exec();
QVERIFY(!m_uiResponse.QueryUserName() );
QVERIFY(m_uiResponse.QueryPassword() );
TEST_DONE
}
void PasswordPluginTest::testPluginUserActionFinished()
{
TEST_START
SignOn::UiSessionData info;
QObject::connect(m_testPlugin, SIGNAL(result(const SignOn::SessionData&)),
this, SLOT(result(const SignOn::SessionData&)),
Qt::QueuedConnection);
QObject::connect(m_testPlugin, SIGNAL(error(const SignOn::Error & )),
this, SLOT(pluginError(const SignOn::Error & )),
Qt::QueuedConnection);
QObject::connect(m_testPlugin,
SIGNAL(userActionRequired(const SignOn::UiSessionData&)),
this, SLOT(uiRequest(const SignOn::UiSessionData&)),
Qt::QueuedConnection);
QTimer::singleShot(10*1000, &m_loop, SLOT(quit()));
//empty data
m_testPlugin->userActionFinished(info);
m_loop.exec();
//fails because of ui error 0 is returned if not defined
// QVERIFY(m_error == PLUGIN_ERROR_USER_INTERACTION);
//correct values
info.setQueryErrorCode(QUERY_ERROR_NONE);
info.setUserName(QString("user") );
info.setSecret(QString("pass") );
m_testPlugin->userActionFinished(info);
m_loop.exec();
QVERIFY(m_response.UserName() == QString("user") );
QVERIFY(m_response.Secret() == QString("pass") );
//user canceled
info.setQueryErrorCode(QUERY_ERROR_CANCELED);
m_testPlugin->userActionFinished(info);
m_loop.exec();
QVERIFY(m_error == Error::SessionCanceled);
//error in ui request
info.setQueryErrorCode(QUERY_ERROR_GENERAL);
m_testPlugin->userActionFinished(info);
m_loop.exec();
QVERIFY(m_error == Error::UserInteraction);
TEST_DONE
}
void PasswordPluginTest::testPluginRefresh()
{
TEST_START
SignOn::UiSessionData info;
QObject::connect(m_testPlugin, SIGNAL(error(const SignOn::Error &)),
this, SLOT(pluginError(const SignOn::Error &)),
Qt::QueuedConnection);
QObject::connect(m_testPlugin,
SIGNAL(refreshed(const SignOn::UiSessionData&)),
this, SLOT(uiRequest(const SignOn::UiSessionData&)),
Qt::QueuedConnection);
QTimer::singleShot(10*1000, &m_loop, SLOT(quit()));
m_testPlugin->refresh(info);
m_loop.exec();
TEST_DONE
}
//end test cases
QTEST_MAIN(PasswordPluginTest)
signon-8.56+14.04.20140307/tests/passwordplugintest/passwordplugintest.pro 0000644 0000152 0177776 00000001007 12306320366 027173 0 ustar pbuser nogroup 0000000 0000000 include( ../tests.pri )
TARGET = signon-passwordplugin-tests
QT += core \
network \
testlib
CONFIG += \
link_pkgconfig
DEFINES += SIGNON_PLUGIN_TRACE
SOURCES += passwordplugintest.cpp
HEADERS += passwordplugintest.h \
$${TOP_SRC_DIR}/src/plugins/password/passwordplugin.h \
$${TOP_SRC_DIR}/lib/plugins/SignOn/authpluginif.h
INCLUDEPATH += $${TOP_SRC_DIR}/lib/plugins \
$${TOP_SRC_DIR}/src/plugins/password \
$${TOP_SRC_DIR}/src/plugins
QMAKE_CXXFLAGS += -fno-exceptions \
-fno-rtti
signon-8.56+14.04.20140307/tests/signond.sh 0000755 0000152 0177776 00000000224 12306320366 020507 0 ustar pbuser nogroup 0000000 0000000 #! /bin/sh
set -e
BUILDDIR="${BUILDDIR:=..}"
SIGNOND="${BUILDDIR}/src/signond/signond"
echo "Starting signond from $SIGNOND"
$WRAPPER $SIGNOND
signon-8.56+14.04.20140307/tests/extensions/ 0000755 0000152 0177776 00000000000 12306320634 020706 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/tests/extensions/extensions.pri 0000644 0000152 0177776 00000000556 12306320366 023631 0 ustar pbuser nogroup 0000000 0000000 include(../tests.pri)
QT += core \
sql \
testlib \
dbus
QT -= gui
LIBS += -lsignon-extension
QMAKE_LIBDIR += \
$${TOP_BUILD_DIR}/lib/signond/SignOn
QMAKE_RPATHDIR = $${QMAKE_LIBDIR}
DEFINES += SIGNOND_TRACE
DEFINES += SIGNON_PLUGIN_TRACE
INCLUDEPATH += . \
$$TOP_SRC_DIR/lib/signond
QMAKE_CXXFLAGS += \
-fno-exceptions \
-fno-rtti
signon-8.56+14.04.20140307/tests/extensions/tst_access_control_manager.cpp 0000644 0000152 0177776 00000005265 12306320366 027011 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include
#include
#include
#include
#include
#include
using namespace SignOn;
class AccessControlManagerTest: public QObject
{
Q_OBJECT
private Q_SLOTS:
void test_abstract();
void test_abstractRequest();
};
void AccessControlManagerTest::test_abstract()
{
AbstractAccessControlManager *acm = new AbstractAccessControlManager(this);
/* forge a QDBusMessage and a connection */
QDBusMessage msg =
QDBusMessage::createMethodCall(":0.3", "/", "my.interface", "hi");
QDBusConnection conn(QLatin1String("test-connection"));
QCOMPARE(acm->isPeerAllowedToAccess(conn, msg, QLatin1String("any")),
true);
QCOMPARE(acm->appIdOfPeer(conn, msg), QString());
QCOMPARE(acm->keychainWidgetAppId(), QString());
delete acm;
}
void AccessControlManagerTest::test_abstractRequest()
{
AbstractAccessControlManager *acm = new AbstractAccessControlManager(this);
/* forge a QDBusMessage and a connection */
QDBusMessage msg =
QDBusMessage::createMethodCall(":0.3", "/", "my.interface", "hi");
QDBusConnection conn(QLatin1String("test-connection"));
AccessRequest request;
request.setPeer(conn, msg);
request.setIdentity(4);
QCOMPARE(request.peerConnection().name(), conn.name());
QCOMPARE(request.peerMessage().member(), msg.member());
QCOMPARE(request.identity(), quint32(4));
AccessReply *reply = acm->handleRequest(request);
QVERIFY(reply != 0);
QVERIFY(!reply->isAccepted());
QSignalSpy finished(reply, SIGNAL(finished()));
QTest::qWait(10);
QCOMPARE(finished.count(), 1);
QVERIFY(reply->isAccepted());
QCOMPARE(reply->request().identity(), request.identity());
delete reply;
delete acm;
}
QTEST_MAIN(AccessControlManagerTest)
#include "tst_access_control_manager.moc"
signon-8.56+14.04.20140307/tests/extensions/tst_access_control_manager.pro 0000644 0000152 0177776 00000000246 12306320366 027021 0 ustar pbuser nogroup 0000000 0000000 include(extensions.pri)
TARGET = tst_access_control_manager
SOURCES += \
tst_access_control_manager.cpp
check.depends = $$TARGET
check.commands = "./$$TARGET"
signon-8.56+14.04.20140307/tests/extensions/.gitignore 0000644 0000152 0177776 00000000034 12306320366 022675 0 ustar pbuser nogroup 0000000 0000000 /tst_access_control_manager
signon-8.56+14.04.20140307/tests/extensions/extensions.pro 0000644 0000152 0177776 00000000102 12306320366 023622 0 ustar pbuser nogroup 0000000 0000000 TEMPLATE = subdirs
SUBDIRS = \
tst_access_control_manager.pro
signon-8.56+14.04.20140307/tests/signond-tests/ 0000755 0000152 0177776 00000000000 12306320634 021310 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/tests/signond-tests/signond-tests.pri 0000644 0000152 0177776 00000001552 12306320366 024632 0 ustar pbuser nogroup 0000000 0000000 include(../tests.pri)
CONFIG += \
link_pkgconfig
QT += core \
sql \
testlib \
xml \
network \
dbus
QT -= gui
LIBS += -lsignon-extension
greaterThan(QT_MAJOR_VERSION, 4) {
LIBS += -lsignon-qt5
} else {
LIBS += -lsignon-qt
}
QMAKE_LIBDIR += \
$${TOP_BUILD_DIR}/lib/signond/SignOn
QMAKE_RPATHDIR = $${QMAKE_LIBDIR}
DEFINES += SIGNOND_TRACE
DEFINES += SIGNON_PLUGIN_TRACE
INCLUDEPATH += . \
$$TOP_SRC_DIR/lib/plugins \
$$TOP_SRC_DIR/lib/signond \
$$TOP_SRC_DIR/src/signond \
$${TOP_SRC_DIR}/lib/plugins/signon-plugins-common \
$${TOP_SRC_DIR}/lib/plugins/signon-plugins-common/SignOn
QMAKE_CXXFLAGS += -fno-exceptions \
-fno-rtti
check.depends = $$TARGET
check.commands = "SSO_PLUGINS_DIR=$${TOP_BUILD_DIR}/src/plugins/test SSO_EXTENSIONS_DIR=$${TOP_BUILD_DIR}/non-existing-dir $$RUN_WITH_SIGNOND ./$$TARGET"
signon-8.56+14.04.20140307/tests/signond-tests/include.cpp 0000644 0000152 0177776 00000002045 12306320366 023442 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 PLUGINPROXY_EXTERNAL_INCLUDED_
#define PLUGINPROXY_EXTERNAL_INCLUDED_
#include "pluginproxy.cpp"
#include "blobiohandler.cpp"
#endif //_EXTERNAL_INCLUDED_
signon-8.56+14.04.20140307/tests/signond-tests/backuptest.h 0000644 0000152 0177776 00000002455 12306320366 023636 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 BACKUPTEST_H_
#define BACKUPTEST_H_
#include
#include
#include "signond/signoncommon.h"
using namespace SignOn;
class TestBackup: public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
//backup mode
void backupTest();
void restoreTest();
void backupNormalTest();
void restoreNormalTest();
private:
QProcess *daemonProcess;
};
#endif //BACKUPTEST_H_
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/ 0000755 0000152 0177776 00000000000 12306320634 024116 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/mock-ac-plugin.pro 0000644 0000152 0177776 00000000113 12306320366 027443 0 ustar pbuser nogroup 0000000 0000000 TEMPLATE = subdirs
SUBDIRS = \
plugin.pro \
identity-ac-helper.pro
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/plugin.h 0000644 0000152 0177776 00000002525 12306320366 025573 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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 SIGNON_MOCK_PLUGIN_H
#define SIGNON_MOCK_PLUGIN_H
#include
#include
class Plugin: public QObject, public SignOn::ExtensionInterface3
{
Q_OBJECT
Q_INTERFACES(SignOn::ExtensionInterface3)
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
Q_PLUGIN_METADATA(IID "com.nokia.SingleSignOn.ExtensionInterface/3.0")
#endif
public:
Plugin(QObject *parent = 0);
SignOn::AbstractAccessControlManager *
accessControlManager(QObject *parent = 0) const;
};
#endif // SIGNON_MOCK_PLUGIN_H
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/plugin.pro 0000644 0000152 0177776 00000001253 12306320366 026141 0 ustar pbuser nogroup 0000000 0000000 include(../../tests.pri)
TEMPLATE = lib
TARGET = signon-mock-ac
CONFIG += \
link_pkgconfig \
plugin \
qt
QT += \
core \
dbus
QT -= gui
DEFINES += \
IDENTITY_AC_HELPER=\\\"$${TOP_BUILD_DIR}/tests/signond-tests/mock-ac-plugin/identity-ac-helper\\\"
CONFIG(enable-p2p) {
DEFINES += ENABLE_P2P
PKGCONFIG += dbus-1
}
QMAKE_CXXFLAGS += \
-fvisibility=hidden
LIBS += -lsignon-extension
INCLUDEPATH += . \
$$TOP_SRC_DIR/lib/signond
QMAKE_LIBDIR += \
$${TOP_BUILD_DIR}/lib/signond/SignOn
QMAKE_RPATHDIR = $${QMAKE_LIBDIR}
HEADERS = \
access-control-manager.h \
plugin.h
SOURCES = \
access-control-manager.cpp \
plugin.cpp
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/access-control-manager.cpp 0000644 0000152 0177776 00000011700 12306320366 031152 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "access-control-manager.h"
#include
#include
#include
#include
#include
#include
#include
#ifdef ENABLE_P2P
#include
#endif
static const char keychainAppId[] = "SignondKeychain";
class AccessReply: public SignOn::AccessReply
{
Q_OBJECT
public:
AccessReply(const SignOn::AccessRequest &request,
const QString &appId,
QObject *parent = 0);
private Q_SLOTS:
void onProcessFinished();
private:
QProcess m_helper;
};
AccessReply::AccessReply(const SignOn::AccessRequest &request,
const QString &appId,
QObject *parent):
SignOn::AccessReply(request, parent)
{
/* Spawn the IDENTITY_AC_HELPER process, which will decide whether access
* to the identity should be allowed (based on some fields found in the
* identity itself), and will exit with code 1 if the access has been
* allowed.
*/
QObject::connect(&m_helper,
SIGNAL(finished(int,QProcess::ExitStatus)),
this, SLOT(onProcessFinished()));
m_helper.setProcessChannelMode(QProcess::ForwardedChannels);
QStringList args;
args << QString::number(request.identity());
args << appId;
m_helper.start(IDENTITY_AC_HELPER, args);
}
void AccessReply::onProcessFinished()
{
qDebug() << Q_FUNC_INFO << m_helper.exitStatus() << m_helper.exitCode();
if (m_helper.exitStatus() == QProcess::NormalExit &&
m_helper.exitCode() == EXIT_SUCCESS) {
accept();
} else {
decline();
}
}
AccessControlManager::AccessControlManager(QObject *parent):
SignOn::AbstractAccessControlManager(parent)
{
}
AccessControlManager::~AccessControlManager()
{
}
QString AccessControlManager::keychainWidgetAppId()
{
return QLatin1String(keychainAppId);
}
bool AccessControlManager::isPeerAllowedToAccess(
const QDBusConnection &peerConnection,
const QDBusMessage &peerMessage,
const QString &securityContext)
{
QString appId = appIdOfPeer(peerConnection, peerMessage);
if (appId == securityContext ||
appId == IDENTITY_AC_HELPER) {
qDebug() << "Allowing";
return true;
} else {
qDebug() << "Blocking access";
return false;
}
}
QString AccessControlManager::appIdOfPeer(const QDBusConnection &peerConnection,
const QDBusMessage &peerMessage)
{
pid_t pid = pidOfPeer(peerConnection, peerMessage);
QFile file(QString::fromLatin1("/proc/%1/cmdline").arg(pid));
if (!file.open(QIODevice::ReadOnly)) {
qWarning() << "Couldn't read name of pid" << pid;
return QString::fromLatin1("pid-%1").arg(pid);
}
QByteArray command = file.readLine().split('\0').value(0, "unknown");
return QString::fromUtf8(command);
}
pid_t AccessControlManager::pidOfPeer(const QDBusConnection &peerConnection,
const QDBusMessage &peerMessage)
{
QString service = peerMessage.service();
if (service.isEmpty()) {
#ifdef ENABLE_P2P
DBusConnection *connection =
(DBusConnection *)peerConnection.internalPointer();
unsigned long pid = 0;
dbus_bool_t ok = dbus_connection_get_unix_process_id(connection,
&pid);
if (Q_UNLIKELY(!ok)) {
qWarning() << "Couldn't get PID of caller!";
return 0;
}
return pid;
#else
qWarning() << "Empty caller name, and no P2P support enabled";
return 0;
#endif
} else {
return peerConnection.interface()->servicePid(service).value();
}
}
SignOn::AccessReply *
AccessControlManager::handleRequest(const SignOn::AccessRequest &request)
{
QString appId = appIdOfPeer(request.peerConnection(),
request.peerMessage());
qDebug() << Q_FUNC_INFO << appId;
return new AccessReply(request, appId, this);
}
#include "access-control-manager.moc"
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/access-control-manager.h 0000644 0000152 0177776 00000003314 12306320366 030621 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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 SIGNON_MOCK_ACCESS_CONTROL_MANAGER_H
#define SIGNON_MOCK_ACCESS_CONTROL_MANAGER_H
#include
class AccessControlManager: public SignOn::AbstractAccessControlManager
{
Q_OBJECT
public:
AccessControlManager(QObject *parent = 0);
~AccessControlManager();
bool isPeerAllowedToAccess(const QDBusConnection &peerConnection,
const QDBusMessage &peerMessage,
const QString &securityContext);
QString appIdOfPeer(const QDBusConnection &peerConnection,
const QDBusMessage &peerMessage);
QString keychainWidgetAppId();
SignOn::AccessReply *handleRequest(const SignOn::AccessRequest &request);
private:
pid_t pidOfPeer(const QDBusConnection &peerConnection,
const QDBusMessage &peerMessage);
};
#endif // SIGNON_MOCK_ACCESS_CONTROL_MANAGER_H
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/signond.conf 0000644 0000152 0177776 00000001661 12306320366 026434 0 ustar pbuser nogroup 0000000 0000000 ;Signon Daemon configuration file
[General]
; Uncomment the StoragePath line to specify a location for the signon DB.
; If not given, uses $XDG_CONFIG_HOME/signond (or ~/.config/signond if
; the variable XDG_CONFIG_HOME is unset).
;StoragePath=~/.signon/
;0 - fatal, 1 - critical (default), 2 - info/debug
LoggingLevel=2
[SecureStorage]
; CryptoManager selects the encryption for the credentials FS. Possible values:
; "default" - no encryption
; "cryptsetup" - encrypted with the cryptsetup extension
CryptoManager=default
; AccessControlManager selects the type of AC framework Possible values:
; "default" - no AC
; "smack-ac" - Smack AC
; "mssf-ac" - MSSF AC
AccessControlManager=mock-ac
FileSystemName=signonfs
Size=8
FileSystemType=ext2
SecretsStorage=default
[ObjectTimeouts]
; All the values are in seconds
IdentityTimeout=30
AuthSessionTimeout=30
; Set the timeout to 0 to disable quitting due to inactivity
DaemonTimeout=5
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/plugin.cpp 0000644 0000152 0177776 00000002366 12306320366 026131 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "plugin.h"
#include "access-control-manager.h"
#include
using namespace SignOn;
Plugin::Plugin(QObject *parent):
QObject(parent)
{
setObjectName(QLatin1String("mock-ac"));
}
AbstractAccessControlManager *
Plugin::accessControlManager(QObject *parent) const
{
qDebug() << Q_FUNC_INFO;
return new AccessControlManager(parent);
}
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
Q_EXPORT_PLUGIN2(mock-ac, Plugin);
#endif
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/identity-ac-helper.cpp 0000644 0000152 0177776 00000005556 12306320366 030326 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include
#include
#include
using namespace SignOn;
class Helper: public QObject
{
Q_OBJECT
public:
Helper(quint32 id, const QString &appId);
private Q_SLOTS:
void onError(const SignOn::Error &error);
void onInfo(const SignOn::IdentityInfo &info);
void onCredentialsStored();
private:
Identity *m_identity;
QString m_appId;
};
Helper::Helper(quint32 id, const QString &appId):
QObject(),
m_identity(0),
m_appId(appId)
{
m_identity = Identity::existingIdentity(id);
Q_ASSERT(m_identity != NULL);
QObject::connect(m_identity, SIGNAL(info(const SignOn::IdentityInfo&)),
this, SLOT(onInfo(const SignOn::IdentityInfo&)));
QObject::connect(m_identity, SIGNAL(error(const SignOn::Error&)),
this, SLOT(onError(const SignOn::Error&)));
m_identity->queryInfo();
}
void Helper::onInfo(const SignOn::IdentityInfo &info)
{
/* If the identity caption has the magic value of "allow", then update the
* ACL and return true. */
bool isAllowed = (info.caption() == "allow");
if (!isAllowed) {
QCoreApplication::exit(EXIT_FAILURE);
return;
}
QObject::connect(m_identity, SIGNAL(credentialsStored(const quint32)),
this, SLOT(onCredentialsStored()));
IdentityInfo updated = info;
updated.setAccessControlList(info.accessControlList() << m_appId);
m_identity->storeCredentials(updated);
}
void Helper::onCredentialsStored()
{
qDebug() << Q_FUNC_INFO;
QCoreApplication::exit(EXIT_SUCCESS);
}
void Helper::onError(const SignOn::Error &error)
{
qDebug() << Q_FUNC_INFO << error.type() << error.message();
QCoreApplication::exit(EXIT_FAILURE);
}
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QStringList args = QCoreApplication::arguments();
uint id = args.at(1).toUInt();
QString appId = args.at(2);
qDebug() << "Started" << id << appId;
Helper helper(quint32(id), appId);
return app.exec();
}
#include "identity-ac-helper.moc"
signon-8.56+14.04.20140307/tests/signond-tests/mock-ac-plugin/identity-ac-helper.pro 0000644 0000152 0177776 00000000576 12306320366 030341 0 ustar pbuser nogroup 0000000 0000000 include(../../../common-project-config.pri)
TEMPLATE = app
TARGET = identity-ac-helper
QT += core
QT -= gui
greaterThan(QT_MAJOR_VERSION, 4) {
LIBS += -lsignon-qt5
} else {
LIBS += -lsignon-qt
}
QMAKE_LIBDIR += \
$${TOP_BUILD_DIR}/lib/signond/SignOn
QMAKE_RPATHDIR = $${QMAKE_LIBDIR}
INCLUDEPATH += \
$${TOP_SRC_DIR}/lib
SOURCES = \
identity-ac-helper.cpp
signon-8.56+14.04.20140307/tests/signond-tests/timeouts.h 0000644 0000152 0177776 00000002732 12306320366 023340 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2010 Nokia Corporation.
* Copyright (C) 2012 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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 TIMEOUTS_TEST_H
#define TIMEOUTS_TEST_H
#include "SignOn/identity.h"
#include
#include
using namespace SignOn;
class TimeoutsTest: public QObject
{
Q_OBJECT
public Q_SLOTS:
void credentialsStored(const quint32 id);
void identityError(const SignOn::Error &error);
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
void identityTimeout();
void identityRegisterTwice();
signals:
void finished();
private:
bool triggerDisposableCleanup();
bool identityAlive(const QString &path);
bool completed;
};
#endif // TIMEOUTS_TEST_H
signon-8.56+14.04.20140307/tests/signond-tests/timeouts.cpp 0000644 0000152 0177776 00000017135 12306320366 023676 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2010 Nokia Corporation.
* Copyright (C) 2012 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "timeouts.h"
#include
#include
#include
#include
#include "signond/signoncommon.h"
using namespace SignOn;
/*
* test timeout 20 seconds
* */
#define test_timeout 20000
void TimeoutsTest::initTestCase()
{
}
void TimeoutsTest::cleanupTestCase()
{
}
void TimeoutsTest::init()
{
completed = false;
}
void TimeoutsTest::identityTimeout()
{
QEventLoop loop;
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
QObject::connect(this, SIGNAL(finished()), &loop, SLOT(quit()));
QMap methods;
methods.insert("dummy", QStringList() << "mech1" << "mech2");
IdentityInfo info = IdentityInfo(QLatin1String("timeout test"),
QLatin1String("timeout@test"),
methods);
Identity *identity = Identity::newIdentity(info);
QVERIFY(identity != NULL);
QObject::connect(identity,
SIGNAL(credentialsStored(const quint32)),
this,
SLOT(credentialsStored(const quint32)));
QObject::connect(identity,
SIGNAL(error(const SignOn::Error&)),
this,
SLOT(identityError(const SignOn::Error&)));
identity->storeCredentials();
loop.exec();
QVERIFY(identity->id() != SSO_NEW_IDENTITY);
QDBusConnection conn = SIGNOND_BUS;
QDBusMessage msg = QDBusMessage::createMethodCall(SIGNOND_SERVICE,
SIGNOND_DAEMON_OBJECTPATH,
SIGNOND_DAEMON_INTERFACE,
"getIdentity");
QList args;
args << identity->id();
msg.setArguments(args);
QDBusMessage reply = conn.call(msg);
QCOMPARE(reply.type(), QDBusMessage::ReplyMessage);
QDBusObjectPath objectPath = reply.arguments()[0].value();
QString path = objectPath.path();
qDebug() << "Got path" << path;
QVERIFY(!path.isEmpty());
bool success;
QTest::qSleep(100);
success = triggerDisposableCleanup();
QVERIFY(success);
/* The identity object must exist now */
QVERIFY(identityAlive(path));
QTest::qSleep(6 * 1000);
success = triggerDisposableCleanup();
QVERIFY(success);
/* After SSO_IDENTITY_TIMEOUT seconds, the identity must have been
* destroyed */
QVERIFY(!identityAlive(path));
/* Calling a method on the client should re-register the identity */
QSignalSpy removed(identity, SIGNAL(removed()));
QObject::connect(identity, SIGNAL(removed()),
&loop, SLOT(quit()), Qt::QueuedConnection);
identity->remove();
loop.exec();
QCOMPARE(removed.count(), 1);
}
void TimeoutsTest::identityRegisterTwice()
{
QEventLoop loop;
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
QObject::connect(this, SIGNAL(finished()), &loop, SLOT(quit()));
QMap methods;
methods.insert("dummy", QStringList() << "mech1" << "mech2");
IdentityInfo info = IdentityInfo(QLatin1String("timeout test"),
QLatin1String("timeout@test"),
methods);
Identity *identity = Identity::newIdentity(info);
QVERIFY(identity != NULL);
QObject::connect(identity,
SIGNAL(credentialsStored(const quint32)),
this,
SLOT(credentialsStored(const quint32)));
QObject::connect(identity,
SIGNAL(error(const SignOn::Error &)),
this,
SLOT(identityError(const SignOn::Error &)));
identity->storeCredentials();
loop.exec();
QVERIFY(identity->id() != SSO_NEW_IDENTITY);
QDBusConnection conn = SIGNOND_BUS;
QDBusMessage msg = QDBusMessage::createMethodCall(SIGNOND_SERVICE,
SIGNOND_DAEMON_OBJECTPATH,
SIGNOND_DAEMON_INTERFACE,
"getIdentity");
QList args;
args << identity->id();
msg.setArguments(args);
QDBusMessage reply = conn.call(msg);
QCOMPARE(reply.type(), QDBusMessage::ReplyMessage);
QDBusObjectPath objectPath = reply.arguments()[0].value();
QString path = objectPath.path();
qDebug() << "Got path" << path;
QVERIFY(!path.isEmpty());
bool success;
QTest::qSleep(100);
success = triggerDisposableCleanup();
QVERIFY(success);
/* The identity object must exist now */
QVERIFY(identityAlive(path));
QTest::qSleep(6 * 1000);
/* now we register the same identity again. The expected behavior is that
* the registration succeeds, possibly returning the same object path as
* before.
* This is to test a regression (NB#182914) which was happening because
* signond was deleting the expired Identity immediately after returning
* its object path to the client.
*/
reply = conn.call(msg);
QVERIFY(reply.type() == QDBusMessage::ReplyMessage);
objectPath = reply.arguments()[0].value();
path = objectPath.path();
qDebug() << "Got path" << path;
QVERIFY(!path.isEmpty());
QVERIFY(identityAlive(path));
}
void TimeoutsTest::identityError(const SignOn::Error &error)
{
qDebug() << Q_FUNC_INFO << error.message();
QFAIL("Unexpected error!");
emit finished();
}
bool TimeoutsTest::triggerDisposableCleanup()
{
QDBusConnection conn = SIGNOND_BUS;
/* create a new identity just to trigger the cleanup of disposable
* objects */
QDBusMessage msg = QDBusMessage::createMethodCall(SIGNOND_SERVICE,
SIGNOND_DAEMON_OBJECTPATH,
SIGNOND_DAEMON_INTERFACE,
"registerNewIdentity");
QDBusMessage reply = conn.call(msg);
return (reply.type() == QDBusMessage::ReplyMessage);
}
bool TimeoutsTest::identityAlive(const QString &path)
{
QDBusConnection conn = SIGNOND_BUS;
QString interface = QLatin1String("com.google.code.AccountsSSO.SingleSignOn.Identity");
QDBusMessage msg = QDBusMessage::createMethodCall(SIGNOND_SERVICE,
path,
interface,
"getInfo");
QDBusMessage reply = conn.call(msg);
return (reply.type() == QDBusMessage::ReplyMessage);
}
void TimeoutsTest::credentialsStored(const quint32 id)
{
QVERIFY(id != 0);
emit finished();
}
QTEST_MAIN(TimeoutsTest)
signon-8.56+14.04.20140307/tests/signond-tests/access-control.pro 0000644 0000152 0177776 00000000171 12306320366 024752 0 ustar pbuser nogroup 0000000 0000000 TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS = \
mock-ac-plugin \
identity-tool.pro \
tst_access_control.pro
signon-8.56+14.04.20140307/tests/signond-tests/tst_database.pro 0000644 0000152 0177776 00000000515 12306320366 024473 0 ustar pbuser nogroup 0000000 0000000 TARGET = tst_database
include(signond-tests.pri)
HEADERS += \
databasetest.h \
$$TOP_SRC_DIR/src/signond/credentialsdb.h \
$$TOP_SRC_DIR/src/signond/default-secrets-storage.h
SOURCES = \
databasetest.cpp \
$$TOP_SRC_DIR/src/signond/credentialsdb.cpp \
$$TOP_SRC_DIR/src/signond/default-secrets-storage.cpp
signon-8.56+14.04.20140307/tests/signond-tests/.gitignore 0000644 0000152 0177776 00000000177 12306320366 023307 0 ustar pbuser nogroup 0000000 0000000 /identity-tool
/mock-ac-plugin/identity-ac-helper
/tst_access_control
/tst_backup
/tst_database
/tst_pluginproxy
/tst_timeouts
signon-8.56+14.04.20140307/tests/signond-tests/tst_access_control.pro 0000644 0000152 0177776 00000000524 12306320366 025730 0 ustar pbuser nogroup 0000000 0000000 TARGET = tst_access_control
include(signond-tests.pri)
SOURCES = \
tst_access_control.cpp
check.commands = "SSO_PLUGINS_DIR=$${TOP_BUILD_DIR}/src/plugins/test SSO_EXTENSIONS_DIR=$${TOP_BUILD_DIR}/tests/signond-tests/mock-ac-plugin SSO_CONFIG_FILE_DIR=$${TOP_SRC_DIR}/tests/signond-tests/mock-ac-plugin $$RUN_WITH_SIGNOND ./$$TARGET"
signon-8.56+14.04.20140307/tests/signond-tests/backuptest.cpp 0000644 0000152 0177776 00000011344 12306320366 024166 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "backuptest.h"
#include "signond/signoncommon.h"
#include
#include
void TestBackup::initTestCase()
{
/*
daemonProcess = new QProcess();
daemonProcess->start("signond");
daemonProcess->waitForStarted(10 * 1000);
*/
}
void TestBackup::cleanupTestCase()
{
/*
daemonProcess->kill();
daemonProcess->waitForFinished();
delete daemonProcess;
*/
}
void TestBackup::init()
{
//wait a bit between tests
sleep(5);
}
void TestBackup::cleanup()
{
sleep(1);
}
void TestBackup::backupTest()
{
QDBusConnection conn (SIGNOND_BUS);
//remove backup files
QFile::remove("/home/user/.signon/signondb.bin");
QDBusMessage msg =
QDBusMessage::createMethodCall(SIGNOND_SERVICE + ".Backup",
SIGNOND_DAEMON_OBJECTPATH + "/Backup",
"com.nokia.backupclient",
"backupStarts");
QList args;
msg.setArguments(args);
QDBusMessage reply = conn.call(msg, QDBus::Block, 10*1000);
QVERIFY(reply.type() == QDBusMessage::ReplyMessage);
//check if backup file was created successfully
QVERIFY(QFile::exists("/home/user/.signon/signondb.bin"));
QFile::copy("/home/user/.signon/signondb.bin",
"/home/user/.signon/signondb.bin2");
msg = QDBusMessage::createMethodCall(SIGNOND_SERVICE + ".Backup",
SIGNOND_DAEMON_OBJECTPATH + "/Backup",
"com.nokia.backupclient",
"backupFinished");
reply = conn.call(msg, QDBus::Block, 10*1000);
QVERIFY(reply.type() == QDBusMessage::ReplyMessage);
QVERIFY(QFile::exists("/home/user/.signon/signondb.bin") == false);
}
void TestBackup::restoreTest()
{
QDBusConnection conn (SIGNOND_BUS);
QVERIFY(QFile::exists("/home/user/.signon/signondb.bin2"));
QFile::rename("/home/user/.signon/signondb.bin2",
"/home/user/.signon/signondb.bin");
QDBusMessage msg =
QDBusMessage::createMethodCall(SIGNOND_SERVICE + ".Backup",
SIGNOND_DAEMON_OBJECTPATH + "/Backup",
"com.nokia.backupclient",
"restoreStarts");
QList args;
msg.setArguments(args);
QDBusMessage reply = conn.call(msg, QDBus::Block, 10*1000);
QVERIFY(reply.type() == QDBusMessage::ReplyMessage);
//check if backup file was created successfully
msg = QDBusMessage::createMethodCall(SIGNOND_SERVICE + ".Backup",
SIGNOND_DAEMON_OBJECTPATH + "/Backup",
"com.nokia.backupclient",
"restoreFinished");
reply = conn.call(msg, QDBus::Block, 10*1000);
QVERIFY(QFile::exists("/home/user/.signon/signondb.bin") == false);
QVERIFY(QFile::exists("/home/user/.signon/signon.db"));
QVERIFY(reply.type() == QDBusMessage::ReplyMessage);
}
void TestBackup::backupNormalTest()
{
daemonProcess = new QProcess();
daemonProcess->start("signond");
daemonProcess->waitForStarted(10 * 1000);
backupTest();
//check that daemon is still running normally after backup close signal
QVERIFY(daemonProcess->state()==QProcess::Running);
daemonProcess->kill();
daemonProcess->waitForFinished();
delete daemonProcess;
daemonProcess = NULL;
}
void TestBackup::restoreNormalTest()
{
daemonProcess = new QProcess();
daemonProcess->start("signond");
daemonProcess->waitForStarted(10 * 1000);
restoreTest();
//check that daemon is still running normally after backup close signal
QVERIFY(daemonProcess->state()==QProcess::Running);
daemonProcess->kill();
daemonProcess->waitForFinished();
delete daemonProcess;
daemonProcess = NULL;
}
QTEST_MAIN(TestBackup)
signon-8.56+14.04.20140307/tests/signond-tests/testpluginproxy.h 0000644 0000152 0177776 00000003073 12306320366 024766 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 TESTPLUGINPROXY_H_
#define TESTPLUGINPROXY_H_
#include
#include
#include "signond/signoncommon.h"
#include "SignOn/sessiondata.h"
#include "SignOn/authpluginif.h"
#include "pluginproxy.h"
using namespace SignonDaemonNS;
using namespace SignOn;
class TestPluginProxy: public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void create_nonexisting();
void create_dummy();
void type_for_dummy();
void mechanisms_for_dummy();
void process_for_dummy();
void processUi_for_dummy();
void process_wrong_mech_for_dummy();
void process_and_cancel_for_dummy();
void wrong_user_for_dummy();
private:
PluginProxy *m_proxy;
};
#endif //TESTPLUGINPROXY_H_
signon-8.56+14.04.20140307/tests/signond-tests/identity-tool.cpp 0000644 0000152 0177776 00000003671 12306320366 024631 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include
#include
#include
using namespace SignOn;
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QTextStream out(stdout);
IdentityInfo info;
QStringList args = QCoreApplication::arguments();
for (int i = 1; i < args.count(); i++) {
if (args[i] == "--acl") {
info.setAccessControlList(args[++i].split(','));
} else if (args[i] == "--method") {
QString method = args[++i];
QStringList mechanisms = args[++i].split(',');
info.setMethod(method, mechanisms);
} else if (args[i] == "--caption") {
info.setCaption(args[++i]);
}
}
Identity *identity = Identity::newIdentity(info);
Q_ASSERT(identity != NULL);
QObject::connect(identity, SIGNAL(error(const SignOn::Error&)),
&app, SLOT(quit()));
QObject::connect(identity, SIGNAL(credentialsStored(const quint32)),
&app, SLOT(quit()));
identity->storeCredentials();
app.exec();
Q_ASSERT(identity->id() != 0);
out << identity->id();
return 0;
}
signon-8.56+14.04.20140307/tests/signond-tests/testpluginproxy.cpp 0000644 0000152 0177776 00000020242 12306320366 025316 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include
#include "testpluginproxy.h"
#include
#include
#include
void TestPluginProxy::initTestCase()
{
m_proxy = NULL;
#ifndef NO_SIGNON_USER
QVERIFY2(!::getuid(), "test must be run as root");
//check signon user
struct passwd *signonUser = getpwnam("signon");
QVERIFY2(signonUser,
"signon user do not exist, add with 'useradd --system signon'");
#endif
qRegisterMetaType("QVariantMap");
}
void TestPluginProxy::cleanupTestCase()
{
delete m_proxy;
}
void TestPluginProxy::create_nonexisting()
{
PluginProxy *pp = PluginProxy::createNewPluginProxy("nonexisting");
QVERIFY(pp == NULL);
}
void TestPluginProxy::create_dummy()
{
PluginProxy *pp = PluginProxy::createNewPluginProxy("ssotest");
QVERIFY(pp != NULL);
m_proxy = pp;
}
void TestPluginProxy::type_for_dummy()
{
QString type = m_proxy->type();
QVERIFY(type == "ssotest");
}
void TestPluginProxy::mechanisms_for_dummy()
{
QStringList mechs = m_proxy->mechanisms();
QStringList pattern;
pattern << "mech1";
pattern << "mech2";
pattern << "mech3";
pattern << "BLOB";
QVERIFY(mechs == pattern);
}
void TestPluginProxy::process_for_dummy()
{
// Build up the session data. It will include a value
// which is itself a QVariantMap in order to test the
// dbus argument expansion during marshalling.
QVariantMap providedTokens;
providedTokens.insert("AccessToken", "12345");
providedTokens.insert("RefreshToken", "abcde");
QVariantMap complexInData;
complexInData.insert("ProvidedTokens", providedTokens);
SessionData inData(complexInData);
inData.setRealm("testRealm");
inData.setUserName("testUsername");
QVariantMap inDataV;
foreach(QString key, inData.propertyNames())
inDataV[key] = inData.getProperty(key);
QSignalSpy spyResult(m_proxy,
SIGNAL(processResultReply(const QVariantMap&)));
QSignalSpy spyState(m_proxy,
SIGNAL(stateChanged(int, const QString&)));
QEventLoop loop;
QObject::connect(m_proxy,
SIGNAL(processResultReply(const QVariantMap&)),
&loop,
SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
QString cancelKey = QUuid::createUuid().toString();
bool res = m_proxy->process(inDataV, "mech1");
QVERIFY(res);
loop.exec();
QCOMPARE(spyResult.count(), 1);
QCOMPARE(spyState.count(), 10);
QVariantMap outData = spyResult.at(0).at(0).toMap();
qDebug() << outData;
QVERIFY(outData.contains("UserName") &&
outData["UserName"] == "testUsername");
QVERIFY(outData.contains("Realm") &&
outData["Realm"] == "testRealm_after_test");
QVERIFY(outData.contains("ProvidedTokens") &&
outData["ProvidedTokens"] == providedTokens);
}
void TestPluginProxy::processUi_for_dummy()
{
SessionData inData;
inData.setRealm("testRealm");
inData.setUserName("testUsername");
inData.setUiPolicy(NoUserInteractionPolicy);
QVariantMap inDataV;
foreach(QString key, inData.propertyNames())
inDataV[key] = inData.getProperty(key);
QSignalSpy spyResult(m_proxy,
SIGNAL(processResultReply(const QVariantMap&)));
QSignalSpy spyError(m_proxy,
SIGNAL(processError(int, const QString&)));
QSignalSpy spyUi(m_proxy,
SIGNAL(processUiRequest(const QVariantMap&)));
QEventLoop loop;
QObject::connect(m_proxy,
SIGNAL(processResultReply(const QVariantMap&)),
&loop,
SLOT(quit()));
QObject::connect(m_proxy,
SIGNAL(processError(int, const QString&)),
&loop,
SLOT(quit()));
QObject::connect(m_proxy,
SIGNAL(processUiRequest(const QVariantMap&)),
&loop,
SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
QString cancelKey = QUuid::createUuid().toString();
bool res = m_proxy->process(inDataV, "mech2");
QVERIFY(res);
loop.exec();
QCOMPARE(spyUi.count(), 0);
QCOMPARE(spyError.count(), 1);
int err = spyError.at(0).at(0).toInt();
QString errMsg = spyError.at(0).at(1).toString();
qDebug() << err;
qDebug() << errMsg;
QVERIFY(err == Error::NotAuthorized);
inDataV["UiPolicy"] = 0;
res = m_proxy->process(inDataV, "mech2");
QVERIFY(res);
loop.exec();
QCOMPARE(spyUi.count(), 1);
}
void TestPluginProxy::process_and_cancel_for_dummy()
{
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
QVariantMap inDataV;
foreach(QString key, inData.propertyNames())
inDataV[key] = inData.getProperty(key);
QSignalSpy spyResult(m_proxy, SIGNAL(processResultReply(const QVariantMap&)));
QSignalSpy spyError(m_proxy, SIGNAL(processError(int, const QString&)));
QEventLoop loop;
QObject::connect(m_proxy,
SIGNAL(processResultReply(const QVariantMap&)),
&loop,
SLOT(quit()));
QObject::connect(m_proxy,
SIGNAL(processError(int, const QString&)),
&loop,
SLOT(quit()));
QTimer::singleShot(0.2*1000, m_proxy, SLOT(cancel()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
bool res = m_proxy->process(inDataV, "mech1");
QVERIFY(res);
loop.exec();
QCOMPARE(spyResult.count(), 0);
QCOMPARE(spyError.count(), 1);
int err = spyError.at(0).at(0).toInt();
QString errMsg = spyError.at(0).at(1).toString();
qDebug() << err;
qDebug() << errMsg;
QVERIFY(err == Error::SessionCanceled);
QVERIFY(errMsg == QString("The operation is canceled"));
}
void TestPluginProxy::process_wrong_mech_for_dummy()
{
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
QVariantMap inDataV;
foreach(QString key, inData.propertyNames())
inDataV[key] = inData.getProperty(key);
QSignalSpy spyResult(m_proxy, SIGNAL(processResultReply(const QVariantMap&)));
QSignalSpy spyError(m_proxy, SIGNAL(processError(int, const QString&)));
QEventLoop loop;
QObject::connect(m_proxy,
SIGNAL(processResultReply(const QVariantMap&)),
&loop,
SLOT(quit()));
QObject::connect(m_proxy,
SIGNAL(processError(int, const QString&)),
&loop,
SLOT(quit()));
bool res = m_proxy->process(inDataV, "wrong");
QVERIFY(res);
loop.exec();
QCOMPARE(spyResult.count(), 0);
QCOMPARE(spyError.count(), 1);
int err = spyError.at(0).at(0).toInt();
QString errMsg = spyError.at(0).at(1).toString();
qDebug() << err << " " << errMsg;
QVERIFY(err == Error::MechanismNotAvailable);
QVERIFY(errMsg == QString("The given mechanism is unavailable"));
}
void TestPluginProxy::wrong_user_for_dummy()
{
if (::getuid()) {
QSKIP("This test need to be run as root", SkipSingle);
}
#ifndef NO_SIGNON_USER
QProcess *pluginProcess = new QProcess(this);
QVERIFY(pluginProcess->execute(QString("/usr/bin/signonpluginprocess"))==2);
#endif
}
#if !defined(SSO_CI_TESTMANAGEMENT)
QTEST_MAIN(TestPluginProxy)
#endif
signon-8.56+14.04.20140307/tests/signond-tests/tst_backup.pro 0000644 0000152 0177776 00000000157 12306320366 024176 0 ustar pbuser nogroup 0000000 0000000 TARGET = tst_backup
include(signond-tests.pri)
HEADERS += \
backuptest.h
SOURCES = \
backuptest.cpp
signon-8.56+14.04.20140307/tests/signond-tests/tst_access_control.cpp 0000644 0000152 0177776 00000020621 12306320366 025712 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define IDENTITY_TOOL "./identity-tool"
using namespace SignOn;
namespace SignOnTests {
class AccessControlTest: public QObject
{
Q_OBJECT
public Q_SLOTS:
void onInfo(const SignOn::IdentityInfo &info);
private Q_SLOTS:
void testOwner();
void testAccessDenied();
void testAccessDeniedSession();
void testAccessAllowed();
void testAccessRequestAllowed();
void testAccessRequestAllowedSession();
private:
IdentityInfo m_info;
};
} // namespace
using namespace SignOnTests;
void AccessControlTest::onInfo(const SignOn::IdentityInfo &info)
{
qDebug() << "Owner:" < methods;
methods.insert("dummy", QStringList() << "mech1" << "mech2");
IdentityInfo info = IdentityInfo(QLatin1String("ac test"),
QLatin1String("ac@test"),
methods);
Identity *identity = Identity::newIdentity(info, this);
QVERIFY(identity != NULL);
QObject::connect(identity, SIGNAL(error(const SignOn::Error&)),
&loop, SLOT(quit()));
QObject::connect(identity, SIGNAL(credentialsStored(const quint32)),
&loop, SLOT(quit()));
identity->storeCredentials();
loop.exec();
QVERIFY(identity->id() != 0);
QObject::connect(identity, SIGNAL(info(const SignOn::IdentityInfo&)),
this, SLOT(onInfo(const SignOn::IdentityInfo&)));
QObject::connect(identity, SIGNAL(info(const SignOn::IdentityInfo&)),
&loop, SLOT(quit()));
identity->queryInfo();
loop.exec();
QCOMPARE(m_info.owner(), QCoreApplication::arguments().at(0));
delete identity;
}
void AccessControlTest::testAccessDenied()
{
/* Create an identity from another process */
QProcess identityTool;
identityTool.start(IDENTITY_TOOL,
QStringList() << "--caption" << "no-acl");
QVERIFY(identityTool.waitForFinished());
uint id = identityTool.readAll().toUInt();
qDebug() << "Identity was created:" << id;
Identity *identity = Identity::existingIdentity(id);
QVERIFY(identity != NULL);
QEventLoop loop;
QSignalSpy infoSpy(identity, SIGNAL(info(const SignOn::IdentityInfo&)));
QSignalSpy errorSpy(identity, SIGNAL(error(const SignOn::Error&)));
QObject::connect(identity, SIGNAL(error(const SignOn::Error&)),
&loop, SLOT(quit()));
QObject::connect(identity, SIGNAL(info(const SignOn::IdentityInfo&)),
&loop, SLOT(quit()));
identity->queryInfo();
loop.exec();
QCOMPARE(infoSpy.count(), 0);
QCOMPARE(errorSpy.count(), 1);
SignOn::Error error = errorSpy.at(0).at(0).value();
QCOMPARE(error.type(), int(SignOn::Error::PermissionDenied));
delete identity;
}
void AccessControlTest::testAccessDeniedSession()
{
/* Create an identity from another process */
QProcess identityTool;
identityTool.start(IDENTITY_TOOL,
QStringList() << "--caption" << "no-acl");
QVERIFY(identityTool.waitForFinished());
uint id = identityTool.readAll().toUInt();
qDebug() << "Identity was created:" << id;
AuthSession *session = new AuthSession(id, "dummy");
QVERIFY(session != NULL);
QEventLoop loop;
QSignalSpy errorSpy(session, SIGNAL(error(const SignOn::Error&)));
QObject::connect(session, SIGNAL(error(const SignOn::Error&)),
&loop, SLOT(quit()));
session->process(SessionData());
loop.exec();
QCOMPARE(errorSpy.count(), 1);
SignOn::Error error = errorSpy.at(0).at(0).value();
QCOMPARE(error.type(), int(SignOn::Error::PermissionDenied));
delete session;
}
void AccessControlTest::testAccessAllowed()
{
/* Create an identity from another process */
QProcess identityTool;
identityTool.start(IDENTITY_TOOL,
QStringList() << "--caption" << "with-acl" <<
"--acl" << QCoreApplication::arguments().at(0));
QVERIFY(identityTool.waitForFinished());
uint id = identityTool.readAll().toUInt();
qDebug() << "Identity was created:" << id;
Identity *identity = Identity::existingIdentity(id);
QVERIFY(identity != NULL);
QEventLoop loop;
QSignalSpy infoSpy(identity, SIGNAL(info(const SignOn::IdentityInfo&)));
QSignalSpy errorSpy(identity, SIGNAL(error(const SignOn::Error&)));
QObject::connect(identity, SIGNAL(error(const SignOn::Error&)),
&loop, SLOT(quit()));
QObject::connect(identity, SIGNAL(info(const SignOn::IdentityInfo&)),
&loop, SLOT(quit()));
identity->queryInfo();
loop.exec();
QCOMPARE(infoSpy.count(), 1);
QCOMPARE(errorSpy.count(), 0);
delete identity;
}
void AccessControlTest::testAccessRequestAllowed()
{
/* Create an identity from another process; use the "allow" caption to tell
* the mock-ac-plugin to allow requests to this identity.
*/
QProcess identityTool;
identityTool.start(IDENTITY_TOOL,
QStringList() << "--caption" << "allow");
QVERIFY(identityTool.waitForFinished());
uint id = identityTool.readAll().toUInt();
qDebug() << "Identity was created:" << id;
Identity *identity = Identity::existingIdentity(id);
QVERIFY(identity != NULL);
QEventLoop loop;
QSignalSpy infoSpy(identity, SIGNAL(info(const SignOn::IdentityInfo&)));
QSignalSpy errorSpy(identity, SIGNAL(error(const SignOn::Error&)));
QObject::connect(identity, SIGNAL(error(const SignOn::Error&)),
&loop, SLOT(quit()));
QObject::connect(identity, SIGNAL(info(const SignOn::IdentityInfo&)),
&loop, SLOT(quit()));
identity->queryInfo();
loop.exec();
QCOMPARE(infoSpy.count(), 1);
QCOMPARE(errorSpy.count(), 0);
/* Verify that our process has been added to the ACL (by the
* mock-ac-plugin, after seeing our special caption).
*/
SignOn::IdentityInfo info =
infoSpy.at(0).at(0).value();
QCOMPARE(info.caption(), QLatin1String("allow"));
QCOMPARE(info.accessControlList(),
QStringList() << QCoreApplication::arguments().at(0));
delete identity;
}
void AccessControlTest::testAccessRequestAllowedSession()
{
/* Create an identity from another process; use the "allow" caption to tell
* the mock-ac-plugin to allow requests to this identity.
*/
QProcess identityTool;
identityTool.start(IDENTITY_TOOL,
QStringList() << "--caption" << "allow");
QVERIFY(identityTool.waitForFinished());
uint id = identityTool.readAll().toUInt();
qDebug() << "Identity was created:" << id;
AuthSession *session = new AuthSession(id, "dummy");
QVERIFY(session != NULL);
QEventLoop loop;
QSignalSpy errorSpy(session, SIGNAL(error(const SignOn::Error&)));
QObject::connect(session, SIGNAL(error(const SignOn::Error&)),
&loop, SLOT(quit()));
session->process(SessionData());
loop.exec();
QCOMPARE(errorSpy.count(), 1);
/* The error should be about the unknown "dummy" method, and not a
* permission denied */
SignOn::Error error = errorSpy.at(0).at(0).value();
QCOMPARE(error.type(), int(SignOn::Error::MethodNotAvailable));
delete session;
}
QTEST_MAIN(AccessControlTest)
#include "tst_access_control.moc"
signon-8.56+14.04.20140307/tests/signond-tests/signond-tests.pro 0000644 0000152 0177776 00000000263 12306320366 024636 0 ustar pbuser nogroup 0000000 0000000 TEMPLATE = subdirs
SUBDIRS = \
tst_timeouts.pro \
tst_pluginproxy.pro \
tst_database.pro \
access-control.pro \
# Disabled until fixed
#SUBDIRS += tst_backup.pro
signon-8.56+14.04.20140307/tests/signond-tests/tst_timeouts.pro 0000644 0000152 0177776 00000000155 12306320366 024600 0 ustar pbuser nogroup 0000000 0000000 TARGET = tst_timeouts
include(signond-tests.pri)
HEADERS += \
timeouts.h
SOURCES = \
timeouts.cpp
signon-8.56+14.04.20140307/tests/signond-tests/tst_pluginproxy.pro 0000644 0000152 0177776 00000000415 12306320366 025326 0 ustar pbuser nogroup 0000000 0000000 TARGET = tst_pluginproxy
include(signond-tests.pri)
HEADERS += \
testpluginproxy.h \
$$TOP_SRC_DIR/src/signond/pluginproxy.h \
$${TOP_SRC_DIR}/lib/plugins/signon-plugins-common/SignOn/blobiohandler.h
SOURCES = \
testpluginproxy.cpp \
include.cpp
signon-8.56+14.04.20140307/tests/signond-tests/databasetest.h 0000644 0000152 0177776 00000003614 12306320366 024133 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 DATABASETEST_H_
#define DATABASETEST_H_
#include
#include
#include "signond/signoncommon.h"
#include "credentialsdb.h"
#include "default-secrets-storage.h"
#include "signonidentityinfo.h"
using namespace SignOn;
using namespace SignonDaemonNS;
class TestDatabase: public QObject
{
Q_OBJECT
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
void cleanup();
void createTableStructureTest();
void queryListTest();
void insertMethodsTest();
void methodsTest();
void checkPasswordTest();
void credentialsTest();
void insertCredentialsTest();
void updateCredentialsTest();
void removeCredentialsTest();
void clearTest();
void dataTest();
void referenceTest();
void cacheTest();
void accessControlListTest();
void credentialsOwnerSecurityTokenTest();
private:
CredentialsDB *m_db;
DefaultSecretsStorage *m_secretsStorage;
MetaDataDB *m_meta;
MethodMap testMethods;
QStringList testRealms;
QStringList testAcl;
};
#endif //DATABASETEST_H_
signon-8.56+14.04.20140307/tests/signond-tests/identity-tool.pro 0000644 0000152 0177776 00000000561 12306320366 024642 0 ustar pbuser nogroup 0000000 0000000 include(../../common-project-config.pri)
TEMPLATE = app
TARGET = identity-tool
QT += core
QT -= gui
greaterThan(QT_MAJOR_VERSION, 4) {
LIBS += -lsignon-qt5
} else {
LIBS += -lsignon-qt
}
QMAKE_LIBDIR += \
$${TOP_BUILD_DIR}/lib/signond/SignOn
QMAKE_RPATHDIR = $${QMAKE_LIBDIR}
INCLUDEPATH += \
$${TOP_SRC_DIR}/lib
SOURCES = \
identity-tool.cpp
signon-8.56+14.04.20140307/tests/signond-tests/databasetest.cpp 0000644 0000152 0177776 00000047255 12306320366 024477 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "databasetest.h"
#include "signond/signoncommon.h"
#include
#include
#include "credentialsdb.h"
#include "signonidentityinfo.cpp"
const QString dbFile = QLatin1String("/tmp/signon_test.db");
const QString secretsDbFile = QLatin1String("/tmp/signon_test_secrets.db");
void TestDatabase::initTestCase()
{
QFile::remove(dbFile);
QFile::remove(secretsDbFile);
m_secretsStorage = new DefaultSecretsStorage();
m_db = new CredentialsDB(dbFile, m_secretsStorage);
m_meta = m_db->metaDataDB;
QVERIFY(m_db != 0);
QStringList mechs = QStringList() <<
QString::fromLatin1("Mech1") <<
QString::fromLatin1("Mech2");
testMethods.insert(QLatin1String("Method1"), mechs);
testMethods.insert(QLatin1String("Method2"), mechs);
testMethods.insert(QLatin1String("Method3"), QStringList());
testRealms = QStringList() <<
QLatin1String("Realm1.com") <<
QLatin1String("Realm2.com") <<
QLatin1String("Realm3.com");
testAcl = QStringList() <<
QLatin1String("AID::12345678") <<
QLatin1String("AID::87654321") <<
QLatin1String("test::property");
}
void TestDatabase::cleanupTestCase()
{
delete m_db;
m_db = NULL;
delete m_secretsStorage;
m_secretsStorage = 0;
//remove database file
//QFile::remove(dbFile);
}
void TestDatabase::init()
{
}
void TestDatabase::cleanup()
{
if (m_db->isSecretsDBOpen())
m_db->closeSecretsDB();
}
void TestDatabase::createTableStructureTest()
{
QVERIFY(!m_meta->hasTables());
m_db->init();
QVERIFY(m_meta->hasTables());
bool success = m_db->openSecretsDB(secretsDbFile);
QVERIFY(success);
}
void TestDatabase::queryListTest()
{
QString queryStr;
/*create test table*/
queryStr = QString::fromLatin1(
"CREATE TABLE TESTING"
"(identity_id INTEGER ,"
"realm TEXT,"
"hostname TEXT,"
"PRIMARY KEY (identity_id, realm, hostname))");
QSqlQuery insertQuery = m_meta->exec(queryStr);
m_meta->commit();
queryStr = QString::fromLatin1(
"INSERT INTO TESTING (identity_id, realm) "
"VALUES('%1', '%2')")
.arg(80).arg(QLatin1String("a"));
insertQuery = m_meta->exec(queryStr);
queryStr = QString::fromLatin1(
"INSERT INTO TESTING (identity_id, realm) "
"VALUES('%1', '%2')")
.arg(80).arg(QLatin1String("b"));
insertQuery = m_meta->exec(queryStr);
QStringList list = m_meta->queryList(QString::fromLatin1(
"SELECT realm FROM TESTING WHERE identity_id = 80"));
QVERIFY(list.contains(QLatin1String("a")));
QVERIFY(list.contains(QLatin1String("b")));
QVERIFY(list.count() == 2);
list = m_meta->queryList(QString::fromLatin1(
"SELECT realm FROM TESTING WHERE identity_id = 81"));
QVERIFY(list.count() == 0);
}
void TestDatabase::insertMethodsTest()
{
//test empty list
QMap methods;
m_meta->insertMethods(methods);
QStringList list = m_meta->queryList(QString::fromLatin1(
"SELECT method FROM METHODS"));
QVERIFY(list.count() == 0);
list = m_meta->queryList(QString::fromLatin1(
"SELECT mechanism FROM MECHANISMS"));
QVERIFY(list.count() == 0);
//test real list
QStringList mechs =
QStringList() << QLatin1String("M1")<< QLatin1String("M2");
methods.insert(QLatin1String("Test"), mechs);
methods.insert(QLatin1String("Test2"), mechs);
m_meta->insertMethods(methods);
list = m_meta->queryList(QString::fromLatin1(
"SELECT method FROM METHODS"));
qDebug() << list;
QVERIFY(list.contains(QLatin1String("Test")));
QVERIFY(list.contains(QLatin1String("Test2")));
QVERIFY(list.count() == 2);
list = m_meta->queryList(QString::fromLatin1(
"SELECT mechanism FROM MECHANISMS"));
qDebug() << list;
QVERIFY(list.contains(QLatin1String("M1")));
QVERIFY(list.contains(QLatin1String("M2")));
QVERIFY(list.count() == 2);
}
void TestDatabase::methodsTest()
{
quint32 id;
SignonIdentityInfo info;
info.setMethods(testMethods);
id = m_db->insertCredentials(info);
QStringList meths = m_db->methods(id);
QVERIFY(meths.contains(QLatin1String("Method1")));
QVERIFY(meths.contains(QLatin1String("Method2")));
QVERIFY(meths.contains(QLatin1String("Method3")));
QVERIFY(meths.count() == 3);
}
void TestDatabase::checkPasswordTest()
{
quint32 id;
m_db->openSecretsDB(secretsDbFile);
SignonIdentityInfo info;
info.setUserName(QLatin1String("User"));
info.setPassword(QLatin1String("Pass"));
info.setStorePassword(true);
id = m_db->insertCredentials(info);
QVERIFY(m_db->checkPassword(id, info.userName(), info.password()));
QVERIFY(!m_db->checkPassword(id, info.userName(), QLatin1String("PassWd")));
QVERIFY(!m_db->checkPassword(id, QLatin1String("User2"), info.password()));
QVERIFY(!m_db->checkPassword(id, info.userName(), "' or password like '%"));
}
void TestDatabase::credentialsTest()
{
m_db->openSecretsDB(secretsDbFile);
m_db->clear();
QMap filter;
QList creds = m_db->credentials(filter);
QVERIFY(creds.count() == 0);
SignonIdentityInfo info;
info.setCaption(QLatin1String("Caption"));
m_db->insertCredentials(info);
creds = m_db->credentials(filter);
QVERIFY(creds.count() == 1);
m_db->insertCredentials(info);
creds = m_db->credentials(filter);
QVERIFY(creds.count() == 2);
foreach(SignonIdentityInfo info, creds) {
qDebug() << info.id() << info.caption();
}
//TODO check filtering when implemented
}
void TestDatabase::insertCredentialsTest()
{
SignonIdentityInfo info;
SignonIdentityInfo info2;
SignonIdentityInfo retInfo;
quint32 id;
//insert empty
id = m_db->insertCredentials(info);
retInfo = m_db->credentials(id, false);
QVERIFY(id != info.id());
info.setId(id);
QCOMPARE(retInfo.id(), info.id());
//insert with empty acl
info = SignonIdentityInfo();
info.setUserName(QLatin1String("User"));
info.setPassword(QLatin1String("Pass"));
info.setStorePassword(true);
info.setMethods(testMethods);
info.setRealms(testRealms);
id = m_db->insertCredentials(info);
retInfo = m_db->credentials(id, false);
QVERIFY(id != info.id());
info.setId(id);
retInfo.setPassword(info.password());
QCOMPARE(retInfo.id(), info.id());
QCOMPARE(retInfo.password(), info.password());
//insert with empty methods
MethodMap methods2;
info = SignonIdentityInfo();
info.setUserName(QLatin1String("User"));
info.setPassword(QLatin1String("Pass"));
info.setStorePassword(true);
info.setMethods(methods2);
info.setRealms(testRealms);
id = m_db->insertCredentials(info2);
retInfo = m_db->credentials(id, false);
QVERIFY(id != info2.id());
QCOMPARE(retInfo.methods(), info2.methods());
//insert complete
info = SignonIdentityInfo();
info.setUserName(QLatin1String("User"));
info.setPassword(QLatin1String("Pass"));
info.setStorePassword(true);
info.setMethods(testMethods);
info.setRealms(testRealms);
info.setAccessControlList(testAcl);
id = m_db->insertCredentials(info);
retInfo = m_db->credentials(id, false);
QVERIFY(id != info.id());
info.setId(id);
QVERIFY(info.password() != retInfo.password());
retInfo.setPassword(info.password());
QCOMPARE(info.methods(), retInfo.methods());
QCOMPARE(retInfo.password(), info.password());
QCOMPARE(retInfo.methods(), info.methods());
//with password and secrets DB disabled
id = m_db->insertCredentials(info);
retInfo = m_db->credentials(id, true);
QVERIFY(id != info.id());
info.setId(id);
QCOMPARE(retInfo.id(), info.id());
QCOMPARE(retInfo.password(), info.password());
//with password and secrets DB enabled
bool success = m_db->openSecretsDB(secretsDbFile);
QVERIFY(success);
id = m_db->insertCredentials(info);
retInfo = m_db->credentials(id, true);
QVERIFY(id != info.id());
info.setId(id);
QCOMPARE(retInfo.id(), info.id());
QCOMPARE(retInfo.password(), info.password());
}
void TestDatabase::updateCredentialsTest()
{
SignonIdentityInfo retInfo;
quint32 id;
bool success = m_db->openSecretsDB(secretsDbFile);
QVERIFY(success);
//insert complete
SignonIdentityInfo info;
info.setUserName(QLatin1String("User"));
info.setPassword(QLatin1String("Pass"));
info.setStorePassword(true);
info.setMethods(testMethods);
info.setRealms(testRealms);
info.setAccessControlList(testAcl);
id = m_db->insertCredentials(info);
retInfo = m_db->credentials(id, true);
info.setId(id);
QCOMPARE(retInfo.userName(), info.userName());
//update complete
QStringList urealms = QStringList() <<
QLatin1String("URealm1.com") <<
QLatin1String("URealm2.com") <<
QLatin1String("Realm3.com");
MethodMap umethods;
QStringList umechs =
QStringList() << QString::fromLatin1("UMech1") <<
QString::fromLatin1("Mech2") ;
umethods.insert(QLatin1String("Method1"), umechs);
umethods.insert(QLatin1String("UMethod2"), umechs);
umethods.insert(QLatin1String("Method3"), QStringList());
SignonIdentityInfo updateInfo;
updateInfo.setId(id);
updateInfo.setUserName(QLatin1String("UpUser"));
updateInfo.setPassword(QLatin1String("UpdatedPass"));
updateInfo.setStorePassword(true);
updateInfo.setMethods(umethods);
updateInfo.setRealms(urealms);
updateInfo.setAccessControlList(testAcl);
QVERIFY(m_db->updateCredentials(updateInfo));
retInfo = m_db->credentials(id, true);
QVERIFY(retInfo.userName() != info.userName());
QCOMPARE(retInfo.userName(), updateInfo.userName());
QCOMPARE(retInfo.password(), updateInfo.password());
QCOMPARE(retInfo.storePassword(), updateInfo.storePassword());
QCOMPARE(retInfo.methods(), updateInfo.methods());
QCOMPARE(retInfo.realms().toSet(), updateInfo.realms().toSet());
QCOMPARE(retInfo.accessControlList().toSet(),
updateInfo.accessControlList().toSet());
}
void TestDatabase::removeCredentialsTest()
{
SignonIdentityInfo retInfo;
quint32 id;
bool success = m_db->openSecretsDB(secretsDbFile);
QVERIFY(success);
SignonIdentityInfo info;
info.setUserName(QLatin1String("User"));
info.setPassword(QLatin1String("Pass"));
info.setStorePassword(true);
info.setMethods(testMethods);
info.setRealms(testRealms);
info.setAccessControlList(testAcl);
id = m_db->insertCredentials(info);
retInfo = m_db->credentials(id, true);
QVERIFY(id != info.id());
info.setId(id);
QCOMPARE(retInfo.userName(), info.userName());
QSqlQuery query;
QString queryStr = QString::fromLatin1(
"SELECT * FROM ACL WHERE identity_id = '%1'")
.arg(id);
query = m_meta->exec(queryStr);
QVERIFY(query.first());
QVERIFY(m_db->removeCredentials(id));
retInfo = m_db->credentials(id, true);
QVERIFY(retInfo.userName() != info.userName());
QCOMPARE(retInfo.id(), quint32(0));
//check that db is cleared
queryStr = QString::fromLatin1(
"SELECT * FROM ACL WHERE identity_id = '%1'")
.arg(id);
query = m_meta->exec(queryStr);
QVERIFY(!query.first());
queryStr = QString::fromLatin1(
"SELECT * FROM REALMS WHERE identity_id = '%1'")
.arg(id);
query = m_meta->exec(queryStr);
QVERIFY(!query.first());
queryStr = QString::fromLatin1(
"SELECT * FROM REFS WHERE identity_id = '%1'")
.arg(id);
query = m_meta->exec(queryStr);
QVERIFY(!query.first());
}
void TestDatabase::clearTest()
{
/* we expact this to fail, because the secrets DB is not available */
QVERIFY(!m_db->clear());
QSqlQuery query = m_meta->exec(QLatin1String("SELECT * FROM credentials"));
QVERIFY(query.first());
bool success = m_db->openSecretsDB(secretsDbFile);
QVERIFY(success);
QVERIFY(m_db->clear());
query = m_meta->exec(QLatin1String("SELECT * FROM credentials"));
QVERIFY(!query.first());
}
void TestDatabase::dataTest()
{
quint32 id;
QString method = QLatin1String("Method1");
SignonIdentityInfo info;
info.setUserName(QLatin1String("User"));
info.setPassword(QLatin1String("Pass"));
info.setStorePassword(true);
info.setMethods(testMethods);
info.setRealms(testRealms);
info.setAccessControlList(testAcl);
id = m_db->insertCredentials(info);
/* no secrets DB: data will be cached in memory */
QVariantMap cachedData;
cachedData.insert(QLatin1String("James"), QLatin1String("Bond"));
bool ret = m_db->storeData(id, method, cachedData);
QVERIFY(ret);
/* verify that the data is cached */
QCOMPARE(cachedData, m_db->loadData(id, method));
QCOMPARE(m_db->m_secretsCache->m_cache.count(), 1);
/* load the secrets DB */
ret = m_db->openSecretsDB(secretsDbFile);
QVERIFY(ret);
/* the cached data should have been stored into the DB and the
* cache should be clear */
QCOMPARE(cachedData, m_db->loadData(id, method));
QVERIFY(m_db->m_secretsCache->m_cache.isEmpty());
/* now store more data, with the secrets DB active */
QVariantMap result;
QVariantMap data;
data.insert(QLatin1String("token"), QLatin1String("tokenval"));
ret = m_db->storeData(id, method, data);
QVERIFY(ret);
result = m_db->loadData(id, method);
qDebug() << result;
QCOMPARE(result, data);
data.insert(QLatin1String("token"), QLatin1String("tokenvalupdated"));
data.insert(QLatin1String("token2"), QLatin1String("tokenval2"));
ret = m_db->storeData(id, method, data);
QVERIFY(ret);
result = m_db->loadData(id, method);
QCOMPARE(result, data);
data.insert(QLatin1String("token"), QVariant());
data.insert(QLatin1String("token2"), QVariant());
ret = m_db->storeData(id, method, data);
QVERIFY(ret);
result = m_db->loadData(id, method);
qDebug() << data;
QVERIFY(result.isEmpty());
ret = m_db->storeData(id, method, QVariantMap());
QVERIFY(ret);
result = m_db->loadData(id, method);
qDebug() << data;
QVERIFY(result.isEmpty());
data.clear();
for ( int i = 1000; i <1000+(SSO_MAX_TOKEN_STORAGE/10) +1 ; i++) {
data.insert(QString::fromLatin1("t%1").arg(i), QLatin1String("12345"));
}
ret = m_db->storeData(id, method, data);
QVERIFY(!ret);
result = m_db->loadData(id, method);
QVERIFY(result != data);
data.clear();
QVariantMap map;
map.insert("key1",QLatin1String("string"));
map.insert("key2",qint32(12));
data.insert("key", map);
ret = m_db->storeData(0, method, data);
QVERIFY(!ret);
result = m_db->loadData(0, method);
QVERIFY(result.isEmpty());
data.insert(QLatin1String("token"), QLatin1String("tokenvalupdated"));
data.insert(QLatin1String("token2"), QLatin1String("tokenval2"));
ret = m_db->storeData(id, method, data);
QVERIFY(ret);
ret = m_db->removeData(id, method);
QVERIFY(ret);
result = m_db->loadData(id, method);
QVERIFY(result.isEmpty());
}
void TestDatabase::referenceTest()
{
quint32 id;
SignonIdentityInfo info;
info.setUserName(QLatin1String("User"));
id = m_db->insertCredentials(info);
//add reference
bool ret = m_db->addReference(id, QLatin1String("AID::12345678"),
QLatin1String("ref1"));
QVERIFY(ret);
QStringList refs = m_db->references(id);
qDebug() << refs;
QVERIFY(refs.contains(QLatin1String("ref1")));
refs = m_db->references(id,QLatin1String("AID::12345678"));
QVERIFY(refs.contains(QLatin1String("ref1")));
refs = m_db->references(id,QLatin1String("AID::1234567"));
QVERIFY(!refs.contains(QLatin1String("ref1")));
//remove references
ret = m_db->removeReference(id, QLatin1String("AID::12345678"));
QVERIFY(ret);
refs = m_db->references(id);
qDebug() << refs;
QVERIFY(!refs.contains(QLatin1String("ref1")));
//add new and remove nonexisting reference
ret = m_db->addReference(id, QLatin1String("AID::12345678"),
QLatin1String("ref1"));
QVERIFY(ret);
ret = m_db->removeReference(id, QLatin1String("AID::12345678"),
QLatin1String("ref2"));
QVERIFY(!ret);
refs = m_db->references(id);
qDebug() << refs;
QVERIFY(refs.contains(QLatin1String("ref1")));
//remove specific reference
ret = m_db->removeReference(id, QLatin1String("AID::12345678"),
QLatin1String("ref1"));
QVERIFY(ret);
refs = m_db->references(id);
qDebug() << refs;
QVERIFY(!refs.contains(QLatin1String("ref1")));
}
void TestDatabase::cacheTest()
{
quint32 idWithStore, idWithoutStore;
SignonIdentityInfo info;
info.setUserName(QLatin1String("User"));
info.setPassword(QLatin1String("Pass"));
info.setStorePassword(true);
/* no secrets DB: data will be cached in memory */
idWithStore = m_db->insertCredentials(info);
QVERIFY(idWithStore != 0);
info.setPassword("Pass2");
info.setStorePassword(false);
idWithoutStore = m_db->insertCredentials(info);
QVERIFY(idWithoutStore != 0);
/* verify that the password is cached */
info = m_db->credentials(idWithStore, true);
QCOMPARE(info.password(), QLatin1String("Pass"));
info = m_db->credentials(idWithoutStore, true);
QCOMPARE(info.password(), QLatin1String("Pass2"));
/* load the secrets DB */
int ret = m_db->openSecretsDB(secretsDbFile);
QVERIFY(ret);
/* the cached data should have been stored into the DB, but not for
* idWithoutStore, which has storeSecret set to false.
*/
QString username, password;
bool ok;
ok = m_db->secretsStorage->loadCredentials(idWithStore,
username, password);
QVERIFY(ok);
QCOMPARE(password, QLatin1String("Pass"));
ok = m_db->secretsStorage->loadCredentials(idWithoutStore,
username, password);
QVERIFY(!ok);
}
void TestDatabase::accessControlListTest()
{
quint32 id;
SignonIdentityInfo info;
info.setUserName(QLatin1String("User"));
info.setAccessControlList(testAcl);
id = m_db->insertCredentials(info);
QStringList acl = m_db->accessControlList(id);
qDebug() << acl;
QCOMPARE(acl, info.accessControlList());
}
void TestDatabase::credentialsOwnerSecurityTokenTest()
{
quint32 id;
SignonIdentityInfo info;
info.setUserName(QLatin1String("User"));
info.setOwnerList(testAcl);
id = m_db->insertCredentials(info);
QString token = m_db->credentialsOwnerSecurityToken(id);
QCOMPARE(token, QLatin1String("AID::12345678"));
QStringList tokens = m_db->ownerList(id);
QCOMPARE(tokens.toSet(), testAcl.toSet());
}
QTEST_MAIN(TestDatabase)
signon-8.56+14.04.20140307/tests/tests.pri 0000644 0000152 0177776 00000000463 12306320366 020372 0 ustar pbuser nogroup 0000000 0000000 include( ../common-project-config.pri )
include( $$TOP_SRC_DIR/common-vars.pri )
RUN_WITH_SIGNOND = "BUILDDIR=$$TOP_BUILD_DIR SRCDIR=$$TOP_SRC_DIR $$TOP_SRC_DIR/tests/run-with-signond.sh"
QMAKE_EXTRA_TARGETS += check
CONFIG(install_tests) {
target.path = $${INSTALL_TESTDIR}
INSTALLS += target
}
signon-8.56+14.04.20140307/tests/run-with-signond.sh 0000755 0000152 0177776 00000002214 12306320366 022263 0 ustar pbuser nogroup 0000000 0000000 #! /bin/sh
# If there's already an instance of signond running, kill it
set -e
# start a local signond
export SSO_LOGGING_LEVEL=2
export SSO_STORAGE_PATH="/tmp"
export SSO_DAEMON_TIMEOUT=5
export SSO_IDENTITY_TIMEOUT=5
export SSO_AUTHSESSION_TIMEOUT=5
export PATH="${BUILDDIR}/src/remotepluginprocess:$PATH"
export LD_LIBRARY_PATH="${BUILDDIR}/lib/plugins/signon-plugins-common":"${BUILDDIR}/lib/signond/SignOn":"$LD_LIBRARY_PATH"
export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/tmp/runtime-$(whoami)}/signon-tests"
mkdir -p "$XDG_RUNTIME_DIR"
DBUS_CONFIG=${BUILDDIR}/tests/testsession.conf
# If dbus-test-runner exists, use it to run the tests in a separate D-Bus
# session
if command -v dbus-test-runner > /dev/null ; then
echo "Using dbus-test-runner"
export SSO_LOGGING_OUTPUT="stdout"
dbus-test-runner -m 180 --dbus-config=${DBUS_CONFIG} \
-t "$@" --keep-env
else
echo "Using dbus-launch"
eval $(dbus-launch --sh-syntax --config-file=${DBUS_CONFIG})
cleanUp() {
echo "Cleaning up."
kill "$DBUS_SESSION_BUS_PID"
}
trap cleanUp EXIT INT TERM
${CLIENT_WRAPPER} $@
trap - EXIT
cleanUp
fi
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/ 0000755 0000152 0177776 00000000000 12306320634 022255 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testauthsession.cpp 0000644 0000152 0177776 00000074241 12306320366 026240 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "signon-ui.h"
#include "testauthsession.h"
#include "testthread.h"
#include "SignOn/identity.h"
#include
#include
#include
#define SSO_TEST_CREATE_AUTH_SESSION(__session__, __method__) \
do { \
Identity *id = Identity::newIdentity(IdentityInfo(), this); \
__session__ = id->createSession(QLatin1String(__method__)); \
} while(0)
static AuthSession *g_currentSession = NULL;
static QStringList g_processReplyRealmsList;
static int g_bigStringSize = 50000;
static int g_bigStringReplySize = 0;
TestAuthSession::TestAuthSession(SignOnUI *signOnUI, QObject *parent):
QObject(parent),
m_signOnUI(signOnUI)
{
}
void TestAuthSession::initTestCase()
{
qDebug() << "HI!";
}
void TestAuthSession::cleanupTestCase()
{
qDebug() << "BYE!";
}
void TestAuthSession::sessionData()
{
QVariantMap originalMap;
originalMap["Hello"] = "World";
originalMap["Int"] = 4;
SessionData sessionData(originalMap);
QCOMPARE(sessionData.toMap(), originalMap);
}
void TestAuthSession::queryMechanisms_existing_method()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
QStringList wantedMechs;
QSignalSpy spy(as, SIGNAL(mechanismsAvailable(const QStringList&)));
QSignalSpy errorCounter(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(mechanismsAvailable(const QStringList&)),
&loop, SLOT(quit()));
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
as->queryAvailableMechanisms(wantedMechs);
if (!errorCounter.count())
loop.exec();
errorCounter.clear();
QCOMPARE(spy.count(), 1);
QStringList result = spy.at(0).at(0).toStringList();
QCOMPARE(result.size(), 4);
wantedMechs += "mech1";
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
as->queryAvailableMechanisms(wantedMechs);
if (!errorCounter.count())
loop.exec();
errorCounter.clear();
QCOMPARE(spy.count(), 2);
result = spy.at(1).at(0).toStringList();
QCOMPARE(result.size(), 1);
wantedMechs += "mech2";
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
as->queryAvailableMechanisms(wantedMechs);
if (!errorCounter.count())
loop.exec();
errorCounter.clear();
QCOMPARE(spy.count(), 3);
result = spy.at(2).at(0).toStringList();
QCOMPARE(result.size(), 2);
wantedMechs = QStringList("fake");
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
as->queryAvailableMechanisms(wantedMechs);
if (!errorCounter.count())
loop.exec();
errorCounter.clear();
QCOMPARE(spy.count(), 4);
result = spy.at(3).at(0).toStringList();
QCOMPARE(result.size(), 0);
}
void TestAuthSession::queryMechanisms_nonexisting_method()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "nonexisting");
QStringList wantedMechs;
QSignalSpy spy(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(mechanismsAvailable(const QStringList&)), &loop, SLOT(quit()));
QObject::connect(as, SIGNAL(error(const SignOn::Error &)), &loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
as->queryAvailableMechanisms(wantedMechs);
loop.exec();
QCOMPARE(spy.count(), 1);
}
void TestAuthSession::process_with_new_identity()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
g_processReplyRealmsList.clear();
connect(as, SIGNAL(response(const SignOn::SessionData &)), this, SLOT(response(const SignOn::SessionData &)));
QSignalSpy spy(as, SIGNAL(response(const SignOn::SessionData &)));
QSignalSpy errorCounter(as, SIGNAL(error(const SignOn::Error &)));
QSignalSpy stateCounter(as, SIGNAL(stateChanged(AuthSession::AuthSessionState, const QString&)));
QEventLoop loop;
QObject::connect(as, SIGNAL(response(const SignOn::SessionData &)), &loop, SLOT(quit()), Qt::QueuedConnection);
QObject::connect(as, SIGNAL(error(const SignOn::Error &)), &loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(stateCounter.count(), 12);
stateCounter.clear();
errorCounter.clear();
as->process(inData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(stateCounter.count(), 12);
stateCounter.clear();
errorCounter.clear();
as->process(inData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(stateCounter.count(), 12);
stateCounter.clear();
errorCounter.clear();
as->process(inData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(stateCounter.count(), 12);
stateCounter.clear();
errorCounter.clear();
QCOMPARE(spy.count(), 4);
QVERIFY(g_processReplyRealmsList.at(0) == "testRealm_after_test");
QVERIFY(g_processReplyRealmsList.at(1) == "testRealm_after_test");
QVERIFY(g_processReplyRealmsList.at(2) == "testRealm_after_test");
QVERIFY(g_processReplyRealmsList.at(3) == "testRealm_after_test");
}
void TestAuthSession::process_with_existing_identity()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
g_processReplyRealmsList.clear();
connect(as, SIGNAL(response(const SignOn::SessionData &)), this, SLOT(response(const SignOn::SessionData &)));
QSignalSpy errorCounter(as, SIGNAL(error(const SignOn::Error &)));
QSignalSpy stateCounter(as, SIGNAL(stateChanged(AuthSession::AuthSessionState, const QString&)));
QSignalSpy spy(as, SIGNAL(response(const SignOn::SessionData&)));
QEventLoop loop;
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)), &loop, SLOT(quit()));
QObject::connect(as, SIGNAL(error(const SignOn::Error &)), &loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(stateCounter.count(), 12);
stateCounter.clear();
errorCounter.clear();
as->process(inData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(stateCounter.count(), 12);
stateCounter.clear();
errorCounter.clear();
as->process(inData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(stateCounter.count(), 12);
stateCounter.clear();
errorCounter.clear();
as->process(inData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(stateCounter.count(), 12);
stateCounter.clear();
errorCounter.clear();
QCOMPARE(spy.count(), 4);
QVERIFY(g_processReplyRealmsList.at(0) == "testRealm_after_test");
QVERIFY(g_processReplyRealmsList.at(1) == "testRealm_after_test");
QVERIFY(g_processReplyRealmsList.at(2) == "testRealm_after_test");
QVERIFY(g_processReplyRealmsList.at(3) == "testRealm_after_test");
}
void TestAuthSession::process_with_nonexisting_type()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "nonexisting");
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData &)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QSignalSpy stateCounter(as, SIGNAL(stateChanged(AuthSession::AuthSessionState, const QString&)));
QEventLoop loop;
QObject::connect(as, SIGNAL(error(const SignOn::Error &)), &loop, SLOT(quit()), Qt::QueuedConnection);
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
loop.exec();
as->process(inData, "mech1");
loop.exec();
as->process(inData, "mech1");
loop.exec();
as->process(inData, "mech1");
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 4);
QVERIFY(stateCounter.count() <= 4);
}
void TestAuthSession::process_with_nonexisting_method()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData&)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QSignalSpy stateCounter(as, SIGNAL(stateChanged(AuthSession::AuthSessionState, const QString&)));
QEventLoop loop;
QObject::connect(as, SIGNAL(error(const SignOn::Error &)), &loop, SLOT(quit()), Qt::QueuedConnection);
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "nonexisting");
loop.exec();
as->process(inData, "nonexisting");
loop.exec();
as->process(inData, "nonexisting");
loop.exec();
as->process(inData, "nonexisting");
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 4);
QCOMPARE(stateCounter.count(), 8);
}
void TestAuthSession::process_with_unauthorized_method()
{
MechanismsList mechs;
mechs.append("mech1");
QMap methods;
methods.insert(QLatin1String("ssotest"), mechs);
IdentityInfo info("test_caption", "test_user_name", methods);
info.setSecret("test_secret");
Identity *id = Identity::newIdentity(info, this);
QSignalSpy spyResponseStoreCreds(id, SIGNAL(credentialsStored(const quint32)));
QSignalSpy spyErrorStoreCreds(id, SIGNAL(error(const SignOn::Error &)));
QEventLoop loopStoreCreds;
QObject::connect(id, SIGNAL(error(const SignOn::Error &)), &loopStoreCreds, SLOT(quit()), Qt::QueuedConnection);
QObject::connect(id, SIGNAL(credentialsStored(const quint32)), &loopStoreCreds, SLOT(quit()));
QTimer::singleShot(10*1000, &loopStoreCreds, SLOT(quit()));
id->storeCredentials();
loopStoreCreds.exec();
QCOMPARE(spyResponseStoreCreds.count(), 1);
QCOMPARE(spyErrorStoreCreds.count(), 0);
AuthSession *as = id->createSession(QLatin1String("ssotest"));
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData &)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(error(const SignOn::Error &)), &loop, SLOT(quit()), Qt::QueuedConnection);
QObject::connect(as, SIGNAL(response(const SignOn::SessionData &)), &loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
as->process(inData, "mech2");
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 1);
// Still make sure the error really was about bad auth method/mechanism
SignOn::Error::ErrorType errorType = SignOn::Error::Unknown;
QVariant var = spyError.at(0).at(0);
if (QLatin1String("SignOn::Error") == var.typeName()) {
SignOn::Error error = var.value();
errorType = (SignOn::Error::ErrorType)error.type();
}
QCOMPARE(errorType, SignOn::Error::MethodOrMechanismNotAllowed);
}
void TestAuthSession::process_from_other_process()
{
// In order to try reusing same authentication session from
// another process we need the session object path, which isn't
// available through the client API. To work around this we
// don't use the API but make direct D-Bus calls instead
// The session bus used by the API cannot be accessed outside
// the API library so create our own bus
QDBusConnection dbuscon1 =
QDBusConnection::connectToBus(QDBusConnection::SessionBus,
"originalconnection");
QDBusInterface iface(SIGNOND_SERVICE,
SIGNOND_DAEMON_OBJECTPATH,
SIGNOND_DAEMON_INTERFACE,
dbuscon1);
SlotMachine slotMachine;
QEventLoop sessionLoop;
QObject::connect(&slotMachine, SIGNAL(done()), &sessionLoop, SLOT(quit()));
QTimer::singleShot(10*1000, &sessionLoop, SLOT(quit()));
QVariantList arguments;
arguments += (quint32)SIGNOND_NEW_IDENTITY;
arguments += QString::fromLatin1("ssotest");
iface.callWithCallback(QLatin1String("getAuthSessionObjectPath"),
arguments, &slotMachine,
SLOT(authenticationSlot(const QString&)),
SLOT(errorSlot(const QDBusError&)));
sessionLoop.exec();
QString qs;
if (slotMachine.m_path.isEmpty())
qDebug() << "getAuthSessionObjectPath failed: " << slotMachine.m_errorMessage.toLatin1().data();
QVERIFY(slotMachine.m_path.length() > 0);
int exitCode = 1;
pid_t childPid = fork();
QVERIFY(childPid != -1);
if (childPid != 0) {
int status = 0;
childPid = waitpid(childPid, &status, 0);
QVERIFY(childPid != -1 && WIFEXITED(status));
exitCode = WEXITSTATUS(status);
} else {
// We're in the child process now...
// Do not reuse existing session bus because it is seen by signond
// as if coming from the parent process and we want to test connection
// from other process
QDBusConnection dbuscon2 = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "otherconnection");
QDBusInterface *dbus = new QDBusInterface(SIGNOND_SERVICE,
slotMachine.m_path,
QLatin1String(SIGNOND_AUTH_SESSION_INTERFACE),
dbuscon2);
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
QVariantMap inDataVarMap;
foreach(QString key, inData.propertyNames()) {
if (!inData.getProperty(key).isNull() && inData.getProperty(key).isValid())
inDataVarMap[key] = inData.getProperty(key);
}
arguments.clear();
arguments += inDataVarMap;
arguments += QString::fromLatin1("mech1");
QDBusMessage msg = QDBusMessage::createMethodCall(dbus->service(),
dbus->path(),
dbus->interface(),
QString::fromLatin1("process"));
msg.setArguments(arguments);
QEventLoop processLoop;
QObject::connect(&slotMachine, SIGNAL(done()), &processLoop, SLOT(quit()));
QTimer::singleShot(10*1000, &processLoop, SLOT(quit()));
dbus->connection().callWithCallback(msg, &slotMachine,
SLOT(responseSlot(const QVariantMap&)),
SLOT(errorSlot(const QDBusError&)),
SIGNOND_MAX_TIMEOUT);
processLoop.exec();
delete dbus;
if (slotMachine.m_responseReceived) {
qDebug() << "AuthSession::process succeeded even though it was expected to fail";
exit(1);
} else {
if (slotMachine.m_errorName == SIGNOND_PERMISSION_DENIED_ERR_NAME)
exit(0);
qDebug() << "AuthSession::process failed but with unexpected error: " <<
slotMachine.m_errorMessage;
exit(1);
}
}
QCOMPARE(exitCode, 0);
}
void TestAuthSession::process_many_times_after_auth()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData&)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(error(const SignOn::Error &)), &loop, SLOT(quit()));
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)), &loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
loop.exec();
QCOMPARE(spyResponse.count(), 1);
as->process(inData, "mech1");
as->process(inData, "mech1");
as->process(inData, "mech1");
as->process(inData, "mech1");
loop.exec();
QCOMPARE(spyResponse.count(), 2);
QCOMPARE(spyError.count(), 3);
as->process(inData, "mech1");
as->process(inData, "mech1");
as->process(inData, "mech1");
as->process(inData, "mech1");
loop.exec();
QCOMPARE(spyResponse.count(), 3);
QCOMPARE(spyError.count(), 6);
as->process(inData, "mech1");
as->process(inData, "mech1");
as->process(inData, "mech1");
as->process(inData, "mech1");
loop.exec();
QCOMPARE(spyResponse.count(), 4);
QCOMPARE(spyError.count(), 9);
}
void TestAuthSession::process_many_times_before_auth()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData&)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)),
&loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
as->process(inData, "mech1");
as->process(inData, "mech1");
as->process(inData, "mech1");
loop.exec();
QCOMPARE(spyError.count(), 3);
QCOMPARE(spyResponse.count(), 1);
}
void TestAuthSession::process_with_big_session_data()
{
//TODO once bug Bug#222200 is fixed, this test case can be enabled
QSKIP("This test requires fix", SkipSingle);
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData&)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)),
this, SLOT(response(const SignOn::SessionData&)));
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)),
&loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
QString bigString;
bigString.fill(QChar('A'), g_bigStringSize);
inData.setCaption(bigString);
as->process(inData, "BLOB");
loop.exec();
QCOMPARE(spyError.count(), 0);
QCOMPARE(spyResponse.count(), 1);
QCOMPARE(g_bigStringReplySize, g_bigStringSize);
}
void TestAuthSession::process_after_timeout()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData&)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)),
&loop, SLOT(quit()));
QTimer::singleShot(20*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
loop.exec();
QCOMPARE(spyResponse.count(), 1);
QCOMPARE(spyError.count(), 0);
spyResponse.clear();
// Wait for auto-destruction of the remote object
QTest::qWait(6000);
/* Create an authsession just to trigger the actual destruction of the
* first. */
AuthSession *as2;
SSO_TEST_CREATE_AUTH_SESSION(as2, "ssotest");
Q_UNUSED(as2);
// Try processing again
as->process(inData, "mech1");
loop.exec();
QCOMPARE(spyResponse.count(), 1);
QCOMPARE(spyError.count(), 0);
}
void TestAuthSession::cancel_immediately()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData&)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()));
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()), Qt::QueuedConnection);
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
as->cancel();
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 1);
as->process(inData, "mech1");
as->cancel();
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 2);
as->process(inData, "mech1");
as->cancel();
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 3);
as->process(inData, "mech1");
as->cancel();
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 4);
}
void TestAuthSession::cancel_with_delay()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
g_currentSession = as;
QSignalSpy spyResponse(as, SIGNAL(response(const SignOn::SessionData&)));
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
QTimer::singleShot(0.1*1000, this, SLOT(cancel()));
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 1);
as->process(inData, "mech1");
QTimer::singleShot(0.1*1000, this, SLOT(cancel()));
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 2);
as->process(inData, "mech1");
QTimer::singleShot(0.1*1000, this, SLOT(cancel()));
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 3);
as->process(inData, "mech1");
QTimer::singleShot(0.1*1000, this, SLOT(cancel()));
loop.exec();
QCOMPARE(spyResponse.count(), 0);
QCOMPARE(spyError.count(), 4);
}
void TestAuthSession::cancel_without_process()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
g_currentSession = as;
QSignalSpy spyError(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()), Qt::QueuedConnection);
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
QTimer::singleShot(1*1000, &loop, SLOT(quit()));
as->cancel();
loop.exec();
QCOMPARE(spyError.count(), 0);
QTimer::singleShot(1*1000, &loop, SLOT(quit()));
QTimer::singleShot(0.1*1000, this, SLOT(cancel()));
loop.exec();
QCOMPARE(spyError.count(), 0);
QTimer::singleShot(0.1*1000, this, SLOT(cancel()));
QTimer::singleShot(1*1000, &loop, SLOT(quit()));
loop.exec();
QCOMPARE(spyError.count(), 0);
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
as->cancel();
as->cancel();
as->cancel();
loop.exec();
QCOMPARE(spyError.count(), 1);
}
void TestAuthSession::handle_destroyed_signal()
{
QSKIP("testing in sb", SkipSingle);
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest");
g_currentSession = as;
QSignalSpy spy(as, SIGNAL(mechanismsAvailable(const QStringList&)));
QSignalSpy errorCounter(as, SIGNAL(error(const SignOn::Error &)));
QEventLoop loop;
QObject::connect(as, SIGNAL(mechanismsAvailable(const QStringList&)),
&loop, SLOT(quit()));
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()));
/*
* 5 minutes + 10 seconds
* */
QTimer::singleShot(5 * 62 *1000, &loop, SLOT(quit()));
loop.exec();
QTimer::singleShot(5 * 1000, &loop, SLOT(quit()));
loop.exec();
QStringList wantedMechs;
as->queryAvailableMechanisms(wantedMechs);
if (!errorCounter.count())
loop.exec();
QCOMPARE(spy.count(), 1);
QStringList result = spy.at(0).at(0).toStringList();
QCOMPARE(result.size(), 4);
}
void TestAuthSession::multi_thread_test()
{
//execute a SignOn call in a separate thread
TestThread thread;
thread.start();
thread.wait(g_testThreadTimeout + 1000);
//do the same in this thread - this test succeeds if the
//following succeeds
process_with_new_identity();
}
void TestAuthSession::cancel()
{
g_currentSession->cancel();
}
void TestAuthSession::response(const SignOn::SessionData &data)
{
g_processReplyRealmsList << data.Realm();
g_bigStringReplySize = data.Caption().size();
}
void TestAuthSession::processUi_with_existing_identity()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest2");
QSignalSpy errorCounter(as, SIGNAL(error(const SignOn::Error &)));
QSignalSpy stateCounter(as,
SIGNAL(stateChanged(AuthSession::AuthSessionState, const QString&)));
QSignalSpy spy(as, SIGNAL(response(const SignOn::SessionData&)));
QEventLoop loop;
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)),
&loop, SLOT(quit()));
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()));
QTimer::singleShot(500*1000, &loop, SLOT(quit()));
/*
* chain of UiSessionData
* */
QStringList chainOfStates;
SsoTest2PluginNS::SsoTest2Data testData;
chainOfStates << "Browser" <<"Login" << "Captcha" << "LoginAndCaptcha";
chainOfStates << "Browser" <<"Login" << "Captcha" << "LoginAndCaptcha";
chainOfStates << "Browser" <<"Login" << "Captcha" << "LoginAndCaptcha";
chainOfStates << "Browser" <<"Login" << "Captcha" << "LoginAndCaptcha";
testData.setChainOfStates(chainOfStates);
testData.setCurrentState(0);
as->process(testData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(spy.count(), 1);
if (errorCounter.count())
qDebug() << errorCounter.at(0).at(1).toString();
QCOMPARE(errorCounter.count(), 0);
SignOn::SessionData outData =
spy.at(0).at(0).value();
SsoTest2PluginNS::SsoTest2Data resultData =
outData.data();
foreach(QString result, resultData.ChainOfResults())
QCOMPARE(result, QString("OK"));
}
void TestAuthSession::processUi_and_cancel()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest2");
g_currentSession = as;
m_signOnUI->setDelay(4);
QSignalSpy errorCounter(as, SIGNAL(error(const SignOn::Error &)));
QSignalSpy stateCounter(as,
SIGNAL(stateChanged(AuthSession::AuthSessionState, const QString&)));
QSignalSpy spy(as, SIGNAL(response(const SignOn::SessionData&)));
QEventLoop loop;
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)),
&loop, SLOT(quit()));
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()));
QTimer::singleShot(500*1000, &loop, SLOT(quit()));
/*
* chain of UiSessionData
* */
QStringList chainOfStates;
SsoTest2PluginNS::SsoTest2Data testData;
chainOfStates << "Browser" <<"Login" << "Captcha" << "LoginAndCaptcha";
chainOfStates << "Browser" <<"Login" << "Captcha" << "LoginAndCaptcha";
chainOfStates << "Browser" <<"Login" << "Captcha" << "LoginAndCaptcha";
chainOfStates << "Browser" <<"Login" << "Captcha" << "LoginAndCaptcha";
testData.setChainOfStates(chainOfStates);
testData.setCurrentState(0);
as->process(testData, "mech1");
QTimer::singleShot(3*1000, this, SLOT(cancel()));
if (!errorCounter.count())
loop.exec();
QCOMPARE(spy.count(), 0);
QCOMPARE(errorCounter.count(), 1);
m_signOnUI->setDelay(0);
}
void TestAuthSession::windowId()
{
AuthSession *as;
SSO_TEST_CREATE_AUTH_SESSION(as, "ssotest2");
QSignalSpy errorCounter(as, SIGNAL(error(const SignOn::Error &)));
QSignalSpy spy(as, SIGNAL(response(const SignOn::SessionData&)));
QEventLoop loop;
QObject::connect(as, SIGNAL(response(const SignOn::SessionData&)),
&loop, SLOT(quit()));
QObject::connect(as, SIGNAL(error(const SignOn::Error &)),
&loop, SLOT(quit()));
QTimer::singleShot(500*1000, &loop, SLOT(quit()));
/*
* chain of UiSessionData
* */
QStringList chainOfStates;
SsoTest2PluginNS::SsoTest2Data testData;
chainOfStates << "Browser" << "Browser";
testData.setChainOfStates(chainOfStates);
testData.setCurrentState(0);
testData.setWindowId(0xdeadbeef);
as->process(testData, "mech1");
if (!errorCounter.count())
loop.exec();
QCOMPARE(spy.count(), 1);
QCOMPARE(errorCounter.count(), 0);
QCOMPARE(m_signOnUI->clientData().value("WindowId").toUInt(),
0xdeadbeef);
QCOMPARE(m_signOnUI->method(), QLatin1String("ssotest2"));
QCOMPARE(m_signOnUI->mechanism(), QLatin1String("mech1"));
}
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testauthserviceresult.cpp 0000644 0000152 0177776 00000005106 12306320366 027446 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "testauthserviceresult.h"
#include
#define SIGNOND_TEST_REPLY_RECEIVED qDebug() << "Reply from SIGNON DAEMON---------------------------------" << __FUNCTION__;
TestAuthServiceResult::TestAuthServiceResult()
{
reset();
}
void TestAuthServiceResult::reset()
{
m_responseReceived = InexistentResp;
m_error = Error::Unknown;
m_errMsg = QString();
m_identities.clear();
m_methods.clear();
m_mechanisms.first = QString();
m_mechanisms.second.clear();
m_cleared = false;
}
void TestAuthServiceResult::error(const SignOn::Error &error)
{
SIGNOND_TEST_REPLY_RECEIVED
m_responseReceived = ErrorResp;
m_error = (Error::ErrorType)error.type();
m_errMsg = error.message();
qDebug() << "Error:" << m_error << ", Message:" << m_errMsg;
emit testCompleted();
}
void TestAuthServiceResult::methodsAvailable(const QStringList &methods)
{
SIGNOND_TEST_REPLY_RECEIVED
m_responseReceived = NormalResp;
m_methods = methods;
emit testCompleted();
}
void TestAuthServiceResult::mechanismsAvailable(const QString &method,
const QStringList &mechanisms)
{
SIGNOND_TEST_REPLY_RECEIVED
m_responseReceived = NormalResp;
m_mechanisms.first = method;
m_mechanisms.second = mechanisms;
m_queriedMechsMethod = method;
emit testCompleted();
}
void TestAuthServiceResult::identities(
const QList &identityList)
{
SIGNOND_TEST_REPLY_RECEIVED
m_responseReceived = NormalResp;
m_identities = identityList;
emit testCompleted();
}
void TestAuthServiceResult::cleared()
{
SIGNOND_TEST_REPLY_RECEIVED
m_responseReceived = NormalResp;
m_cleared = true;
emit testCompleted();
}
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testsinglesignon.cpp 0000644 0000152 0177776 00000010414 12306320366 026362 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include
#include
#include
#include
#include
#include
#include "testsinglesignon.h"
#include "ssotestclient.h"
#include "ssoclientthread.h"
#include
void TestSingleSignon::initTestCase()
{
m_numberOfTestClients = NUMBER_OF_TEST_CLIENTS;
}
void TestSingleSignon::cleanupTestCase()
{
}
void TestSingleSignon::singleTestClient()
{
QTime startTime = QTime::currentTime();
SsoTestClient client;
client.runAllTests();
QTime endTime = QTime::currentTime();
int elapsed = startTime.secsTo(endTime);
qDebug() << QString("TestSingleSignon::singleTestClient() "
"---- TIME --> Total elapsed time: %1 seconds.").
arg(elapsed);
}
void TestSingleSignon::multipleClientsAtOnceTest()
{
QList clientThreads;
QTime startTime = QTime::currentTime();
for(int i = 0; i < m_numberOfTestClients; i++)
{
qDebug() << "Creating SSO test client thread...";
SsoClientThread *thread = new SsoClientThread(SsoTestClient::AllTests);
thread->start();
clientThreads.append(thread);
}
SsoClientThread *thread = NULL;
bool done = false;
//this assumes all client threads will be finished at a certain point
while(!done)
{
int finishedThreadsCount = 0;
foreach(thread, clientThreads)
if(thread->isFinished()) ++finishedThreadsCount;
done = ((finishedThreadsCount == m_numberOfTestClients) ? true : false);
sleep(1);
}
while(!clientThreads.empty())
if(SsoClientThread *thread = clientThreads.takeFirst()) delete thread;
QTime endTime = QTime::currentTime();
int elapsed = startTime.secsTo(endTime);
qDebug() << QString("TestSingleSignon::multipleClientsAtOnceTest() "
"---- TIME --> Total elapsed time: %1 seconds.").
arg(elapsed);
}
void TestSingleSignon::multipleClientsAtOnceContiousTest()
{
QTime startTime = QTime::currentTime();
int rounds = 5;
while(rounds > 0)
{
QList clientThreads;
for (int i = 0; i < m_numberOfTestClients; i++)
{
qDebug() << "\n\nCreating SSO test client thread...";
SsoClientThread *thread =
new SsoClientThread(SsoTestClient::AllTests);
thread->start();
clientThreads.append(thread);
}
SsoClientThread *thread = NULL;
bool done = false;
//this assumes all client threads will be finished at a certain point
while (!done)
{
int finishedThreadsCount = 0;
foreach(thread, clientThreads)
if (thread->isFinished()) ++finishedThreadsCount;
done = ((finishedThreadsCount == m_numberOfTestClients) ?
true : false);
sleep(1);
}
while (!clientThreads.empty())
if (SsoClientThread *thread = clientThreads.takeFirst())
delete thread;
--rounds;
}
QTime endTime = QTime::currentTime();
int elapsed = startTime.secsTo(endTime);
qDebug() << QString("TestSingleSignon::multipleClientsAtOnceContiousTest() "
"---- TIME --> Total elapsed time: %1 seconds.").
arg(elapsed);
}
void TestSingleSignon::stressTest()
{
//think of something awful here
}
#ifndef SSO_CI_TESTMANAGEMENT
QTEST_MAIN(TestSingleSignon)
#endif
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/signon-ui.cpp 0000644 0000152 0177776 00000006013 12306320366 024673 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2012 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "signon-ui.h"
#include "SignOn/uisessiondata.h"
#include "SignOn/uisessiondata_priv.h"
#include
#include
#include
static const char serviceName[] = "com.nokia.singlesignonui";
static const char objectPath[] = "/SignonUi";
SignOnUI::SignOnUI(QDBusConnection connection, QObject *parent):
QObject(parent),
QDBusContext(),
m_connection(connection),
m_replyPassword("SSOUI default password"),
m_delay(0)
{
connection.registerObject(QLatin1String(objectPath), this,
QDBusConnection::ExportAllContents);
connection.registerService(QLatin1String(serviceName));
}
SignOnUI::~SignOnUI()
{
m_connection.unregisterService(QLatin1String(serviceName));
m_connection.unregisterObject(QLatin1String(objectPath));
}
QVariantMap SignOnUI::clientData() const
{
if (!m_parameters.contains(SSOUI_KEY_CLIENT_DATA)) {
return QVariantMap();
}
QVariant variant = m_parameters[SSOUI_KEY_CLIENT_DATA];
return (variant.type() == QVariant::Map) ?
variant.toMap() :
qdbus_cast(variant.value());
}
QString SignOnUI::method() const
{
return m_parameters.value(SSOUI_KEY_METHOD).toString();
}
QString SignOnUI::mechanism() const
{
return m_parameters.value(SSOUI_KEY_MECHANISM).toString();
}
void SignOnUI::cancelUiRequest(const QString &requestId)
{
qDebug() << Q_FUNC_INFO << requestId;
}
QVariantMap SignOnUI::queryDialog(const QVariantMap ¶meters)
{
qDebug() << Q_FUNC_INFO << parameters;
m_parameters = parameters;
QVariantMap result = parameters;
if (parameters.value(SSOUI_KEY_QUERYPASSWORD, false).toBool()) {
result.remove(SSOUI_KEY_QUERYPASSWORD);
result.insert(SSOUI_KEY_PASSWORD, m_replyPassword);
}
result.insert(SSOUI_KEY_ERROR, SignOn::QUERY_ERROR_NONE);
m_reply = message().createReply(result);
setDelayedReply(true);
QTimer::singleShot(m_delay, this, SLOT(processQueryDialog()));
return QVariantMap();
}
QVariantMap SignOnUI::refreshDialog(const QVariantMap ¶meters)
{
qDebug() << Q_FUNC_INFO << parameters;
return parameters;
}
void SignOnUI::processQueryDialog()
{
m_connection.send(m_reply);
}
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/libsignon-qt-tests.pro 0000644 0000152 0177776 00000002061 12306320366 026546 0 ustar pbuser nogroup 0000000 0000000 include( ../tests.pri )
TARGET = libsignon-qt-tests
CONFIG += \
build_all \
link_pkgconfig
QT += \
core \
dbus \
testlib
QT -= gui
greaterThan(QT_MAJOR_VERSION, 4) {
LIBS *= -lsignon-qt5
} else {
LIBS *= -lsignon-qt
}
QMAKE_RPATHDIR = $${QMAKE_LIBDIR}
SOURCES += \
testauthsession.cpp \
testthread.cpp \
signon-ui.cpp \
ssotestclient.cpp \
testauthserviceresult.cpp \
testidentityresult.cpp
HEADERS += \
testauthsession.h \
testthread.h \
signon-ui.h \
ssotestclient.h \
testauthserviceresult.h \
testidentityresult.h \
$$TOP_SRC_DIR/src/plugins/test/ssotest2data.h
INCLUDEPATH += . \
$$TOP_SRC_DIR/lib/plugins \
$$TOP_SRC_DIR/src/plugins/test
DEFINES += SSO_CI_TESTMANAGEMENT
DEFINES += "SIGNOND_PLUGINS_DIR=$${SIGNOND_PLUGINS_DIR_QUOTED}"
QMAKE_CXXFLAGS += -fno-exceptions \
-fno-rtti
check.depends = $$TARGET
check.commands = "SSO_PLUGINS_DIR=$${TOP_BUILD_DIR}/src/plugins/test SSO_EXTENSIONS_DIR=$${TOP_BUILD_DIR}/non-existing-dir $$RUN_WITH_SIGNOND ./libsignon-qt-tests"
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/ssotestclient.cpp 0000644 0000152 0177776 00000157611 12306320366 025701 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "SignOn/uisessiondata.h"
#include "SignOn/uisessiondata_priv.h"
#include "signon-ui.h"
#include "ssotestclient.h"
#include
#include
#include
#include
#include
using namespace SignOn;
int startedClients = 0;
int finishedClients = 0;
/*
* test timeout 10 seconds
* */
#define test_timeout 10000
#define pause_time 0
#define TEST_START qDebug("\n\n\n\n ----------------- %s ----------------\n\n", __func__);
#define TEST_DONE qDebug("\n\n ----------------- %s PASS ----------------\n\n", __func__);
// ACL Tokens for the queryAuthPluginACL test
#define ACL_TOKEN_0 "token_0"
#define ACL_TOKEN_1 "token_1"
#define ACL_TOKEN_2 "libsignon-qt-tests::sso-encryption-token"
#define ACL_TOKEN_3 "token_3"
#define ACL_TOKEN_4 "token_4"
#define ACL_TOKEN_5 "AID::com.nokia.maemo.libsignon-qt-tests.libsignon-qt-tests-id"
SsoTestClient::SsoTestClient(SignOnUI *signOnUI, QObject *parent):
QObject(parent),
m_signOnUI(signOnUI)
{
}
void SsoTestClient::initTestCase()
{
clearDB();
initAuthServiceTest();
}
void SsoTestClient::cleanupTestCase()
{
clearDB();
}
QString SsoTestClient::errCodeAsStr(const Error::ErrorType err)
{
switch(err) {
case Error::Unknown: return "Unknown";
case Error::InternalServer: return "InternalServer";
case Error::InternalCommunication: return "InternalCommunication";
case Error::PermissionDenied: return "PermissionDenied";
case Error::MethodNotKnown: return "MethodNotKnown";
case Error::ServiceNotAvailable: return "ServiceNotAvailable";
case Error::InvalidQuery: return "InvalidQuery";
case Error::MethodNotAvailable: return "MethodNotAvailable";
case Error::IdentityNotFound: return "IdentityNotFound";
case Error::StoreFailed: return "StoreFailed";
case Error::RemoveFailed: return "RemoveFailed";
case Error::SignOutFailed: return "SignOutFailed";
case Error::IdentityOperationCanceled: return "IdentityOperationCanceled";
case Error::CredentialsNotAvailable: return "CredentialsNotAvailable";
case Error::AuthSessionErr: return "AuthSessionErr";
case Error::MechanismNotAvailable: return "MechanismNotAvailable";
case Error::MissingData: return "MissingData";
case Error::InvalidCredentials: return "InvalidCredentials";
case Error::WrongState: return "WrongState";
case Error::OperationNotSupported: return "OperationNotSupported";
case Error::NoConnection: return "NoConnection";
case Error::Network: return "Network";
case Error::Ssl: return "Ssl";
case Error::Runtime: return "Runtime";
case Error::SessionCanceled: return "SessionCanceled";
case Error::TimedOut: return "TimedOut";
case Error::UserInteraction: return "UserInteraction";
case Error::OperationFailed: return "OperationFailed";
default: return "DEFAULT error type reached.";
}
}
bool SsoTestClient::storeCredentialsPrivate(const SignOn::IdentityInfo &info)
{
Identity *identity = Identity::newIdentity(info, this);
QEventLoop loop;
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(identity, SIGNAL(credentialsStored(const quint32)),
&m_identityResult, SLOT(credentialsStored(const quint32)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->storeCredentials();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
bool ok = false;
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
m_storedIdentityInfo = info;
m_storedIdentityId = identity->id();
ok = true;
} else {
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << errCodeAsStr(m_identityResult.m_error);
ok = false;
}
delete identity;
return ok;
}
QString SsoTestClient::pluginsDir() const
{
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
if (env.contains(QLatin1String("SSO_PLUGINS_DIR"))) {
return env.value(QLatin1String("SSO_PLUGINS_DIR"));
} else {
return QLatin1String(SIGNOND_PLUGINS_DIR);
}
}
void SsoTestClient::queryAvailableMetods()
{
TEST_START
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for querying available methods.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId, this);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
m_identityResult.reset();
QEventLoop loop;
connect(identity, SIGNAL(methodsAvailable(const QStringList &)),
&m_identityResult, SLOT(methodsAvailable(const QStringList &)));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->queryAvailableMethods();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived !=
TestIdentityResult::InexistentResp,
"A response was not received.");
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
qDebug() << "Remote:" << m_identityResult.m_methods;
qDebug() << "Local:" << m_storedIdentityInfo.methods();
QVERIFY(m_identityResult.m_methods == m_storedIdentityInfo.methods());
} else {
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << errCodeAsStr(m_identityResult.m_error);
QVERIFY(false);
}
TEST_DONE
}
void SsoTestClient::requestCredentialsUpdate()
{
TEST_START
m_signOnUI->setPassword("Hello there, this is my password");
Identity *identity = Identity::existingIdentity(m_storedIdentityId, this);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
m_identityResult.reset();
QEventLoop loop;
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(identity, SIGNAL(credentialsStored(const quint32)),
&m_identityResult, SLOT(credentialsStored(const quint32)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->requestCredentialsUpdate();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived !=
TestIdentityResult::InexistentResp,
"A response was not received.");
qDebug() << m_signOnUI->parameters();
QVERIFY(m_identityResult.m_responseReceived ==
TestIdentityResult::NormalResp);
/* Verify that the password is the one set by signon UI */
connect(identity, SIGNAL(secretVerified(const bool)),
&m_identityResult, SLOT(secretVerified(const bool)));
identity->verifySecret(m_signOnUI->password());
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QCOMPARE(m_identityResult.m_responseReceived,
TestIdentityResult::NormalResp);
QVERIFY(m_identityResult.m_secretVerified);
TEST_DONE
}
void SsoTestClient::storeCredentials()
{
TEST_START
if (!testAddingNewCredentials()) {
QFAIL("Adding new credentials test failed.");
}
if (!testUpdatingCredentials()) {
QFAIL("Updating existing credentials test failed.");
}
TEST_DONE
}
void SsoTestClient::remove()
{
QSKIP("Skipping until secure storage gets stabilized.", SkipSingle);
TEST_START
m_identityResult.reset();
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for removing identity.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId, this);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
QEventLoop loop;
connect(identity,
SIGNAL(removed()),
&m_identityResult,
SLOT(removed()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->remove();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived !=
TestIdentityResult::InexistentResp,
"A response was not received.");
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
QVERIFY(m_identityResult.m_removed);
connect(
identity,
SIGNAL(info(const SignOn::IdentityInfo &)),
&m_identityResult,
SLOT(info(const SignOn::IdentityInfo &)));
qDebug() << "Going to query info";
identity->queryInfo();
QVERIFY(m_identityResult.m_responseReceived ==
TestIdentityResult::ErrorResp);
QVERIFY(m_identityResult.m_error == Error::IdentityNotFound);
} else {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
TEST_DONE
}
void SsoTestClient::sessionTest()
{
TEST_START
Identity *id = Identity::newIdentity();
QLatin1String method1Str("mtd1");
AuthSessionP session1 = id->createSession(method1Str);
QVERIFY2(session1 != 0, "Could not create auth session.");
AuthSessionP session2 = id->createSession(method1Str);
QVERIFY2(session2 == 0, "Multiple auth. sessions with same method created.");
AuthSessionP session3 = id->createSession("method2");
QVERIFY2(session3 != 0, "Could not create auth session.");
id->destroySession(session1);
session2 = id->createSession(method1Str);
AuthSessionP session5 = NULL;
id->destroySession(session5);
delete id;
TEST_DONE
}
void SsoTestClient::removeStoreRemove()
{
QSKIP("Skipping until secure storage gets stabilized.", SkipSingle);
TEST_START
m_identityResult.reset();
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for removing identity.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId, this);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
QEventLoop loop;
connect(
identity,
SIGNAL(removed()),
&m_identityResult,
SLOT(removed()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
m_identityResult.reset();
identity->remove();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
QVERIFY(m_identityResult.m_removed);
m_identityResult.reset();
qDebug() << "Checking for removed identity ID : " << identity->id();;
connect(identity, SIGNAL(credentialsStored(const quint32)),
&m_identityResult, SLOT(credentialsStored(const quint32)));
QMap methods;
methods.insert("method4", QStringList() << "mech10" << "mech20");
methods.insert("method5", QStringList() << "mech10" << "mech20" << "mech30");
IdentityInfo updateInfo("TEST_CAPTION_10",
"TEST_USERNAME_10",
methods);
updateInfo.setSecret("TEST_PASSWORD_10");
updateInfo.setAccessControlList(QStringList() << "*");
m_identityResult.m_responseReceived = TestIdentityResult::InexistentResp;
identity->storeCredentials(updateInfo);
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
if (m_identityResult.m_responseReceived ==
TestIdentityResult::NormalResp) {
m_storedIdentityInfo = info;
m_storedIdentityId = identity->id();
qDebug() << "Identity ID = " << m_storedIdentityId;
} else {
qDebug() << "Error reply: " << m_identityResult.m_errMsg << "."
"\nError code: " << errCodeAsStr(m_identityResult.m_error);
QFAIL("Failed to store the credentials");
}
connect(
identity,
SIGNAL(info(const SignOn::IdentityInfo &)),
&m_identityResult,
SLOT(info(const SignOn::IdentityInfo &)));
qDebug() << "Checking if the identity info is updated in identity";
m_identityResult.reset();
identity->queryInfo();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY(m_identityResult.m_responseReceived == TestIdentityResult::NormalResp);
if (!TestIdentityResult::compareIdentityInfos(m_identityResult.m_idInfo,
updateInfo)) {
QFAIL("Compared identity infos are not the same.");
}
qDebug() << "Removing after store";
m_identityResult.reset();
identity->remove();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
QVERIFY(m_identityResult.m_removed);
qDebug() << "Removing again";
m_identityResult.reset();
identity->remove();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY(m_identityResult.m_responseReceived == TestIdentityResult::ErrorResp);
QVERIFY(m_identityResult.m_error == Error::IdentityNotFound);
} else {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
delete identity;
TEST_DONE
}
void SsoTestClient::multipleRemove()
{
QSKIP("Skipping until secure storage gets stabilized.", SkipSingle);
TEST_START
m_identityResult.reset();
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for removing identity.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId, this);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
QEventLoop loop;
connect(
identity,
SIGNAL(removed()),
&m_identityResult,
SLOT(removed()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->remove();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
QVERIFY(m_identityResult.m_removed);
qDebug() << "Removing again";
m_identityResult.reset();
identity->remove();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY(m_identityResult.m_responseReceived == TestIdentityResult::ErrorResp);
QVERIFY(m_identityResult.m_error == Error::IdentityNotFound);
} else {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
delete identity;
TEST_DONE
}
void SsoTestClient::storeCredentialsWithoutAuthMethodsTest()
{
TEST_START
if (!testAddingNewCredentials(false)) {
QFAIL("Adding new credentials test failed.");
}
if (!testUpdatingCredentials()) {
QFAIL("Updating existing credentials test failed.");
}
TEST_DONE
}
void SsoTestClient::queryInfo()
{
TEST_START
m_identityResult.reset();
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setRealms(QStringList() << "test_realm");
QStringList acl;
acl << "*";
info.setAccessControlList(acl);
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for querying info.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
QEventLoop loop;
connect(
identity,
SIGNAL(info(const SignOn::IdentityInfo &)),
&m_identityResult,
SLOT(info(const SignOn::IdentityInfo &)));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->queryInfo();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived !=
TestIdentityResult::InexistentResp,
"A response was not received.");
QCOMPARE(m_identityResult.m_idInfo.isStoringSecret(), true);
QCOMPARE(m_identityResult.m_idInfo.accessControlList(), acl);
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
QVERIFY(m_identityResult.m_id == m_storedIdentityId);
QVERIFY(TestIdentityResult::compareIdentityInfos(
m_storedIdentityInfo,
m_identityResult.m_idInfo, false));
} else {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received an error reply.");
}
TEST_DONE
}
void SsoTestClient::addReference()
{
TEST_START
m_identityResult.reset();
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setRealms(QStringList() << "test_realm");
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for querying info.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
m_identityResult.m_removed = false;
QEventLoop loop;
connect(
identity,
SIGNAL(referenceAdded()),
&m_identityResult,
SLOT(referenceAdded()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->addReference(QLatin1String("testref"));
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived !=
TestIdentityResult::InexistentResp,
"A response was not received.");
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
QVERIFY(m_identityResult.m_removed);
} else {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received an error reply.");
}
TEST_DONE
}
void SsoTestClient::removeReference()
{
m_identityResult.reset();
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setRealms(QStringList() << "test_realm");
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for querying info.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
m_identityResult.m_removed = false;
QEventLoop loop;
identity->addReference(QLatin1String("testref"));
connect(
identity,
SIGNAL(referenceRemoved()),
&m_identityResult,
SLOT(referenceRemoved()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->removeReference(QLatin1String("testref"));
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
QVERIFY(m_identityResult.m_removed);
} else {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received an error reply.");
}
TEST_DONE
}
void SsoTestClient::verifyUser()
{
TEST_START
m_identityResult.reset();
const QString password(QLatin1String("A strong password"));
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret(password);
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for verifying user.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
QEventLoop loop;
connect(
identity,
SIGNAL(userVerified(const bool)),
&m_identityResult,
SLOT(userVerified(const bool)));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
m_signOnUI->setPassword(password);
identity->verifyUser("message");
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived !=
TestIdentityResult::InexistentResp,
"A response was not received.");
QVERIFY(m_identityResult.m_responseReceived ==
TestIdentityResult::NormalResp);
/* check that the parameters received by SignOnUI were correct */
QVariantMap uiParameters = m_signOnUI->parameters();
QCOMPARE(uiParameters.value(SSOUI_KEY_MESSAGE).toString(),
QLatin1String("message"));
QVERIFY(uiParameters.contains(SSOUI_KEY_QUERYPASSWORD));
/* check that the verification was successful */
QVERIFY(m_identityResult.m_userVerified);
TEST_DONE
}
void SsoTestClient::verifySecret()
{
TEST_START
m_identityResult.reset();
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for verifying secret.");
Identity *identity = Identity::existingIdentity(m_storedIdentityId);
if (identity == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
QEventLoop loop;
connect(
identity,
SIGNAL(secretVerified(const bool)),
&m_identityResult,
SLOT(secretVerified(const bool)));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->verifySecret("TEST_PASSWORD_1");
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp)
{
QVERIFY(m_identityResult.m_secretVerified);
}
else
{
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received an error reply.");
}
TEST_DONE
}
void SsoTestClient::signOut()
{
TEST_START
m_identityResult.reset();
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret("TEST_PASSWORD_1");
info.setAccessControlList(QStringList() << "*");
if (!storeCredentialsPrivate(info))
QFAIL("Failed to initialize test for signing out.");
//create the existing identities
Identity *identity = Identity::existingIdentity(m_storedIdentityId);
Identity *identity1 = Identity::existingIdentity(m_storedIdentityId);
Identity *identity2 = Identity::existingIdentity(m_storedIdentityId);
Identity *identity3 = Identity::existingIdentity(m_storedIdentityId);
if (identity == NULL || identity1 == NULL || identity2 == NULL || identity3 == NULL)
QFAIL("Could not create existing identity. '0' ID provided?");
connect(
identity,
SIGNAL(signedOut()),
&m_identityResult,
SLOT(signedOut()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
//connect the other 2 identities to designated identity test result objects
TestIdentityResult identityResult1;
TestIdentityResult identityResult2;
TestIdentityResult identityResult3;
connect(
identity1,
SIGNAL(signedOut()),
&identityResult1,
SLOT(signedOut()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(
identity2,
SIGNAL(signedOut()),
&identityResult2,
SLOT(signedOut()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(
identity3,
SIGNAL(signedOut()),
&identityResult3,
SLOT(signedOut()));
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
/* Interesting - NOT IN THE GOOD WAY !!!
- this wait has to be added so that the last identity gets to be registered
and so that the server can signal it to sign out, too, @TODO
*/
QTest::qWait(100);
identity->signOut();
//this test is likelly to take longer
QTest::qWait(2000);
QVERIFY2(m_identityResult.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
QVERIFY2(identityResult1.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
QVERIFY2(identityResult2.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
QVERIFY2(identityResult3.m_responseReceived != TestIdentityResult::InexistentResp,
"A response was not received.");
if ((m_identityResult.m_responseReceived == TestIdentityResult::NormalResp)
&& (identityResult1.m_responseReceived == TestIdentityResult::NormalResp)
&& (identityResult2.m_responseReceived == TestIdentityResult::NormalResp)
&& (identityResult3.m_responseReceived == TestIdentityResult::NormalResp))
{
// probably will do something here in the future
}
else
{
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
TEST_DONE
}
void SsoTestClient::clearDB()
{
AuthService *service = new AuthService(this);
QEventLoop loop;
connect(service, SIGNAL(cleared()), &m_serviceResult, SLOT(cleared()));
connect(service, SIGNAL(error(const SignOn::Error &)),
&m_serviceResult, SLOT(error(const SignOn::Error &)));
connect(&m_serviceResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
service->clear();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
}
void SsoTestClient::initAuthServiceTest()
{
//small params preparing
m_numberOfInsertedCredentials = 5;
m_expectedNumberOfMethods = (QDir(pluginsDir())).entryList(
QStringList() << "*.so", QDir::Files).count();
if (!m_expectedMechanisms.length())
m_expectedMechanisms << "mech1" << "mech2" << "mech3" << "BLOB";
m_methodToQueryMechanisms = "ssotest";
#ifdef SSO_TESTS_RUNNING_AS_UNTRUSTED
return;
#endif
/* clearing DB
* This may fail if the CAM is not ready; since the CAM state is not
* exposed in the client API, in case we get the InternalServer error
* (which is emitted in these cases) we wait some time and we retry.
*/
int retries = 0;
do {
clearDB();
if (m_serviceResult.m_responseReceived != TestAuthServiceResult::ErrorResp)
break;
if (m_serviceResult.m_error != Error::InternalServer)
break;
QTest::qSleep(2000);
retries++;
} while (retries < 5);
if (m_serviceResult.m_responseReceived != TestAuthServiceResult::NormalResp) {
/* DB clearing can fail - if the secrets DB is not available.
* Do not fail in general if the clearing of the DB reported an error;
* just print the debug output. */
QString codeStr = errCodeAsStr(m_serviceResult.m_error);
qDebug() << "Error reply: " << m_serviceResult.m_errMsg
<< ".\nError code: " << codeStr;
}
//inserting some credentials
for(int i = 0; i < m_numberOfInsertedCredentials; i++)
{
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info(QString("TEST_CAPTION_%1").arg(i),
QString("TEST_USERNAME_%1").arg(i),
methods);
info.setSecret(QString("TEST_PASSWORD_%1").arg(i));
Identity *identity = Identity::newIdentity(info);
QEventLoop loop;
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(identity, SIGNAL(credentialsStored(const quint32)),
&m_identityResult, SLOT(credentialsStored(const quint32)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->storeCredentials();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
if (m_identityResult.m_responseReceived != TestIdentityResult::NormalResp) {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Failed to prepare the AuthService test suite.");
}
delete identity;
}
}
void SsoTestClient::queryMethods()
{
TEST_START
m_serviceResult.reset();
AuthService service;
QEventLoop loop;
connect(
&service,
SIGNAL(methodsAvailable(const QStringList &)),
&m_serviceResult,
SLOT(methodsAvailable(const QStringList &)));
connect(&service, SIGNAL(error(const SignOn::Error &)),
&m_serviceResult, SLOT(error(const SignOn::Error &)));
connect(&m_serviceResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
service.queryMethods();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_serviceResult.m_responseReceived != TestAuthServiceResult::InexistentResp,
"A response was not received.");
if (m_serviceResult.m_responseReceived == TestAuthServiceResult::NormalResp)
{
//this should compare the actual lists not only their count
QCOMPARE(m_serviceResult.m_methods.count(), m_expectedNumberOfMethods);
}
else
{
QString codeStr = errCodeAsStr(m_serviceResult.m_error);
qDebug() << "Error reply: " << m_serviceResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
TEST_DONE
}
void SsoTestClient::queryMechanisms()
{
TEST_START
m_serviceResult.reset();
AuthService service;
QEventLoop loop;
connect(
&service,
SIGNAL(mechanismsAvailable(const QString &, const QStringList &)),
&m_serviceResult,
SLOT(mechanismsAvailable(const QString &, const QStringList &)));
connect(&service, SIGNAL(error(const SignOn::Error &)),
&m_serviceResult, SLOT(error(const SignOn::Error &)));
connect(&m_serviceResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
service.queryMechanisms(m_methodToQueryMechanisms);
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_serviceResult.m_responseReceived != TestAuthServiceResult::InexistentResp,
"A response was not received.");
if (m_serviceResult.m_responseReceived == TestAuthServiceResult::NormalResp)
{
qDebug() << m_serviceResult.m_queriedMechsMethod;
qDebug() << m_methodToQueryMechanisms;
qDebug() << m_serviceResult.m_mechanisms.second;
qDebug() << m_expectedMechanisms;
QCOMPARE(m_serviceResult.m_queriedMechsMethod, m_methodToQueryMechanisms);
bool equal = (m_serviceResult.m_mechanisms.second == m_expectedMechanisms);
QVERIFY(equal);
}
else
{
QString codeStr = errCodeAsStr(m_serviceResult.m_error);
qDebug() << "Error reply: " << m_serviceResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
TEST_DONE
}
void SsoTestClient::queryIdentities()
{
TEST_START
m_serviceResult.reset();
AuthService service;
QEventLoop loop;
connect(&service,
SIGNAL(identities(const QList &)),
&m_serviceResult,
SLOT(identities(const QList &)));
connect(&service, SIGNAL(error(const SignOn::Error &)),
&m_serviceResult, SLOT(error(const SignOn::Error &)));
connect(&m_serviceResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
service.queryIdentities();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_serviceResult.m_responseReceived != TestAuthServiceResult::InexistentResp,
"A response was not received.");
if (m_serviceResult.m_responseReceived == TestAuthServiceResult::NormalResp)
{
QListIterator it(m_serviceResult.m_identities);
while (it.hasNext())
{
IdentityInfo info = it.next();
qDebug() << "Identity record: "
<< "id:" << info.id()
<< " username: " << info.userName()
<< " caption: " << info.caption()
<< " methods:";
foreach(QString method, info.methods())
qDebug() << QPair(method, info.mechanisms(method));
}
QCOMPARE(m_serviceResult.m_identities.count(),
m_numberOfInsertedCredentials);
}
else
{
QString codeStr = errCodeAsStr(m_serviceResult.m_error);
qDebug() << "Error reply: " << m_serviceResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
TEST_DONE
}
void SsoTestClient::queryIdentitiesWithFilter()
{
QSKIP("Test requires the implementation of the filtering feature.",
SkipSingle);
TEST_START
m_serviceResult.reset();
int filteredIdentitiesCount = 2;
IdentityInfo info(QLatin1String("CAPTION"),
QLatin1String("TEST_FILTER_USERNAME"),
QMap());
QVERIFY(storeCredentialsPrivate(info));
info.setRealms(QStringList() << QLatin1String("www.realm-filter.com"));
QVERIFY(storeCredentialsPrivate(info));
AuthService service;
QEventLoop loop;
connect(&service,
SIGNAL(identities(const QList &)),
&m_serviceResult,
SLOT(identities(const QList &)));
connect(&service, SIGNAL(error(const SignOn::Error &)),
&m_serviceResult, SLOT(error(const SignOn::Error &)));
connect(&m_serviceResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
QString userPattern = QString::fromLatin1("TEST_FILTER");
QString realmPattern = QString::fromLatin1("*realm_filter*");
AuthService::IdentityRegExp userRegexp(userPattern);
AuthService::IdentityRegExp realmRegexp(realmPattern);
QVERIFY(userPattern == userRegexp.pattern());
QVERIFY(realmPattern == realmRegexp.pattern());
QString patternCopy = realmRegexp.pattern();
AuthService::IdentityFilter filter;
filter.insert(AuthService::Username, userRegexp);
filter.insert(AuthService::Realm, realmRegexp);
service.queryIdentities(filter);
service.queryIdentities();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_serviceResult.m_responseReceived != TestAuthServiceResult::InexistentResp,
"A response was not received.");
if (m_serviceResult.m_responseReceived == TestAuthServiceResult::NormalResp)
{
QListIterator it(m_serviceResult.m_identities);
while(it.hasNext())
{
IdentityInfo info = it.next();
qDebug() << "Identity record: "
<< "id:" << info.id()
<< " username: " << info.userName()
<< " caption: " << info.caption()
<< " methods:";
foreach (QString method, info.methods())
qDebug() << QPair(method, info.mechanisms(method));
}
QCOMPARE(m_serviceResult.m_identities.count(), filteredIdentitiesCount);
}
else
{
QString codeStr = errCodeAsStr(m_serviceResult.m_error);
qDebug() << "Error reply: " << m_serviceResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
TEST_DONE
}
void SsoTestClient::queryAuthPluginACL()
{
TEST_START
QEventLoop loop;
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
methods.insert("ssotest", QStringList() << "mech1");
IdentityInfo info("test_caption_1",
"test_username_1",
methods);
info.setSecret("test_password_1");
info.setAccessControlList(QStringList() << ACL_TOKEN_0 << ACL_TOKEN_1 << ACL_TOKEN_2
<< ACL_TOKEN_3 << ACL_TOKEN_4 << ACL_TOKEN_5);
Identity *id = Identity::newIdentity(info, this);
connect(id,
SIGNAL(credentialsStored(quint32)),
&m_identityResult,
SLOT(credentialsStored(quint32)));
connect(id,
SIGNAL(error(const SignOn::Error &)),
&m_identityResult,
SLOT(error(const SignOn::Error &)));
connect(&m_identityResult,
SIGNAL(testCompleted()),
&loop,
SLOT(quit()));
id->storeCredentials();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
if (m_identityResult.m_responseReceived != TestIdentityResult::NormalResp) {
qDebug() << "Error reply: " << m_identityResult.m_errMsg
<< ".\nError code: " << errCodeAsStr(m_identityResult.m_error);
QFAIL("Store identity failed.");
}
AuthSession *as = id->createSession(QLatin1String("ssotest"));
connect(as,
SIGNAL(response(const SignOn::SessionData &)),
this,
SLOT(response(const SignOn::SessionData &)));
QSignalSpy errorSpy(as, SIGNAL(error(const SignOn::Error &)));
QSignalSpy responseSpy(as, SIGNAL(response(const SignOn::SessionData &)));
QObject::connect(as,
SIGNAL(response(const SignOn::SessionData &)),
&loop,
SLOT(quit()), Qt::QueuedConnection);
QObject::connect(as, SIGNAL(error(const SignOn::Error &)), &loop, SLOT(quit()));
QTimer::singleShot(10*1000, &loop, SLOT(quit()));
SessionData inData;
inData.setSecret("testSecret");
inData.setUserName("testUsername");
as->process(inData, "mech1");
if (!errorSpy.count())
loop.exec();
QVERIFY(errorSpy.count() == 0);
QVERIFY(responseSpy.count() == 1);
QCOMPARE(m_tokenList.count(), 6);
QVERIFY(m_tokenList.contains(ACL_TOKEN_5));
TEST_DONE
}
void SsoTestClient::response(const SignOn::SessionData &data)
{
m_tokenList = data.getAccessControlTokens();
}
void SsoTestClient::clear()
{
QSKIP("Skipping until secure storage gets stabilized.", SkipSingle);
TEST_START
m_serviceResult.reset();
AuthService service;
QEventLoop loop;
connect(
&service,
SIGNAL(cleared()),
&m_serviceResult,
SLOT(cleared()));
connect(&service, SIGNAL(error(const SignOn::Error &)),
&m_serviceResult, SLOT(error(const SignOn::Error &)));
connect(&m_serviceResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
service.clear();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_serviceResult.m_responseReceived != TestAuthServiceResult::InexistentResp,
"A response was not received.");
if (m_serviceResult.m_responseReceived == TestAuthServiceResult::NormalResp) {
connect(
&service,
SIGNAL(identities(const QList &)),
&m_serviceResult,
SLOT(identities(const QList &)));
service.queryIdentities();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY(m_serviceResult.m_identities.count() == 0);
} else {
QString codeStr = errCodeAsStr(m_serviceResult.m_error);
qDebug() << "Error reply: " << m_serviceResult.m_errMsg
<< ".\nError code: " << codeStr;
QFAIL("Should not have received error reply");
}
TEST_DONE
}
bool SsoTestClient::testAddingNewCredentials(bool addMethods)
{
m_identityResult.reset();
QMap methods;
if (addMethods) {
methods.insert("dummy", QStringList() << "mech1" << "mech2" << "mech3");
methods.insert("dummy1", QStringList() << "mech11" << "mech12" << "mech13");
}
IdentityInfo info("TEST_CAPTION", "TEST_USERNAME", methods);
info.setSecret("TEST_SECRET");
info.setRealms(QStringList() << "TEST_REALM1" << "TEST_REALM2");
Identity *identity = Identity::newIdentity(info, this);
QEventLoop loop;
connect(identity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(identity, SIGNAL(credentialsStored(const quint32)),
&m_identityResult, SLOT(credentialsStored(const quint32)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
identity->storeCredentials();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
if (m_identityResult.m_responseReceived ==
TestIdentityResult::InexistentResp) {
qDebug() << "A response was not received.";
return false;
}
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
if (m_identityResult.m_id != identity->id()) {
qDebug() << "Queried identity id does not match with stored data.";
return false;
}
Identity *existingIdentity =
Identity::existingIdentity(m_identityResult.m_id, this);
if (existingIdentity == NULL) {
qDebug() << "Could not create existing identity. '0' ID provided?";
return false;
}
connect(existingIdentity, SIGNAL(info(const SignOn::IdentityInfo &)),
&m_identityResult, SLOT(info(const SignOn::IdentityInfo &)));
existingIdentity->queryInfo();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
delete existingIdentity;
if (!TestIdentityResult::compareIdentityInfos(m_identityResult.m_idInfo,
info)) {
qDebug() << "Compared identity infos are not the same.";
return false;
}
} else {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_serviceResult.m_errMsg
<< ".\nError code: " << codeStr;
return false;
}
return true;
}
bool SsoTestClient::testUpdatingCredentials(bool addMethods)
{
// Test update credentials functionality
Identity *existingIdentity = Identity::existingIdentity(m_identityResult.m_id, this);
if (existingIdentity == NULL) {
qDebug() << "Could not create existing identity. '0' ID provided?";
return false;
}
QMap methods;
if (addMethods) {
methods.insert("dummy1", QStringList() << "mech11" << "mech12" << "mech13");
methods.insert("dummy2", QStringList() << "mech1_updated" << "mech2" << "mech1_updated2");
methods.insert("dummy3", QStringList() << "mech1_updated" << "mech2" << "mech1_updated2");
}
IdentityInfo updateInfo("TEST_CAPTION", "TEST_USERNAME_UPDATED", methods);
updateInfo.setSecret("TEST_SECRET_YES", false);
do
{
QEventLoop loop;
connect(existingIdentity, SIGNAL(error(const SignOn::Error &)),
&m_identityResult, SLOT(error(const SignOn::Error &)));
connect(existingIdentity, SIGNAL(credentialsStored(const quint32)),
&m_identityResult, SLOT(credentialsStored(const quint32)));
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
existingIdentity->storeCredentials(updateInfo);
qDebug();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
} while(0);
qDebug();
if (m_identityResult.m_responseReceived ==
TestIdentityResult::InexistentResp) {
qDebug() << "A response was not received.";
return false;
}
if (m_identityResult.m_responseReceived == TestIdentityResult::NormalResp) {
QEventLoop loop;
connect(&m_identityResult, SIGNAL(testCompleted()), &loop, SLOT(quit()));
connect(existingIdentity, SIGNAL(info(const SignOn::IdentityInfo &)),
&m_identityResult, SLOT(info(const SignOn::IdentityInfo &)));
existingIdentity->queryInfo();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
qDebug() << "ID:" << existingIdentity->id();
if (!TestIdentityResult::compareIdentityInfos(m_identityResult.m_idInfo,
updateInfo)) {
qDebug() << "Compared identity infos are not the same.";
return false;
}
} else {
QString codeStr = errCodeAsStr(m_identityResult.m_error);
qDebug() << "Error reply: " << m_serviceResult.m_errMsg
<< ".\nError code: " << codeStr;
return false;
}
return true;
}
void SsoTestClient::emptyPasswordRegression()
{
TEST_START
m_identityResult.reset();
QString myPassword("My password");
//inserting some credentials
QMap methods;
methods.insert("method1", QStringList() << "mech1" << "mech2");
methods.insert("method2", QStringList() << "mech1" << "mech2" << "mech3");
IdentityInfo info("TEST_CAPTION_1",
"TEST_USERNAME_1",
methods);
info.setSecret(myPassword);
info.setRealms(QStringList() << "test_realm");
QStringList acl;
acl << "*";
info.setAccessControlList(acl);
Identity *identity = Identity::newIdentity(info);
QEventLoop loop;
const char *errorSignature = SIGNAL(error(const SignOn::Error &));
QSignalSpy errorSignal(identity, errorSignature);
connect(identity, errorSignature, &loop, SLOT(quit()));
const char *credentialsStoredSignature =
SIGNAL(credentialsStored(const quint32));
QSignalSpy credentialsStoredSignal(identity, credentialsStoredSignature);
connect(identity, credentialsStoredSignature, &loop, SLOT(quit()));
identity->storeCredentials();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QCOMPARE(errorSignal.count(), 0);
QCOMPARE(credentialsStoredSignal.count(), 1);
credentialsStoredSignal.clear();
/* Verify that the password is the one set by signon UI */
const char *secretVerifiedSignature = SIGNAL(secretVerified(const bool));
QSignalSpy secretVerifiedSignal(identity, secretVerifiedSignature);
connect(identity, secretVerifiedSignature, &loop, SLOT(quit()));
identity->verifySecret(myPassword);
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QCOMPARE(secretVerifiedSignal.count(), 1);
QCOMPARE(secretVerifiedSignal.at(0).at(0).toBool(), true);
secretVerifiedSignal.clear();
/* Now get the info, and re-store the identity */
const char *infoSignature = SIGNAL(info(const SignOn::IdentityInfo &));
connect(identity, infoSignature,
&m_identityResult, SLOT(info(const SignOn::IdentityInfo &)));
connect(identity, infoSignature, &loop, SLOT(quit()));
identity->queryInfo();
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QVERIFY2(m_identityResult.m_responseReceived !=
TestIdentityResult::InexistentResp,
"A response was not received.");
QCOMPARE(m_identityResult.m_idInfo.isStoringSecret(), true);
QCOMPARE(m_identityResult.m_idInfo.secret(), QString());
/* Write it back, and verify that the password doesn't change.
* Change the username to make sure that this is not a no-op. */
QString myUserName("Bob");
m_identityResult.m_idInfo.setUserName(myUserName);
identity->storeCredentials(m_identityResult.m_idInfo);
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
/* check that the store succeeded */
QCOMPARE(errorSignal.count(), 0);
QCOMPARE(credentialsStoredSignal.count(), 1);
credentialsStoredSignal.clear();
identity->verifySecret(myPassword);
QTimer::singleShot(test_timeout, &loop, SLOT(quit()));
loop.exec();
QCOMPARE(secretVerifiedSignal.count(), 1);
QCOMPARE(secretVerifiedSignal.at(0).at(0).toBool(), true);
delete identity;
TEST_DONE
}
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
SignOnUI signOnUI(QDBusConnection::sessionBus());
int ret;
SsoTestClient ssoTestClient(&signOnUI);
ret = QTest::qExec(&ssoTestClient, argc, argv);
if (ret != 0) return ret;
TestAuthSession testAuthSession(&signOnUI);
ret = QTest::qExec(&testAuthSession, argc, argv);
return ret;
}
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/signon-ui.h 0000644 0000152 0177776 00000004632 12306320366 024345 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2012 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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 SIGNON_UI_H
#define SIGNON_UI_H
#include "SignOn/signonerror.h"
#include
#include
#include
#include
#include
class SignOnUI: public QObject, protected QDBusContext
{
Q_OBJECT
Q_CLASSINFO("D-Bus Interface", "com.nokia.singlesignonui")
public:
SignOnUI(QDBusConnection connection, QObject *parent = 0);
~SignOnUI();
/*!
* Add an artificial delay to the queryDialog() replies.
*/
void setDelay(int seconds) { m_delay = seconds * 1000; }
/*!
* Get the parameters sent with the last request.
*/
QVariantMap parameters() const { return m_parameters; }
/*!
* Get the client data.
*/
QVariantMap clientData() const;
/*!
* Get the authentication method.
*/
QString method() const;
/*!
* Get the authentication mechanism.
*/
QString mechanism() const;
/*!
* Set the password which will be returned to the next query.
*/
void setPassword(const QString &password) { m_replyPassword = password; }
/*!
* Get the password used by SignOnUI.
*/
QString password() const { return m_replyPassword; }
public Q_SLOTS:
Q_NOREPLY void cancelUiRequest(const QString &requestId);
QVariantMap queryDialog(const QVariantMap ¶meters);
QVariantMap refreshDialog(const QVariantMap &newParameters);
private Q_SLOTS:
void processQueryDialog();
private:
QDBusMessage m_reply;
QDBusConnection m_connection;
QVariantMap m_parameters;
QString m_replyPassword;
int m_delay;
};
#endif // SIGNON_UI_H
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testidentityresult.h 0000644 0000152 0177776 00000004263 12306320366 026425 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 TESTSIDENTITYRESULT_H
#define TESTSIDENTITYRESULT_H
#include
#include "SignOn/authservice.h"
#include "SignOn/identity.h"
#include "SignOn/signonerror.h"
using namespace SignOn;
class TestIdentityResult: public QObject
{
Q_OBJECT
public :
enum ResponseType
{
NormalResp = 0,
ErrorResp,
InexistentResp
};
public:
Error::ErrorType m_error;
QString m_errMsg;
ResponseType m_responseReceived;
QStringList m_methods;
quint32 m_id;
IdentityInfo m_idInfo;
bool m_userVerified;
bool m_secretVerified;
bool m_signedOut;
bool m_removed;
public:
TestIdentityResult();
void reset();
static bool compareIdentityInfos(const IdentityInfo &info1,
const IdentityInfo &info2,
bool checkId = false,
bool checlACL = false);
public Q_SLOTS:
void error(const SignOn::Error &err);
void methodsAvailable(const QStringList &methods);
void credentialsStored(const quint32 id);
void info(const SignOn::IdentityInfo& info);
void userVerified(const bool valid);
void secretVerified(const bool valid);
void removed();
void signedOut();
void referenceAdded();
void referenceRemoved();
Q_SIGNALS:
void testCompleted();
};
#endif // TESTSIDENTITYRESULT_H
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testthread.cpp 0000644 0000152 0177776 00000003270 12306320366 025134 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Aurel Popirtac
* Contact: Alberto Mardegan
*
* 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
*/
#include "testthread.h"
#include "SignOn/authservice.h"
#include
#include
using namespace SignOn;
void TestThread::run()
{
/*
Just call any method on the SignOn API so that the session bus
connection is created in this thread, a different one from the
main thread.
*/
AuthService service;
QEventLoop loop;
connect(&service,
SIGNAL(methodsAvailable(const QStringList &)),
SIGNAL(testCompleted()));
connect(&service, SIGNAL(error(const SignOn::Error &)),
SIGNAL(testCompleted()));
connect(this, SIGNAL(testCompleted()), &loop, SLOT(quit()));
service.queryMethods();
QTimer::singleShot(g_testThreadTimeout, &loop, SLOT(quit()));
loop.exec();
}
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testauthserviceresult.h 0000644 0000152 0177776 00000003574 12306320366 027122 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 TESTAUTHSERVICERESULT_H
#define TESTAUTHSERVICERESULT_H
#include
#include "SignOn/authservice.h"
#include "SignOn/identity.h"
#include "SignOn/signonerror.h"
using namespace SignOn;
class TestAuthServiceResult: public QObject
{
Q_OBJECT
public :
enum ResponseType
{
NormalResp = 0,
ErrorResp,
InexistentResp
};
public:
Error::ErrorType m_error;
QString m_errMsg;
ResponseType m_responseReceived;
QList m_identities;
QStringList m_methods;
QPair m_mechanisms;
bool m_cleared;
QString m_queriedMechsMethod;
public:
TestAuthServiceResult();
void reset();
public Q_SLOTS:
void error(const SignOn::Error &err);
void methodsAvailable(const QStringList &methods);
void mechanismsAvailable(const QString &method,
const QStringList &mechanisms);
void identities(const QList &identityList);
void cleared();
Q_SIGNALS:
void testCompleted();
};
#endif // TESTAUTHSERVICERESULT_H
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/.gitignore 0000644 0000152 0177776 00000000045 12306320366 024246 0 ustar pbuser nogroup 0000000 0000000 SsoTestClient.log
libsignon-qt-tests
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/ssotestclient.h 0000644 0000152 0177776 00000005347 12306320366 025344 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 SSOTESTCLIENT_H
#define SSOTESTCLIENT_H
#include
#include "testauthsession.h"
#include "testidentityresult.h"
#include "testauthserviceresult.h"
#include "SignOn/signonerror.h"
class SignOnUI;
class SsoTestClient: public QObject
{
Q_OBJECT
public:
SsoTestClient(SignOnUI *signOnUi, QObject *parent = 0);
private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
/*
* AuthService tests
*/
void queryIdentities();
void queryMethods();
void queryMechanisms();
void clear();
/*
* Identity tests
*/
void queryAvailableMetods();
void storeCredentials();
void requestCredentialsUpdate();
void queryInfo();
void addReference();
void removeReference();
void verifyUser();
void verifySecret();
void signOut();
void remove();
void storeCredentialsWithoutAuthMethodsTest();
void sessionTest();
void multipleRemove();
void removeStoreRemove();
void queryAuthPluginACL();
void emptyPasswordRegression();
private:
void clearDB();
void initAuthServiceTest();
void queryIdentitiesWithFilter();
/*
* Subtests
* */
bool testUpdatingCredentials(bool addMethods = true);
bool testAddingNewCredentials(bool addMethods = true);
/*
* Helpers
* */
static QString errCodeAsStr(const Error::ErrorType);
bool storeCredentialsPrivate(const SignOn::IdentityInfo &info);
QString pluginsDir() const;
protected Q_SLOTS:
void response(const SignOn::SessionData &data);
private:
SignOnUI *m_signOnUI;
QStringList m_tokenList;
int m_expectedNumberOfMethods;
QStringList m_expectedMechanisms;
int m_numberOfInsertedCredentials;
quint32 m_storedIdentityId;
IdentityInfo m_storedIdentityInfo;
QString m_methodToQueryMechanisms;
TestIdentityResult m_identityResult;
TestAuthServiceResult m_serviceResult;
};
#endif // SSOTESTCLIENT_H
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testidentityresult.cpp 0000644 0000152 0177776 00000011434 12306320366 026756 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include
#include "testidentityresult.h"
#define IT_IS_HAPPENING qDebug() << "Reply from SIGNON DAEMON---------------------------------" << __FUNCTION__;
TestIdentityResult::TestIdentityResult()
{
reset();
}
void TestIdentityResult::reset()
{
m_responseReceived = InexistentResp;
m_error = Error::Unknown;
m_errMsg = QString();
m_methods.clear();
m_id = 0;
m_idInfo = IdentityInfo();
m_userVerified = false;
m_secretVerified = false;
m_signedOut = false;
m_removed = false;
}
bool TestIdentityResult::compareIdentityInfos(const IdentityInfo &info1,
const IdentityInfo &info2,
bool checkId,
bool checlACL)
{
qDebug() << QString("Comparing identities %1 & %2.").
arg(info1.id()).arg(info2.id());
if (checkId && (info1.id() != info2.id())) {
qDebug() << "IDs:" << info1.id() << " " << info2.id();
return false;
}
if (info1.caption() != info2.caption()) {
qDebug() << "Captions:" << info1.caption() << " " << info2.caption();
return false;
}
if (info1.methods() != info2.methods()) {
qDebug() << "Methods:" << info1.methods() << " " << info2.methods();
return false;
}
if (info1.realms() != info2.realms()) {
qDebug() << "Realms:" << info1.realms() << " " << info2.realms();
return false;
}
if (checlACL && (info1.accessControlList() != info2.accessControlList())) {
qDebug() << "ACLs:" << info1.accessControlList() << " " << info2.accessControlList();
return false;
}
if (info1.userName() != info2.userName()) {
qDebug() << "Usernames:" << info1.userName() << " " << info2.userName();
return false;
}
foreach (QString method, info1.methods()) {
MechanismsList mechs1 = info1.mechanisms(method);
MechanismsList mechs2 = info2.mechanisms(method);
mechs1.sort();
mechs2.sort();
if (mechs1 != mechs2) {
qDebug() << QString("Mechanisms for method %1:").arg(method)
<< info1.mechanisms(method) << " " << info2.mechanisms(method);
return false;
}
}
return true;
}
void TestIdentityResult::error(const SignOn::Error& error)
{
m_responseReceived = ErrorResp;
m_error = (Error::ErrorType)error.type();
m_errMsg = error.message();
qDebug() << "Error:" << m_error << ", Message:" << m_errMsg;
emit testCompleted();
}
void TestIdentityResult::methodsAvailable(const QStringList& methods)
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_methods = methods;
emit testCompleted();
}
void TestIdentityResult::credentialsStored(const quint32 id)
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_id = id;
emit testCompleted();
}
void TestIdentityResult::info(const IdentityInfo &info)
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_idInfo = info;
emit testCompleted();
}
void TestIdentityResult::userVerified(const bool valid)
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_userVerified = valid;
emit testCompleted();
}
void TestIdentityResult::secretVerified(const bool valid)
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_secretVerified = valid;
emit testCompleted();
}
void TestIdentityResult::removed()
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_removed = true;
emit testCompleted();
}
void TestIdentityResult::signedOut()
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_signedOut = true;
emit testCompleted();
}
void TestIdentityResult::referenceAdded()
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_removed = true;
emit testCompleted();
}
void TestIdentityResult::referenceRemoved()
{
IT_IS_HAPPENING
m_responseReceived = NormalResp;
m_removed = true;
emit testCompleted();
}
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testsinglesignon.h 0000644 0000152 0177776 00000002557 12306320366 026040 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 TESTSINGLESIGNON_H
#define TESTSINGLESIGNON_H
#include
class QProcess;
class TestSingleSignon: public QObject
{
Q_OBJECT
private Q_SLOTS:
/*
* Start the signon daemon
*/
void initTestCase();
/*
* End the signon daemon
*/
void cleanupTestCase();
/*
* Test cases
*/
void singleTestClient();
void multipleClientsAtOnceTest();
private:
void multipleClientsAtOnceContiousTest();
void stressTest();
private:
int m_numberOfTestClients;
};
#endif // TESTSINGLESIGNON_H
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testauthsession.h 0000644 0000152 0177776 00000007317 12306320366 025705 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Aurel Popirtac
* Contact: Alberto Mardegan
*
* 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 TESTAUTHSESSION_H_
#define TESTAUTHSESSION_H_
#include
#include
#include
#include
#include
#include "signond/signoncommon.h"
#include "SignOn/authservice.h"
#include "ssotest2data.h"
#include "SignOn/uisessiondata.h"
/*
* here we test the implementation because of difficulties of having
* access to protected/private functions
* */
#include "SignOn/authsessionimpl.h"
using namespace SignOn;
/*
* test timeout 10 seconds
* */
#define test_timeout 10000
class SignOnUI;
class TestAuthSession: public QObject
{
Q_OBJECT
public:
TestAuthSession(SignOnUI *signOnUi, QObject *parent = 0);
private Q_SLOTS:
/*
* Start the signon daemon
*/
void initTestCase();
/*
* End the signon daemon
*/
void cleanupTestCase();
/*
* UIless
* AuthSession API related test cases
*/
void sessionData();
void queryMechanisms_existing_method();
void queryMechanisms_nonexisting_method();
void process_with_new_identity();
void process_with_existing_identity();
void process_with_nonexisting_type();
void process_with_nonexisting_method();
void process_with_unauthorized_method();
void process_from_other_process();
void process_many_times_after_auth();
void process_many_times_before_auth();
void process_with_big_session_data();
void process_after_timeout();
void cancel_immediately();
void cancel_with_delay();
void cancel_without_process();
void handle_destroyed_signal();
void multi_thread_test();
void processUi_with_existing_identity();
void processUi_and_cancel();
void windowId();
private Q_SLOTS:
void cancel();
void response(const SignOn::SessionData &data);
private:
SignOnUI *m_signOnUI;
};
/*
* The SlotMachine class is used by process_from_other_process
* test to receive signals regarding the completion of D-Bus
* calls. The QSignalSpy classes cannot be used because the
* class for the D-Bus methods must have both response method
* and error method.
*/
class SlotMachine: public QObject
{
Q_OBJECT
public:
SlotMachine(): m_responseReceived(false) {}
public Q_SLOTS:
void authenticationSlot(const QString &path) {
m_path = path;
emit done();
}
void errorSlot(const QDBusError &err) {
m_errorMessage = err.message();
m_errorName = err.name();
emit done();
}
void responseSlot(const QVariantMap &response) {
m_response = response;
m_responseReceived = true;
emit done();
}
Q_SIGNALS:
void done();
public:
QString m_path;
QString m_errorMessage;
QString m_errorName;
QVariantMap m_response;
bool m_responseReceived;
};
#endif
signon-8.56+14.04.20140307/tests/libsignon-qt-tests/testthread.h 0000644 0000152 0177776 00000002147 12306320366 024603 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
*
* Contact: Aurel Popirtac
* Contact: Alberto Mardegan
*
* 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
*/
#include
const int g_testThreadTimeout = 10000;
class TestThread: public QThread
{
Q_OBJECT
public:
void run();
Q_SIGNALS:
void testCompleted();
};
signon-8.56+14.04.20140307/TODO 0000644 0000152 0177776 00000000001 12306320366 016026 0 ustar pbuser nogroup 0000000 0000000
signon-8.56+14.04.20140307/README 0000644 0000152 0177776 00000000001 12306320366 016216 0 ustar pbuser nogroup 0000000 0000000
signon-8.56+14.04.20140307/doc/ 0000755 0000152 0177776 00000000000 12306320634 016112 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/doc/doxy.conf 0000644 0000152 0177776 00000173315 12306320366 017760 0 ustar pbuser nogroup 0000000 0000000 # Doxyfile 1.5.8
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project
#
# All text after a hash (#) is considered a comment and will be ignored
# The format is:
# TAG = value [value, ...]
# For lists items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (" ")
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all
# text before the first occurrence of this tag. Doxygen uses libiconv (or the
# iconv built into libc) for the transcoding. See
# http://www.gnu.org/software/libiconv for the list of possible encodings.
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
# by quotes) that should identify the project.
PROJECT_NAME = $(PROJECT_NAME)
# The PROJECT_NUMBER tag can be used to enter a project or revision number.
# This could be handy for archiving the generated documentation or
# if some version control system is used.
PROJECT_NUMBER = $(PROJECT_NUMBER)
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
# If a relative path is entered, it will be relative to the location
# where doxygen was started. If left blank the current directory will be used.
OUTPUT_DIRECTORY = $(OUTPUT_DIRECTORY)
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
# 4096 sub-directories (in 2 levels) under the output directory of each output
# format and will distribute the generated files over these directories.
# Enabling this option can be useful when feeding doxygen a huge amount of
# source files, where putting all generated files in the same directory would
# otherwise cause performance problems for the file system.
CREATE_SUBDIRS = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# The default language is English, other supported languages are:
# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
# Croatian, Czech, Danish, Dutch, Farsi, Finnish, French, German, Greek,
# Hungarian, Italian, Japanese, Japanese-en (Japanese with English messages),
# Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, Polish,
# Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, Slovene,
# Spanish, Swedish, and Ukrainian.
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
# include brief member descriptions after the members that are listed in
# the file and class documentation (similar to JavaDoc).
# Set to NO to disable this.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
# the brief description of a member or function before the detailed description.
# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
REPEAT_BRIEF = YES
# This tag implements a quasi-intelligent brief description abbreviator
# that is used to form the text in various listings. Each string
# in this list, if found as the leading text of the brief description, will be
# stripped from the text and the result after processing the whole list, is
# used as the annotated text. Otherwise, the brief description is used as-is.
# If left blank, the following values are used ("$name" is automatically
# replaced with the name of the entity): "The $name class" "The $name widget"
# "The $name file" "is" "provides" "specifies" "contains"
# "represents" "a" "an" "the"
ABBREVIATE_BRIEF =
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# Doxygen will generate a detailed section even if there is only a brief
# description.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
# path before files name in the file list and in the header files. If set
# to NO the shortest path that makes the file name unique will be used.
FULL_PATH_NAMES = YES
# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
# can be used to strip a user-defined part of the path. Stripping is
# only done if one of the specified strings matches the left-hand part of
# the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the
# path to strip.
STRIP_FROM_PATH = $(STRIP_FROM_PATH)
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
# the path mentioned in the documentation of a class, which tells
# the reader which header file to include in order to use a class.
# If left blank only the name of the header file containing the class
# definition is used. Otherwise one should specify the include paths that
# are normally passed to the compiler using the -I flag.
STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
# (but less readable) file names. This can be useful is your file systems
# doesn't support long names like on DOS, Mac, or CD-ROM.
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
# will interpret the first line (until the first dot) of a JavaDoc-style
# comment as the brief description. If set to NO, the JavaDoc
# comments will behave just like regular Qt-style comments
# (thus requiring an explicit @brief command for a brief description.)
JAVADOC_AUTOBRIEF = NO
# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
# interpret the first line (until the first dot) of a Qt-style
# comment as the brief description. If set to NO, the comments
# will behave just like regular Qt-style comments (thus requiring
# an explicit \brief command for a brief description.)
QT_AUTOBRIEF = YES
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
# treat a multi-line C++ special comment block (i.e. a block of //! or ///
# comments) as a brief description. This used to be the default behaviour.
# The new default is to treat a multi-line C++ comment block as a detailed
# description. Set this tag to YES if you prefer the old behaviour instead.
MULTILINE_CPP_IS_BRIEF = NO
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
# member inherits the documentation from any documented member that it
# re-implements.
INHERIT_DOCS = YES
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
# a new page for each member. If set to NO, the documentation of a member will
# be part of the file/class/namespace that contains it.
SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab.
# Doxygen uses this value to replace tabs by spaces in code fragments.
TAB_SIZE = 4
# This tag can be used to specify a number of aliases that acts
# as commands in the documentation. An alias has the form "name=value".
# For example adding "sideeffect=\par Side Effects:\n" will allow you to
# put the command \sideeffect (or @sideeffect) in the documentation, which
# will result in a user-defined paragraph with heading "Side Effects:".
# You can put \n's in the value part of an alias to insert newlines.
ALIASES =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
# sources only. Doxygen will then generate output that is more tailored for C.
# For instance, some of the names that are used will be different. The list
# of all members will be omitted, etc.
OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
# sources only. Doxygen will then generate output that is more tailored for
# Java. For instance, namespaces will be presented as packages, qualified
# scopes will look different, etc.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# sources only. Doxygen will then generate output that is more tailored for
# Fortran.
OPTIMIZE_FOR_FORTRAN = NO
# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
# sources. Doxygen will then generate output that is tailored for
# VHDL.
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it parses.
# With this tag you can assign which parser to use for a given extension.
# Doxygen has a built-in mapping, but you can override or extend it using this tag.
# The format is ext=language, where ext is a file extension, and language is one of
# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP,
# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat
# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran),
# use: inc=Fortran f=C
EXTENSION_MAPPING =
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should
# set this tag to YES in order to let doxygen match functions declarations and
# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
# func(std::string) {}). This also make the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
BUILTIN_STL_SUPPORT = NO
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
# Doxygen will parse them like normal C++ but will assume all classes use public
# instead of private inheritance when no explicit protection keyword is present.
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate getter
# and setter methods for a property. Setting this option to YES (the default)
# will make doxygen to replace the get and set methods by a property in the
# documentation. This will only work if the methods are indeed getting or
# setting a simple type. If this is not the case, or you want to show the
# methods anyway, you should set this option to NO.
IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
DISTRIBUTE_GROUP_DOC = NO
# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
# the same type (for instance a group of public functions) to be put as a
# subgroup of that type (e.g. under the Public Functions section). Set it to
# NO to prevent subgrouping. Alternatively, this can be done per class using
# the \nosubgrouping command.
SUBGROUPING = YES
# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
# is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
# with name TypeT. When disabled the typedef will appear as a member of a file,
# namespace, or class. And the struct will be named TypeS. This can typically
# be useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
TYPEDEF_HIDES_STRUCT = NO
# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
# determine which symbols to keep in memory and which to flush to disk.
# When the cache is full, less often used symbols will be written to disk.
# For small to medium size projects (<1000 input files) the default value is
# probably good enough. For larger projects a too small cache size can cause
# doxygen to be busy swapping symbols to and from disk most of the time
# causing a significant performance penality.
# If the system has enough physical memory increasing the cache will improve the
# performance by keeping more symbols in memory. Note that the value works on
# a logarithmic scale so increasing the size by one will rougly double the
# memory usage. The cache size is given by this formula:
# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
# corresponding to a cache size of 2^16 = 65536 symbols
SYMBOL_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available.
# Private class members and static file members will be hidden unless
# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
# will be included in the documentation.
EXTRACT_PRIVATE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file
# will be included in the documentation.
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
# defined locally in source files will be included in the documentation.
# If set to NO only classes defined in header files are included.
EXTRACT_LOCAL_CLASSES = NO
# This flag is only useful for Objective-C code. When set to YES local
# methods, which are defined in the implementation section but not in
# the interface are included in the documentation.
# If set to NO (the default) only methods in the interface are included.
EXTRACT_LOCAL_METHODS = YES
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base
# name of the file that contains the anonymous namespace. By default
# anonymous namespace are hidden.
EXTRACT_ANON_NSPACES = YES
# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
# undocumented members of documented classes, files or namespaces.
# If set to NO (the default) these members will be included in the
# various overviews, but no documentation section is generated.
# This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy.
# If set to NO (the default) these classes will be included in the various
# overviews. This option has no effect if EXTRACT_ALL is enabled.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
# friend (class|struct|union) declarations.
# If set to NO (the default) these declarations will be included in the
# documentation.
HIDE_FRIEND_COMPOUNDS = NO
# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
# documentation blocks found inside the body of a function.
# If set to NO (the default) these blocks will be appended to the
# function's detailed documentation block.
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation
# that is typed after a \internal command is included. If the tag is set
# to NO (the default) then the documentation will be excluded.
# Set it to YES to include the internal documentation.
INTERNAL_DOCS = YES
# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
# file names in lower-case letters. If set to YES upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
CASE_SENSE_NAMES = YES
# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
# will show members with their full class and namespace scopes in the
# documentation. If set to YES the scope will be hidden.
HIDE_SCOPE_NAMES = NO
# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
# will put a list of the files that are included by a file in the documentation
# of that file.
SHOW_INCLUDE_FILES = YES
# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
# is inserted in the documentation for inline members.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
# will sort the (detailed) documentation of file and class members
# alphabetically by member name. If set to NO the members will appear in
# declaration order.
SORT_MEMBER_DOCS = YES
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
# brief documentation of file, namespace and class members alphabetically
# by member name. If set to NO (the default) the members will appear in
# declaration order.
SORT_BRIEF_DOCS = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
# hierarchy of group names into alphabetical order. If set to NO (the default)
# the group names will appear in their defined order.
SORT_GROUP_NAMES = NO
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
# sorted by fully-qualified names, including namespaces. If set to
# NO (the default), the class list will be sorted only by class name,
# not including the namespace part.
# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
# Note: This option applies only to the class list, not to the
# alphabetical list.
SORT_BY_SCOPE_NAME = NO
# The GENERATE_TODOLIST tag can be used to enable (YES) or
# disable (NO) the todo list. This list is created by putting \todo
# commands in the documentation.
GENERATE_TODOLIST = YES
# The GENERATE_TESTLIST tag can be used to enable (YES) or
# disable (NO) the test list. This list is created by putting \test
# commands in the documentation.
GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable (YES) or
# disable (NO) the bug list. This list is created by putting \bug
# commands in the documentation.
GENERATE_BUGLIST = YES
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
# disable (NO) the deprecated list. This list is created by putting
# \deprecated commands in the documentation.
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional
# documentation sections, marked by \if sectionname ... \endif.
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
# the initial value of a variable or define consists of for it to appear in
# the documentation. If the initializer consists of more lines than specified
# here it will be hidden. Use a value of 0 to hide initializers completely.
# The appearance of the initializer of individual variables and defines in the
# documentation can be controlled using \showinitializer or \hideinitializer
# command in the documentation regardless of this setting.
MAX_INITIALIZER_LINES = 30
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
# at the bottom of the documentation of classes and structs. If set to YES the
# list will mention the files that were used to generate the documentation.
SHOW_USED_FILES = YES
# If the sources in your project are distributed over multiple directories
# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
# in the documentation. The default is NO.
SHOW_DIRECTORIES = YES
# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
# This will remove the Files entry from the Quick Index and from the
# Folder Tree View (if specified). The default is YES.
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
# Namespaces page.
# This will remove the Namespaces entry from the Quick Index
# and from the Folder Tree View (if specified). The default is YES.
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
# the version control system). Doxygen will invoke the program by executing (via
# popen()) the command , where is the value of
# the FILE_VERSION_FILTER tag, and is the name of an input file
# provided by doxygen. Whatever the program writes to standard output
# is used as the file version. See the manual for examples.
FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by
# doxygen. The layout file controls the global structure of the generated output files
# in an output format independent way. The create the layout file that represents
# doxygen's defaults, run doxygen with the -l option. You can optionally specify a
# file name after the option, if omitted DoxygenLayout.xml will be used as the name
# of the layout file.
LAYOUT_FILE =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated
# by doxygen. Possible values are YES and NO. If left blank NO is used.
QUIET = NO
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated by doxygen. Possible values are YES and NO. If left blank
# NO is used.
WARNINGS = YES
# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
# automatically be disabled.
WARN_IF_UNDOCUMENTED = YES
# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some
# parameters in a documented function, or documenting parameters that
# don't exist or using markup commands wrongly.
WARN_IF_DOC_ERROR = YES
# This WARN_NO_PARAMDOC option can be abled to get warnings for
# functions that are documented, but have no documentation for their parameters
# or return value. If set to NO (the default) doxygen will only warn about
# wrong or incomplete parameter documentation, but not about the absence of
# documentation.
WARN_NO_PARAMDOC = NO
# The WARN_FORMAT tag determines the format of the warning messages that
# doxygen can produce. The string should contain the $file, $line, and $text
# tags, which will be replaced by the file and line number from which the
# warning originated and the warning text. Optionally the format may contain
# $version, which will be replaced by the version of the file (if it could
# be obtained via FILE_VERSION_FILTER)
WARN_FORMAT = "$file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning
# and error messages should be written. If left blank the output is written
# to stderr.
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT = $(INPUT)
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# also the default input encoding. Doxygen uses libiconv (or the iconv built
# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
# the list of possible encodings.
INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank the following patterns are tested:
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
FILE_PATTERNS = *.cpp \
*.h \
*.dox
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
# should be searched for input files as well. Possible values are YES and NO.
# If left blank NO is used.
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
EXCLUDE = debian \
builddir
# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
# directories that are symbolic links (a Unix filesystem feature) are excluded
# from the input.
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories. Note that the wildcards are matched
# against the file with absolute path, so to exclude all test directories
# for example use the pattern */test/*
EXCLUDE_PATTERNS = */.moc/* \
*/.obj/* \
*/.git/* \
*/tests/* \
*/moc_*
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
# and *.h) to filter out the source-files in the directories. If left
# blank all files are included.
EXAMPLE_PATTERNS =
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude
# commands irrespective of the value of the RECURSIVE tag.
# Possible values are YES and NO. If left blank NO is used.
EXAMPLE_RECURSIVE = NO
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
# the \image command).
IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command , where
# is the value of the INPUT_FILTER tag, and is the name of an
# input file. Doxygen will then use the output that the filter program writes
# to standard output.
# If FILTER_PATTERNS is specified, this tag will be
# ignored.
INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis.
# Doxygen will compare the file name with each pattern and apply the
# filter if there is a match.
# The filters are a list of the form:
# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
# is applied to all files.
FILTER_PATTERNS =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will be used to filter the input files when producing source
# files to browse (i.e. when SOURCE_BROWSER is set to YES).
FILTER_SOURCE_FILES = NO
#---------------------------------------------------------------------------
# configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will
# be generated. Documented entities will be cross-referenced with these sources.
# Note: To get rid of all source code in the generated output, make sure also
# VERBATIM_HEADERS is set to NO.
SOURCE_BROWSER = YES
# Setting the INLINE_SOURCES tag to YES will include the body
# of functions and classes directly in the documentation.
INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
# doxygen to hide any special comment blocks from generated source code
# fragments. Normal C and C++ comments will always remain visible.
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES
# then for each documented function all documented
# functions referencing it will be listed.
REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES
# then for each documented function all documented entities
# called/used by that function will be listed.
REFERENCES_RELATION = YES
# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
# link to the source code.
# Otherwise they will link to the documentation.
REFERENCES_LINK_SOURCE = YES
# If the USE_HTAGS tag is set to YES then the references to source code
# will point to the HTML generated by the htags(1) tool instead of doxygen
# built-in source browser. The htags tool is part of GNU's global source
# tagging system (see http://www.gnu.org/software/global/global.html). You
# will need version 4.8.6 or higher.
USE_HTAGS = NO
# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
# will generate a verbatim copy of the header file for each class for
# which an include is specified. Set to NO to disable this.
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
# of all compounds will be generated. Enable this if the project
# contains a lot of classes, structs, unions or interfaces.
ALPHABETICAL_INDEX = NO
# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
# in which this list will be split (can be a number in the range [1..20])
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all
# classes will be put under the same header in the alphabetical index.
# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
# should be ignored while generating the index headers.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
# generate HTML output.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `html' will be used as the default path.
HTML_OUTPUT = html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
# doxygen will generate files with .html extension.
HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a personal HTML header for
# each generated HTML page. If it is left blank doxygen will generate a
# standard header.
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a personal HTML footer for
# each generated HTML page. If it is left blank doxygen will generate a
# standard footer.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
# style sheet that is used by each HTML page. It can be used to
# fine-tune the look of the HTML output. If the tag is left blank doxygen
# will generate a default style sheet. Note that doxygen will try to copy
# the style sheet file to the HTML output directory, so don't put your own
# stylesheet in the HTML output directory as well, or it will be erased!
HTML_STYLESHEET =
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
# files or namespaces will be aligned in HTML using tables. If set to
# NO a bullet list will be used.
HTML_ALIGN_MEMBERS = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded. For this to work a browser that supports
# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
HTML_DYNAMIC_SECTIONS = NO
# If the GENERATE_DOCSET tag is set to YES, additional index files
# will be generated that can be used as input for Apple's Xcode 3
# integrated development environment, introduced with OSX 10.5 (Leopard).
# To create a documentation set, doxygen will generate a Makefile in the
# HTML output directory. Running make will produce the docset in that
# directory and running "make install" will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
# it at startup.
# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information.
GENERATE_DOCSET = NO
# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
# feed. A documentation feed provides an umbrella under which multiple
# documentation sets from a single provider (such as a company or product suite)
# can be grouped.
DOCSET_FEEDNAME = "Doxygen generated docs"
# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
# should uniquely identify the documentation set bundle. This should be a
# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
# will append .docset to the name.
DOCSET_BUNDLE_ID = org.doxygen.Project
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
# will be generated that can be used as input for tools like the
# Microsoft HTML help workshop to generate a compiled HTML help file (.chm)
# of the generated HTML documentation.
GENERATE_HTMLHELP = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
# be used to specify the file name of the resulting .chm file. You
# can add a path in front of the file if the result should not be
# written to the html output directory.
CHM_FILE =
# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
# be used to specify the location (absolute path including file name) of
# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
# the HTML help compiler on the generated index.hhp.
HHC_LOCATION =
# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
# controls if a separate .chi index file is generated (YES) or that
# it should be included in the master .chm file (NO).
GENERATE_CHI = NO
# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
# is used to encode HtmlHelp index (hhk), content (hhc) and project file
# content.
CHM_INDEX_ENCODING =
# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
# controls whether a binary table of contents is generated (YES) or a
# normal table of contents (NO) in the .chm file.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members
# to the contents of the HTML help documentation and to the tree view.
TOC_EXPAND = NO
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER
# are set, an additional index file will be generated that can be used as input for
# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated
# HTML documentation.
GENERATE_QHP = YES
# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
# be used to specify the file name of the resulting .qch file.
# The path specified is relative to the HTML output folder.
QCH_FILE = ../qch/signon.qch
# The QHP_NAMESPACE tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#namespace
QHP_NAMESPACE = $(QHP_NAMESPACE)
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
# Qt Help Project output. For more information please see
# http://doc.trolltech.com/qthelpproject.html#virtual-folders
QHP_VIRTUAL_FOLDER = $(QHP_VIRTUAL_FOLDER)
# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add.
# For more information please see
# http://doc.trolltech.com/qthelpproject.html#custom-filters
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see
# Qt Help Project / Custom Filters.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's
# filter section matches.
# Qt Help Project / Filter Attributes.
QHP_SECT_FILTER_ATTRS =
# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
# be used to specify the location of Qt's qhelpgenerator.
# If non-empty doxygen will try to run qhelpgenerator on the generated
# .qhp file.
QHG_LOCATION = qhelpgenerator
# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
# top of each HTML page. The value NO (the default) enables the index and
# the value YES disables it.
DISABLE_INDEX = NO
# This tag can be used to set the number of enum values (range [1..20])
# that doxygen will group on one line in the generated HTML documentation.
ENUM_VALUES_PER_LINE = 4
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information.
# If the tag value is set to FRAME, a side panel will be generated
# containing a tree-like index structure (just like the one that
# is generated for HTML Help). For this to work a browser that supports
# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
# probably better off using the HTML help feature. Other possible values
# for this tag are: HIERARCHIES, which will generate the Groups, Directories,
# and Class Hierarchy pages using a tree view instead of an ordered list;
# ALL, which combines the behavior of FRAME and HIERARCHIES; and NONE, which
# disables this behavior completely. For backwards compatibility with previous
# releases of Doxygen, the values YES and NO are equivalent to FRAME and NONE
# respectively.
GENERATE_TREEVIEW = ALL
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
# used to set the initial width (in pixels) of the frame in which the tree
# is shown.
TREEVIEW_WIDTH = 250
# Use this tag to change the font size of Latex formulas included
# as images in the HTML documentation. The default is 10. Note that
# when you change the font size after a successful doxygen run you need
# to manually remove any form_*.png images from the HTML output directory
# to force them to be regenerated.
FORMULA_FONTSIZE = 10
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
# generate Latex output.
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `latex' will be used as the default path.
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked. If left blank `latex' will be used as the default command name.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
# generate index for LaTeX. If left blank `makeindex' will be used as the
# default command name.
MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
# LaTeX documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used
# by the printer. Possible values are: a4, a4wide, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.
EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
# the generated latex document. The header should contain everything until
# the first chapter. If it is left blank doxygen will generate a
# standard header. Notice: only use this tag if you know what you are doing!
LATEX_HEADER =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
# is prepared for conversion to pdf (using ps2pdf). The pdf file will
# contain links (just like the HTML output) instead of page references
# This makes the output suitable for online browsing using a pdf viewer.
PDF_HYPERLINKS = YES
# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
# plain latex in the generated Makefile. Set this option to YES to get a
# higher quality PDF documentation.
USE_PDFLATEX = YES
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
# command to the generated LaTeX files. This will instruct LaTeX to keep
# running if errors occur, instead of asking the user for help.
# This option is also used when generating formulas in HTML.
LATEX_BATCHMODE = NO
# If LATEX_HIDE_INDICES is set to YES then doxygen will not
# include the index chapters (such as File Index, Compound Index, etc.)
# in the output.
LATEX_HIDE_INDICES = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
# The RTF output is optimized for Word 97 and may not look very pretty with
# other RTF readers or editors.
GENERATE_RTF = NO
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `rtf' will be used as the default path.
RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
# RTF documents. This may be useful for small projects and may help to
# save some trees in general.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
# will contain hyperlink fields. The RTF file will
# contain links (just like the HTML output) instead of page references.
# This makes the output suitable for online browsing using WORD or other
# programs which support those fields.
# Note: wordpad (write) and others do not support links.
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's
# config file, i.e. a series of assignments. You only have to provide
# replacements, missing definitions are set to their default value.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an rtf document.
# Syntax is similar to doxygen's config file.
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
# generate man pages
GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `man' will be used as the default path.
MAN_OUTPUT = man
# The MAN_EXTENSION tag determines the extension that is added to
# the generated man pages (default is the subroutine's section .3)
MAN_EXTENSION = .3
# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
# then it will generate one additional man file for each entity
# documented in the real man page(s). These additional files
# only source the real man page, but without them the man command
# would be unable to find the correct page. The default is NO.
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES Doxygen will
# generate an XML file that captures the structure of
# the code including all documentation.
GENERATE_XML = NO
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
# put in front of it. If left blank `xml' will be used as the default path.
XML_OUTPUT = xml
# The XML_SCHEMA tag can be used to specify an XML schema,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_SCHEMA =
# The XML_DTD tag can be used to specify an XML DTD,
# which can be used by a validating XML parser to check the
# syntax of the XML files.
XML_DTD =
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
# dump the program listings (including syntax highlighting
# and cross-referencing information) to the XML output. Note that
# enabling this will significantly increase the size of the XML output.
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
# generate an AutoGen Definitions (see autogen.sf.net) file
# that captures the structure of the code including all
# documentation. Note that this feature is still experimental
# and incomplete at the moment.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES Doxygen will
# generate a Perl module file that captures the structure of
# the code including all documentation. Note that this
# feature is still experimental and incomplete at the
# moment.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
# the necessary Makefile rules, Perl scripts and LaTeX code to be able
# to generate PDF and DVI output from the Perl module output.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
# nicely formatted so it can be parsed by a human reader.
# This is useful
# if you want to understand what is going on.
# On the other hand, if this
# tag is set to NO the size of the Perl module output will be much smaller
# and Perl will parse it just the same.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file
# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
# This is useful so different doxyrules.make files included by the same
# Makefile don't overwrite each other's variables.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
# evaluate all C-preprocessor directives found in the sources and include
# files.
ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
# names in the source code. If set to NO (the default) only conditional
# compilation will be performed. Macro expansion can be done in a controlled
# way by setting EXPAND_ONLY_PREDEF to YES.
MACRO_EXPANSION = NO
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the
# PREDEFINED and EXPAND_AS_DEFINED tags.
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
# in the INCLUDE_PATH (see below) will be search if a #include is found.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by
# the preprocessor.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will
# be used.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that
# are defined before the preprocessor is started (similar to the -D option of
# gcc). The argument of the tag is a list of macros of the form: name
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed. To prevent a macro definition from being
# undefined via #undef or recursively expanded use the := operator
# instead of the = operator.
PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
# The macro definition that is found in the sources will be used.
# Use the PREDEFINED tag if you want to use a different macro definition.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
# doxygen's preprocessor will remove all function-like macros that are alone
# on a line, have an all uppercase name, and do not end with a semicolon. Such
# function macros are typically used for boiler-plate code, and will confuse
# the parser if not removed.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
#---------------------------------------------------------------------------
# The TAGFILES option can be used to specify one or more tagfiles.
# Optionally an initial location of the external documentation
# can be added for each tagfile. The format of a tag file without
# this location is as follows:
#
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
#
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where "loc1" and "loc2" can be relative or absolute paths or
# URLs. If a location is present for each tag, the installdox tool
# does not have to be run to correct the links.
# Note that each tag file must have a unique name
# (where the name does NOT include the path)
# If a tag file is not located in the directory in which doxygen
# is run, you must also specify the path to the tagfile here.
TAGFILES = $(TAGFILES)
# When a file name is specified after GENERATE_TAGFILE, doxygen will create
# a tag file that is based on the input files it reads.
GENERATE_TAGFILE = $(TAGFILE)
# If the ALLEXTERNALS tag is set to YES all external classes will be listed
# in the class index. If set to NO only the inherited external classes
# will be listed.
ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
# in the modules index. If set to NO, only the current project's groups will
# be listed.
EXTERNAL_GROUPS = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of `which perl').
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
# or super classes. Setting the tag to NO turns the diagrams off. Note that
# this option is superseded by the HAVE_DOT option below. This is only a
# fallback. It is recommended to install and use dot, since it yields more
# powerful graphs.
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see
# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# If set to YES, the inheritance and collaboration graphs will hide
# inheritance and usage relations if the target is undocumented
# or is not a class.
HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz, a graph visualization
# toolkit from AT&T and Lucent Bell Labs. The other options in this section
# have no effect if this option is set to NO (the default)
HAVE_DOT = YES
# By default doxygen will write a font called FreeSans.ttf to the output
# directory and reference it in all dot files that doxygen generates. This
# font does not include all possible unicode characters however, so when you need
# these (or just want a differently looking font) you can specify the font name
# using DOT_FONTNAME. You need need to make sure dot is able to find the font,
# which can be done by putting it in a standard location or by setting the
# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory
# containing the font.
DOT_FONTNAME = FreeSans
# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
# The default size is 10pt.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the output directory to look for the
# FreeSans.ttf font (which doxygen will put there itself). If you specify a
# different font using DOT_FONTNAME you can set the path where dot
# can find it using this tag.
DOT_FONTPATH =
# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect inheritance relations. Setting this tag to YES will force the
# the CLASS_DIAGRAMS tag to NO.
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for each documented class showing the direct and
# indirect implementation dependencies (inheritance, containment, and
# class references variables) of the class with other documented classes.
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
# will generate a graph for groups, showing the direct groups dependencies
GROUP_GRAPHS = YES
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
UML_LOOK = NO
# If set to YES, the inheritance and collaboration graphs will show the
# relations between templates and their instances.
TEMPLATE_RELATIONS = NO
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
# tags are set to YES then doxygen will generate a graph for each documented
# file showing the direct and indirect include dependencies of the file with
# other documented files.
INCLUDE_GRAPH = YES
# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
# documented header file showing the documented files that directly or
# indirectly include this file.
INCLUDED_BY_GRAPH = YES
# If the CALL_GRAPH and HAVE_DOT options are set to YES then
# doxygen will generate a call dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable call graphs
# for selected functions only using the \callgraph command.
CALL_GRAPH = NO
# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
# doxygen will generate a caller dependency graph for every global function
# or class method. Note that enabling this option will significantly increase
# the time of a run. So in most cases it will be better to enable caller
# graphs for selected functions only using the \callergraph command.
CALLER_GRAPH = NO
# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
# will graphical hierarchy of all classes instead of a textual one.
GRAPHICAL_HIERARCHY = YES
# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
# then doxygen will show the dependencies a directory has on other directories
# in a graphical way. The dependency relations are determined by the #include
# relations between the files in the directories.
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. Possible values are png, jpg, or gif
# If left blank png will be used.
DOT_IMAGE_FORMAT = png
# The tag DOT_PATH can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the
# \dotfile command).
DOTFILE_DIRS =
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
# nodes that will be shown in the graph. If the number of nodes in a graph
# becomes larger than this value, doxygen will truncate the graph, which is
# visualized by representing a node as a red box. Note that doxygen if the
# number of direct children of the root node in a graph is already larger than
# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
DOT_GRAPH_MAX_NODES = 50
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
# graphs generated by dot. A depth value of 3 means that only nodes reachable
# from the root by following a path via at most 3 edges will be shown. Nodes
# that lay further from the root node will be omitted. Note that setting this
# option to 1 or 2 may greatly reduce the computation time needed for large
# code bases. Also note that the size of a graph can be further restricted by
# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
MAX_DOT_GRAPH_DEPTH = 0
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not
# seem to support this out of the box. Warning: Depending on the platform used,
# enabling this option may lead to badly anti-aliased labels on the edges of
# a graph (i.e. they become hard to read).
DOT_TRANSPARENT = NO
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10)
# support this, this feature is disabled by default.
DOT_MULTI_TARGETS = NO
# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
# generate a legend page explaining the meaning of the various boxes and
# arrows in the dot generated graphs.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
# remove the intermediate dot files that are used to generate
# the various graphs.
DOT_CLEANUP = YES
#---------------------------------------------------------------------------
# Options related to the search engine
#---------------------------------------------------------------------------
# The SEARCHENGINE tag specifies whether or not a search engine should be
# used. If set to NO the values of all tags below this one will be ignored.
SEARCHENGINE = NO
# End of File
signon-8.56+14.04.20140307/doc/doc.pri 0000644 0000152 0177776 00000005317 12306320366 017403 0 ustar pbuser nogroup 0000000 0000000 #-----------------------------------------------------------------------------
# doc.pri
#-----------------------------------------------------------------------------
# list of documentation folders to install
DOC_FOLDERS = doc/html \
doc/qch
# files and folders listed in the installation target's .files section
# must exist _before_ qmake generates the Makefile...so, make sure our
# documentation target folders exist in the current build folder
for( folder, DOC_FOLDERS ) {
system( mkdir -p $$OUT_PWD/$${folder} )
}
#-----------------------------------------------------------------------------
# extra build targets for generating and cleaning documentation
#-----------------------------------------------------------------------------
DOC_INPUT += $${_PRO_FILE_PWD_}/doc/src
DOC_INPUT += $${_PRO_FILE_PWD_}/src
# target for generating documentation
doctarget.target = docs
doctarget.commands = OUTPUT_DIRECTORY=doc \
PROJECT_NAME=\"$${PROJECT_NAME}\" \
PROJECT_NUMBER=\"$${PROJECT_VERSION}\" \
STRIP_FROM_PATH=\"$${_PRO_FILE_PWD_}\" \
INPUT=\"$${DOC_INPUT}\" \
QHP_NAMESPACE=\"com.nokia.example.$${TARGET}\" \
QHP_VIRTUAL_FOLDER=\"$${TARGET}\" \
TAGFILES=\"$$system(pwd)/qt.tags\" \
TAGFILE=\"doc/$${TARGET}.tags\" \
doxygen $$system(pwd)/doxy.conf
doctarget.depends = FORCE
QMAKE_EXTRA_TARGETS += doctarget
# target for cleaning generated documentation
doccleantarget.target = cleandocs
for( folder, DOC_FOLDERS ) {
doccleantarget.commands += rm -r -f $${folder};
}
doccleantarget.commands += rm -r -f doc/signon.tags;
doccleantarget.depends = FORCE
QMAKE_EXTRA_TARGETS += doccleantarget
#-----------------------------------------------------------------------------
# installation setup
# NOTE: remember to set headers.files before this include to have the headers
# properly setup.
#-----------------------------------------------------------------------------
include( ../common-project-config.pri )
include( ../common-installs-config.pri )
#-----------------------------------------------------------------------------
# Installation target setup for documentation
#-----------------------------------------------------------------------------
documentation.path = $${INSTALL_PREFIX}/share/doc/$${PROJECT_NAME}
for( folder, DOC_FOLDERS ) {
documentation.files += $$OUT_PWD/$${folder}
}
# make sure docs are generated before trying to install anything
documentation.depends = docs
INSTALLS += documentation
message("====")
message("==== INSTALLS += documentation")
# End of File
signon-8.56+14.04.20140307/doc/src/ 0000755 0000152 0177776 00000000000 12306320634 016701 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/doc/src/mainpage.dox 0000644 0000152 0177776 00000000701 12306320366 021176 0 ustar pbuser nogroup 0000000 0000000 /*! @mainpage Single Sign On documentation
@section intro Introduction
Single Sign-On is a framework for centrally storing authentication credentials
and handling authentication on behalf of applications as requested by
applications. It consists of a secure storage of login credentials (for example
usernames and passwords), plugins for different authentication systems and a
client library for applications to communicate with this system.
*/
signon-8.56+14.04.20140307/signon.pro 0000644 0000152 0177776 00000000576 12306320366 017376 0 ustar pbuser nogroup 0000000 0000000 include( common-vars.pri )
TEMPLATE = subdirs
SUBDIRS = lib src server tests
src.depends = lib
tests.depends = lib src
include( common-installs-config.pri )
include( doc/doc.pri )
DISTNAME = $${PROJECT_NAME}-$${PROJECT_VERSION}
dist.commands = "git archive --format=tar --prefix=$${DISTNAME}/ HEAD | bzip2 -9 > $${DISTNAME}.tar.bz2"
QMAKE_EXTRA_TARGETS += dist
# End of File
signon-8.56+14.04.20140307/common-pkgconfig.pri 0000644 0000152 0177776 00000000465 12306320366 021325 0 ustar pbuser nogroup 0000000 0000000 # Include this file after defining the pkgconfig.files variable
!isEmpty(pkgconfig.files) {
QMAKE_SUBSTITUTES += $${pkgconfig.files}.in
pkgconfig.CONFIG = no_check_exist
pkgconfig.path = $${INSTALL_LIBDIR}/pkgconfig
QMAKE_EXTRA_TARGETS += pkgconfig
QMAKE_CLEAN += $${pkgconfig.files}
}
signon-8.56+14.04.20140307/NOTES 0000644 0000152 0177776 00000000001 12306320366 016151 0 ustar pbuser nogroup 0000000 0000000
signon-8.56+14.04.20140307/lib/ 0000755 0000152 0177776 00000000000 12306320634 016113 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/lib/lib.pro 0000644 0000152 0177776 00000000065 12306320366 017406 0 ustar pbuser nogroup 0000000 0000000 TEMPLATE = subdirs
SUBDIRS = signond SignOn plugins
signon-8.56+14.04.20140307/lib/signond/ 0000755 0000152 0177776 00000000000 12306320634 017554 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/lib/signond/signond.pro 0000644 0000152 0177776 00000001523 12306320366 021742 0 ustar pbuser nogroup 0000000 0000000 include( ../../common-project-config.pri )
include( $${TOP_SRC_DIR}/common-installs-config.pri )
include( $${TOP_SRC_DIR}/common-vars.pri )
TEMPLATE = subdirs
SUBDIRS = SignOn
# Input
public_headers += \
signoncommon.h
HEADERS = $$public_headers
INCLUDEPATH += . \
$$TOP_SRC_DIR/include
DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
OTHER_FILES = \
com.google.code.AccountsSSO.SingleSignOn.AuthService.xml \
com.google.code.AccountsSSO.SingleSignOn.AuthSession.xml \
com.google.code.AccountsSSO.SingleSignOn.Identity.xml
headers.files = $$public_headers
headers.path = $${INSTALL_PREFIX}/include/signond
dbus_files.files = $$OTHER_FILES
dbus_files.path =$${INSTALL_PREFIX}/share/dbus-1/interfaces
pkgconfig.files = signond.pc
include($${TOP_SRC_DIR}/common-pkgconfig.pri)
INSTALLS += headers dbus_files pkgconfig
signon-8.56+14.04.20140307/lib/signond/com.google.code.AccountsSSO.SingleSignOn.Identity.xml 0000644 0000152 0177776 00000011515 12306320366 031536 0 ustar pbuser nogroup 0000000 0000000
signon-8.56+14.04.20140307/lib/signond/com.nokia.SingleSignOn.Backup.xml 0000644 0000152 0177776 00000001103 12306320366 025713 0 ustar pbuser nogroup 0000000 0000000
signon-8.56+14.04.20140307/lib/signond/.gitignore 0000644 0000152 0177776 00000000045 12306320366 021545 0 ustar pbuser nogroup 0000000 0000000 SignOn/SignOnExtension.pc
signond.pc
signon-8.56+14.04.20140307/lib/signond/com.google.code.AccountsSSO.SingleSignOn.AuthService.xml 0000644 0000152 0177776 00000011044 12306320366 032164 0 ustar pbuser nogroup 0000000 0000000
signon-8.56+14.04.20140307/lib/signond/signoncommon.h 0000644 0000152 0177776 00000032433 12306320366 022442 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2009-2010 Nokia Corporation.
* Copyright (C) 2012 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
/*!
* @copyright Copyright (C) 2009-2011 Nokia Corporation.
* @license LGPL
*/
#ifndef SIGNONCOMMON_H_
#define SIGNONCOMMON_H_
#ifdef __cplusplus
#include
#include
#define SIGNOND_STRING(s) QLatin1String(s)
#define SIGNOND_BUS QDBusConnection::sessionBus()
#else
#define SIGNOND_STRING(s) s
#define SIGNOND_BUS //TODO
#endif
#define SIGNOND_NEW_IDENTITY 0
#define SIGNOND_MAX_TIMEOUT 0x7FFFFFFF
/*
* todo: the naming convention for interfaces should be clarified
* */
/*
* Common DBUS definitions
* */
#define SIGNOND_SERVICE_PREFIX "com.google.code.AccountsSSO.SingleSignOn"
#define SIGNOND_SERVICE SIGNOND_STRING(SIGNOND_SERVICE_PREFIX)
#define SIGNOND_SOCKET_FILENAME "signond/socket" /* in XDG_RUNTIME_DIR */
#define SIGNOND_DAEMON_OBJECTPATH \
SIGNOND_STRING("/com/google/code/AccountsSSO/SingleSignOn")
#define SIGNOND_DAEMON_INTERFACE_C SIGNOND_SERVICE_PREFIX ".AuthService"
#define SIGNOND_IDENTITY_INTERFACE_C SIGNOND_SERVICE_PREFIX ".Identity"
#define SIGNOND_AUTH_SESSION_INTERFACE_C SIGNOND_SERVICE_PREFIX ".AuthSession"
#define SIGNOND_DAEMON_INTERFACE \
SIGNOND_STRING(SIGNOND_DAEMON_INTERFACE_C)
#define SIGNOND_IDENTITY_INTERFACE \
SIGNOND_STRING(SIGNOND_IDENTITY_INTERFACE_C)
#define SIGNOND_AUTH_SESSION_INTERFACE \
SIGNOND_STRING(SIGNOND_AUTH_SESSION_INTERFACE_C)
#define SIGNOND_ERR_PREFIX SIGNOND_SERVICE_PREFIX ".Error."
/*
* Common server/client identity info strings
* */
#define SIGNOND_IDENTITY_INFO_ID SIGNOND_STRING("Id")
#define SIGNOND_IDENTITY_INFO_USERNAME SIGNOND_STRING("UserName")
#define SIGNOND_IDENTITY_INFO_SECRET SIGNOND_STRING("Secret")
#define SIGNOND_IDENTITY_INFO_STORESECRET SIGNOND_STRING("StoreSecret")
#define SIGNOND_IDENTITY_INFO_CAPTION SIGNOND_STRING("Caption")
#define SIGNOND_IDENTITY_INFO_REALMS SIGNOND_STRING("Realms")
#define SIGNOND_IDENTITY_INFO_AUTHMETHODS SIGNOND_STRING("AuthMethods")
#define SIGNOND_IDENTITY_INFO_OWNER SIGNOND_STRING("Owner")
#define SIGNOND_IDENTITY_INFO_ACL SIGNOND_STRING("ACL")
#define SIGNOND_IDENTITY_INFO_TYPE SIGNOND_STRING("Type")
#define SIGNOND_IDENTITY_INFO_REFCOUNT SIGNOND_STRING("RefCount")
#define SIGNOND_IDENTITY_INFO_VALIDATED SIGNOND_STRING("Validated")
#define SIGNOND_IDENTITY_INFO_USERNAME_IS_SECRET \
SIGNOND_STRING("UserNameSecret")
/*
* Common server/client sides error names and messages
* */
#define SIGNOND_UNKNOWN_ERR_STR SIGNOND_STRING("Unknown error.")
#define SIGNOND_UNKNOWN_ERR_NAME SIGNOND_STRING(SIGNOND_ERR_PREFIX "Unknown")
#define SIGNOND_INTERNAL_SERVER_ERR_STR \
SIGNOND_STRING("Server internal error occurred.")
#define SIGNOND_INTERNAL_SERVER_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "InternalServer")
#define SIGNOND_INTERNAL_COMMUNICATION_ERR_STR \
SIGNOND_STRING("Communication with the Signon service failed..")
#define SIGNOND_INTERNAL_COMMUNICATION_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "InternalCommunication")
#define SIGNOND_PERMISSION_DENIED_ERR_STR \
SIGNOND_STRING("Client has insuficient permissions to access the service.")
#define SIGNOND_PERMISSION_DENIED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "PermissionDenied")
#define SIGNOND_METHOD_OR_MECHANISM_NOT_ALLOWED_ERR_STR \
SIGNOND_STRING("Identity does not allow authentication using the selected method or mechanism.")
#define SIGNOND_METHOD_OR_MECHANISM_NOT_ALLOWED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "MethodOrMechanismNotAllowed")
#define SIGNOND_ENCRYPTION_FAILED_ERR_STR \
SIGNOND_STRING("Failure in encoding/decoding of incoming data")
#define SIGNOND_ENCRYPTION_FAILED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "EncryptionFailed")
#define SIGNOND_METHOD_NOT_KNOWN_ERR_STR \
SIGNOND_STRING("Authentication method is not known.")
#define SIGNOND_METHOD_NOT_KNOWN_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "MethodNotKnown")
#define SIGNOND_SERVICE_NOT_AVAILABLE_ERR_STR \
SIGNOND_STRING("Signon service is currently not available.")
#define SIGNOND_SERVICE_NOT_AVAILABLE_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "ServiceNotAvailable")
#define SIGNOND_INVALID_QUERY_ERR_STR \
SIGNOND_STRING("Query parameters are invalid.")
#define SIGNOND_INVALID_QUERY_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "InvalidQuery")
#define SIGNOND_METHOD_NOT_AVAILABLE_ERR_STR \
SIGNOND_STRING("Authentication method is not available.")
#define SIGNOND_METHOD_NOT_AVAILABLE_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "MethodNotAvailable")
#define SIGNOND_IDENTITY_NOT_FOUND_ERR_STR \
SIGNOND_STRING("The identity was not found on the server.")
#define SIGNOND_IDENTITY_NOT_FOUND_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "IdentityNotFound")
#define SIGNOND_STORE_FAILED_ERR_STR \
SIGNOND_STRING("Storing of the identity data failed.")
#define SIGNOND_STORE_FAILED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "StoreFailed")
#define SIGNOND_REMOVE_FAILED_ERR_STR \
SIGNOND_STRING("Removing identity data failed.")
#define SIGNOND_REMOVE_FAILED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "RemoveFailed")
#define SIGNOND_SIGNOUT_FAILED_ERR_STR SIGNOND_STRING("Signing out failed.")
#define SIGNOND_SIGNOUT_FAILED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "SignOutFailed")
#define SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_STR \
SIGNOND_STRING("Operation canceled by user.")
#define SIGNOND_IDENTITY_OPERATION_CANCELED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "IdentityOperationCanceled")
#define SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_STR \
SIGNOND_STRING("Query returned no results.")
#define SIGNOND_CREDENTIALS_NOT_AVAILABLE_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "CredentialsNotAvailable")
#define SIGNOND_REFERENCE_NOT_FOUND_ERR_STR \
SIGNOND_STRING("Reference not found.")
#define SIGNOND_REFERENCE_NOT_FOUND_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "ReferenceNotFound")
#define SIGNOND_MECHANISM_NOT_AVAILABLE_ERR_STR \
SIGNOND_STRING("Requested mechanism is not available.")
#define SIGNOND_MECHANISM_NOT_AVAILABLE_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "MechanismNotAvailable")
#define SIGNOND_MISSING_DATA_ERR_STR \
SIGNOND_STRING("The SessionData object does not contain all necessary information.")
#define SIGNOND_MISSING_DATA_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "MissingData")
#define SIGNOND_INVALID_CREDENTIALS_ERR_STR \
SIGNOND_STRING("The supplied credentials are invalid for the mechanism implementation.")
#define SIGNOND_INVALID_CREDENTIALS_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "InvalidCredentials")
#define SIGNOND_NOT_AUTHORIZED_ERR_STR \
SIGNOND_STRING("Not authorized to access service account.")
#define SIGNOND_NOT_AUTHORIZED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "NotAuthorized")
#define SIGNOND_WRONG_STATE_ERR_STR \
SIGNOND_STRING("Operation method has been called in a wrong state.")
#define SIGNOND_WRONG_STATE_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "WrongState")
#define SIGNOND_OPERATION_NOT_SUPPORTED_ERR_STR \
SIGNOND_STRING("The operation is not supported by the mechanism implementation.")
#define SIGNOND_OPERATION_NOT_SUPPORTED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "OperationNotSupported")
#define SIGNOND_NO_CONNECTION_ERR_STR SIGNOND_STRING("No network connection.")
#define SIGNOND_NO_CONNECTION_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "NoConnection")
#define SIGNOND_NETWORK_ERR_STR SIGNOND_STRING("Network connetion failed.")
#define SIGNOND_NETWORK_ERR_NAME SIGNOND_STRING(SIGNOND_ERR_PREFIX "Network")
#define SIGNOND_SSL_ERR_STR SIGNOND_STRING("Ssl connection failed.")
#define SIGNOND_SSL_ERR_NAME SIGNOND_STRING(SIGNOND_ERR_PREFIX "Ssl")
#define SIGNOND_RUNTIME_ERR_STR \
SIGNOND_STRING("Casting SessionData into subclass failed.")
#define SIGNOND_RUNTIME_ERR_NAME SIGNOND_STRING(SIGNOND_ERR_PREFIX "Runtime")
#define SIGNOND_SESSION_CANCELED_ERR_STR \
SIGNOND_STRING("Session processing was canceled.")
#define SIGNOND_SESSION_CANCELED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "SessionCanceled")
#define SIGNOND_TIMED_OUT_ERR_STR SIGNOND_STRING("Session processing timed out.")
#define SIGNOND_TIMED_OUT_ERR_NAME SIGNOND_STRING(SIGNOND_ERR_PREFIX "TimedOut")
#define SIGNOND_USER_INTERACTION_ERR_STR \
SIGNOND_STRING("User interaction dialog failed.")
#define SIGNOND_USER_INTERACTION_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "UserInteraction")
#define SIGNOND_OPERATION_FAILED_ERR_STR SIGNOND_STRING("Operation failed.")
#define SIGNOND_OPERATION_FAILED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "OperationFailed")
#define SIGNOND_TOS_NOT_ACCEPTED_ERR_STR \
SIGNOND_STRING("User declined Terms of Service.")
#define SIGNOND_TOS_NOT_ACCEPTED_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "TOSNotAccepted")
#define SIGNOND_FORGOT_PASSWORD_ERR_STR \
SIGNOND_STRING("User selected forgot password.")
#define SIGNOND_FORGOT_PASSWORD_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "ForgotPassword")
#define SIGNOND_INCORRECT_DATE_ERR_STR \
SIGNOND_STRING("The Date set is not correct")
#define SIGNOND_INCORRECT_DATE_ERR_NAME \
SIGNOND_STRING(SIGNOND_ERR_PREFIX "IncorrectDate")
#define SIGNOND_USER_ERROR_ERR_NAME SIGNOND_STRING(SIGNOND_ERR_PREFIX "User")
#ifdef __cplusplus
namespace SignOn {
/*!
* @enum AuthSessionState
* Codes for the states of the AuthSession.
* @remarks This is not a part of the public AuthSession and should be kept
* as an internal enum.
* This is not the same as AuthSession::AuthSessionState, it could even go
* with a different name.
* @todo The order of the states must be synchronized with AuthPluginState
* enum
*/
enum AuthSessionState {
SessionNotStarted = 0, /**< No message. */
HostResolving, /**< Resolving remote server host name. */
ServerConnecting, /**< Connecting to remote server. */
DataSending, /**< Sending data to remote server. */
ReplyWaiting, /**< Waiting reply from remote server. */
UserPending, /**< Waiting response from user. */
UiRefreshing, /**< Refreshing ui request. */
ProcessPending, /**< Waiting another process to start. */
SessionStarted, /**< Authentication session is started. */
ProcessCanceling, /**< Canceling.current process: */
ProcessDone, /**< Authentication completed. > */
CustomState, /**< Custom message. */
MaxState
};
/*
* Flag values used to inform identity clients about the server side
* identity state
* TODO - the DBUS signal using this will be replaced by 3 specific
* signals, thus this will be removed.
*/
enum IdentityState {
IdentityDataUpdated = 0,
IdentityRemoved,
IdentitySignedOut
};
}// namespace SignOn
#else
enum SignonAuthSessionState {
SIGNON_AUTH_SESSION_STATE_NOT_STARTED = 0, /**< No message. */
SIGNON_AUTH_SESSION_STATE_RESOLVING_HOST, /**< Resolving remote server
host name. */
SIGNON_AUTH_SESSION_STATE_CONNECTING, /**< Connecting to remote
server. */
SIGNON_AUTH_SESSION_STATE_SENDING_DATA, /**< Sending data to remote
server. */
SIGNON_AUTH_SESSION_STATE_WAITING_REPLY, /**< Waiting reply from remote
server. */
SIGNON_AUTH_SESSION_STATE_USER_PENDING, /**< Waiting response from
user. */
SIGNON_AUTH_SESSION_STATE_UI_REFRESHING, /**< Refreshing ui request. */
SIGNON_AUTH_SESSION_STATE_PROCESS_PENDING, /**< Waiting another process
to start. */
SIGNON_AUTH_SESSION_STATE_STARTED, /**< Authentication session is
started. */
SIGNON_AUTH_SESSION_STATE_PROCESS_CANCELING, /**< Canceling.current
process. */
SIGNON_AUTH_SESSION_STATE_PROCESS_DONE, /**< Authentication
completed. */
SIGNON_AUTH_SESSION_STATE_CUSTOM, /**< Custom message. */
SIGNON_AUTH_SESSION_STATE_LAST
};
#endif //__cplusplus
#endif /* SIGNONCOMMON_H_ */
signon-8.56+14.04.20140307/lib/signond/signond.pc.in 0000644 0000152 0177776 00000000363 12306320366 022152 0 ustar pbuser nogroup 0000000 0000000 prefix=$$INSTALL_PREFIX
exec_prefix=${prefix}
libdir=$$INSTALL_LIBDIR
includedir=${prefix}/include
Name: signond-dev
Description: SignOn Framework client library development package
Version: $$PROJECT_VERSION
Cflags: -I${includedir}/signond
signon-8.56+14.04.20140307/lib/signond/SignOn/ 0000755 0000152 0177776 00000000000 12306320634 020751 5 ustar pbuser nogroup 0000000 0000000 signon-8.56+14.04.20140307/lib/signond/SignOn/abstract-secrets-storage.cpp 0000644 0000152 0177776 00000005072 12306320366 026376 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2011 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "abstract-secrets-storage.h"
#include "debug.h"
using namespace SignOn;
namespace SignOn {
class AbstractSecretsStoragePrivate
{
Q_DECLARE_PUBLIC(AbstractSecretsStorage)
public:
AbstractSecretsStoragePrivate(AbstractSecretsStorage *secretsStorage);
~AbstractSecretsStoragePrivate() {};
private:
mutable AbstractSecretsStorage *q_ptr;
bool m_isOpen;
CredentialsDBError m_lastError;
};
};
AbstractSecretsStoragePrivate::AbstractSecretsStoragePrivate(
AbstractSecretsStorage *secretsStorage):
q_ptr(secretsStorage),
m_isOpen(false)
{
}
AbstractSecretsStorage::AbstractSecretsStorage(QObject *parent):
QObject(parent),
d_ptr(new AbstractSecretsStoragePrivate(this))
{
}
AbstractSecretsStorage::~AbstractSecretsStorage()
{
delete d_ptr;
}
bool AbstractSecretsStorage::close()
{
setIsOpen(false);
return true;
}
bool AbstractSecretsStorage::isOpen() const
{
return d_ptr->m_isOpen;
}
bool AbstractSecretsStorage::checkPassword(const quint32 id,
const QString &username,
const QString &password)
{
QString storedUsername, storedPassword;
if (!loadCredentials(id, storedUsername, storedPassword))
return false;
return storedUsername == username && storedPassword == password;
}
CredentialsDBError AbstractSecretsStorage::lastError() const
{
return d_ptr->m_lastError;
}
void AbstractSecretsStorage::clearError()
{
d_ptr->m_lastError.clear();
}
void AbstractSecretsStorage::setIsOpen(bool isOpen)
{
d_ptr->m_isOpen = isOpen;
}
void AbstractSecretsStorage::setLastError(const CredentialsDBError &error)
{
d_ptr->m_lastError = error;
}
signon-8.56+14.04.20140307/lib/signond/SignOn/AbstractSecretsStorage 0000644 0000152 0177776 00000000055 12306320366 025317 0 ustar pbuser nogroup 0000000 0000000 #include
signon-8.56+14.04.20140307/lib/signond/SignOn/misc.h 0000644 0000152 0177776 00000002465 12306320366 022066 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 SIGNON_MISC_H
#define SIGNON_MISC_H
#include
namespace SignOn {
/* Desired permissions for the files created by signond */
const QFile::Permissions signonFilePermissions =
QFile::WriteUser | QFile::ReadUser;
/* Sets user UID and GID for a file. */
bool setUserOwnership(const QString &filePath);
bool setFilePermissions(const QString &filePath,
const QFile::Permissions permissions,
bool keepExisting = true);
}
#endif // SIGNON_MISC_H
signon-8.56+14.04.20140307/lib/signond/SignOn/abstract-crypto-manager.cpp 0000644 0000152 0177776 00000007737 12306320366 026226 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2011 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "abstract-crypto-manager.h"
#include "debug.h"
using namespace SignOn;
namespace SignOn {
class AbstractCryptoManagerPrivate
{
Q_DECLARE_PUBLIC(AbstractCryptoManager)
public:
AbstractCryptoManagerPrivate(AbstractCryptoManager *cryptoManager);
~AbstractCryptoManagerPrivate() {};
private:
mutable AbstractCryptoManager *q_ptr;
Key m_encryptionKey;
bool m_fileSystemIsSetup;
bool m_fileSystemIsMounted;
};
};
AbstractCryptoManagerPrivate::AbstractCryptoManagerPrivate(
AbstractCryptoManager *cryptoManager):
q_ptr(cryptoManager),
m_fileSystemIsSetup(false),
m_fileSystemIsMounted(false)
{
}
AbstractCryptoManager::AbstractCryptoManager(QObject *parent):
QObject(parent),
d_ptr(new AbstractCryptoManagerPrivate(this))
{
}
AbstractCryptoManager::~AbstractCryptoManager()
{
delete d_ptr;
}
void AbstractCryptoManager::setEncryptionKey(const SignOn::Key &key)
{
if (fileSystemIsMounted()) {
BLAME() << "File system already mounted";
return;
}
d_ptr->m_encryptionKey = key;
}
SignOn::Key AbstractCryptoManager::encryptionKey() const
{
return d_ptr->m_encryptionKey;
}
bool AbstractCryptoManager::initialize(const QVariantMap &configuration)
{
Q_UNUSED(configuration);
return true;
}
bool AbstractCryptoManager::setupFileSystem()
{
setFileSystemSetup(true);
return true;
}
bool AbstractCryptoManager::deleteFileSystem()
{
setFileSystemSetup(false);
return true;
}
bool AbstractCryptoManager::fileSystemIsSetup() const
{
return d_ptr->m_fileSystemIsSetup;
}
bool AbstractCryptoManager::mountFileSystem()
{
setFileSystemMounted(true);
return true;
}
bool AbstractCryptoManager::unmountFileSystem()
{
setFileSystemMounted(false);
return true;
}
bool AbstractCryptoManager::fileSystemIsMounted() const
{
return d_ptr->m_fileSystemIsMounted;
}
QString AbstractCryptoManager::fileSystemMountPath() const
{
return QString();
}
QStringList AbstractCryptoManager::backupFiles() const
{
return QStringList();
}
bool AbstractCryptoManager::encryptionKeyInUse(const SignOn::Key &key)
{
Q_UNUSED(key);
return true;
}
bool AbstractCryptoManager::addEncryptionKey(const SignOn::Key &key,
const SignOn::Key &existingKey)
{
Q_UNUSED(key);
Q_UNUSED(existingKey);
return true;
}
bool AbstractCryptoManager::removeEncryptionKey(const SignOn::Key &key,
const SignOn::Key &remainingKey)
{
Q_UNUSED(key);
Q_UNUSED(remainingKey);
return true;
}
void AbstractCryptoManager::setFileSystemMounted(bool isMounted)
{
Q_D(AbstractCryptoManager);
if (isMounted != d->m_fileSystemIsMounted) {
if (d->m_fileSystemIsMounted) {
Q_EMIT fileSystemUnmounting();
}
d->m_fileSystemIsMounted = isMounted;
if (isMounted) {
Q_EMIT fileSystemMounted();
}
}
}
void AbstractCryptoManager::setFileSystemSetup(bool isSetup)
{
Q_D(AbstractCryptoManager);
if (isSetup != d->m_fileSystemIsSetup) {
d->m_fileSystemIsSetup = isSetup;
}
}
signon-8.56+14.04.20140307/lib/signond/SignOn/extension-interface.cpp 0000644 0000152 0177776 00000003062 12306320366 025432 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "extension-interface.h"
using namespace SignOn;
AbstractKeyManager *
ExtensionInterface::keyManager(QObject *parent) const
{
Q_UNUSED(parent);
return 0;
}
AbstractKeyAuthorizer *
ExtensionInterface2::keyAuthorizer(KeyHandler *keyHandler,
QObject *parent) const
{
Q_UNUSED(keyHandler);
Q_UNUSED(parent);
return 0;
}
AbstractCryptoManager *
ExtensionInterface3::cryptoManager(QObject *parent) const
{
Q_UNUSED(parent);
return 0;
}
AbstractSecretsStorage *
ExtensionInterface3::secretsStorage(QObject *parent) const
{
Q_UNUSED(parent);
return 0;
}
AbstractAccessControlManager *
ExtensionInterface3::accessControlManager(QObject *parent) const
{
Q_UNUSED(parent);
return 0;
}
signon-8.56+14.04.20140307/lib/signond/SignOn/abstract-access-control-manager.h 0000644 0000152 0177776 00000011500 12306320366 027251 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Intel Corporation.
* Copyright (C) 2013 Canonical Ltd.
*
* Contact: Elena Reshetova
* Contact: Alberto Mardegan
*
* 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
*/
/*!
* @file abstract-access-control-manager.h
* Definition of the AbstractAccessControlManager object.
* @ingroup Accounts_and_SSO_Framework
*/
#ifndef SIGNON_ABSTRACT_ACCESS_CONTROL_MANAGER_H
#define SIGNON_ABSTRACT_ACCESS_CONTROL_MANAGER_H
#include
#include
#include
class QDBusConnection;
class QDBusMessage;
namespace SignOn {
class AbstractAccessControlManager;
class AccessRequestData;
class SIGNON_EXPORT AccessRequest
{
public:
explicit AccessRequest();
AccessRequest(const AccessRequest &other);
~AccessRequest();
/*!
* Identifies the client requesting the access.
* @param peerConnection the connection over which the message was sent.
* @param peerMessage, the request message sent over DBUS by the process.
*/
void setPeer(const QDBusConnection &connection,
const QDBusMessage &message);
const QDBusConnection &peerConnection() const;
const QDBusMessage &peerMessage() const;
/*!
* Specifies the SignOn::Identity resource being accessed.
*/
void setIdentity(quint32 id);
quint32 identity() const;
private:
QSharedDataPointer d;
};
class AccessReplyPrivate;
class SIGNON_EXPORT AccessReply: public QObject
{
Q_OBJECT
public:
~AccessReply();
const AccessRequest &request() const;
bool isAccepted() const;
Q_SIGNALS:
void finished();
protected:
explicit AccessReply(const AccessRequest &request, QObject *parent = 0);
protected Q_SLOTS:
void accept();
void decline();
private:
friend class AbstractAccessControlManager;
AccessReplyPrivate *d_ptr;
Q_DECLARE_PRIVATE(AccessReply)
};
/*!
* @class AbstractAccessControlManager
* Helps filtering incoming Singnon Daemon requests,
* based on security priviledges of the client processes.
* @ingroup Accounts_and_SSO_Framework
*/
class SIGNON_EXPORT AbstractAccessControlManager: public QObject
{
Q_OBJECT
public:
/*!
* Constructs a AbstractAccessControlManager object with the given parent.
* @param parent
*/
explicit AbstractAccessControlManager(QObject *parent = 0);
/*!
* Destructor.
*/
virtual ~AbstractAccessControlManager();
/*!
* Checks if a client process is allowed to access objects with a certain
* security context.
* The access type to be checked depends on the concrete implementation of
* this function.
* @param peerConnection the connection over which the message was sent.
* @param peerMessage, the request message sent over DBUS by the process.
* @param securityContext, the securityContext to be checked against.
* @returns true, if the peer is allowed, false otherwise.
*/
virtual bool isPeerAllowedToAccess(const QDBusConnection &peerConnection,
const QDBusMessage &peerMessage,
const QString &securityContext);
/*!
* Looks up for the application identifier of a specific client process.
* @param peerConnection the connection over which the message was sent.
* @param peerMessage, the request message sent over DBUS by the process.
* @returns the application identifier of the process, or an empty string
* if none found.
*/
virtual QString appIdOfPeer(const QDBusConnection &peerConnection,
const QDBusMessage &peerMessage);
/*!
* @returns the application identifier of the keychain widget
*/
virtual QString keychainWidgetAppId();
/*!
* Asynchronously handle an access request from a client.
* @param request, the AccessRequest describing the requested access.
* @returns an AccessReply object which can be used to obtain the
* asynchronous reply.
*/
virtual AccessReply *handleRequest(const AccessRequest &request);
};
} // namespace
#endif // SIGNON_ABSTRACT_ACCESS_CONTROL_MANAGER_H
signon-8.56+14.04.20140307/lib/signond/SignOn/abstract-crypto-manager.h 0000644 0000152 0177776 00000012300 12306320366 025651 0 ustar pbuser nogroup 0000000 0000000 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of signon
*
* Copyright (C) 2011 Canonical Ltd.
*
* Contact: Alberto Mardegan
*
* 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
*/
/*!
* @file cryptomanager.h
* Definition of the AbstractCryptoManager object.
* @ingroup Accounts_and_SSO_Framework
*/
#ifndef SIGNON_ABSTRACT_CRYPTO_MANAGER_H
#define SIGNON_ABSTRACT_CRYPTO_MANAGER_H
#include "SignOn/abstract-key-manager.h"
#include
#include
#include
namespace SignOn {
class AbstractCryptoManagerPrivate;
/*!
* @class AbstractCryptoManager
* Manages the credentials storage file system encryption. The API is modeled
* after a LUKS-based implementation.
* @ingroup Accounts_and_SSO_Framework
*/
class SIGNON_EXPORT AbstractCryptoManager: public QObject
{
Q_OBJECT
public:
/*!
* Constructs a AbstractCryptoManager object with the given parent.
* @param parent
*/
explicit AbstractCryptoManager(QObject *parent = 0);
/*!
* Destructor.
*/
~AbstractCryptoManager();
/*!
* Sets the encryption key.
* @param key the encrypted file system key.
*/
void setEncryptionKey(const SignOn::Key &key);
/*!
* @return The in use encryption key.
*/
SignOn::Key encryptionKey() const;
/*!
* Initializes the object with the given configuration.
* @param configuration A dictionary of configuration options, dependent on
* the specific crypto-manager implementation.
* @returns true if the configuration is valid.
*/
virtual bool initialize(const QVariantMap &configuration);
/*!
* Sets up an encrypted file system. This method is to be called only at
* the file system creation/foramtting.
* Use mountFileSystem() on subsequent uses. This method handles also the
* mounting so when using it, a call to mountFileSystem() is not necessary.
*
* @returns true if successful, false otherwise.
* @warning this method might format the credentials file system, use
* carefully.
*/
virtual bool setupFileSystem();
/*!
* Deletes the encrypted file system.
* @returns true if successful, false otherwise.
* @warning use this carefully, this will lead to data loss.
*/
virtual bool deleteFileSystem();
/*!
* @returns true if the file system is setup, false otherwise.
*/
bool fileSystemIsSetup() const;
/*!
* Mounts the encrypted file system.
* @returns true if successful, false otherwise.
*/
virtual bool mountFileSystem();
/*!
* Unmounts the encrypted file system.
* @returns true if successful, false otherwise.
*/
virtual bool unmountFileSystem();
/*!
* @returns true if the file system is mounted, false otherwise.
*/
bool fileSystemIsMounted() const;
/*!
* @returns the path of the mounted file system.
*/
virtual QString fileSystemMountPath() const;
/*!
* @returns the list of files which need to be backed up.
*/
virtual QStringList backupFiles() const;
/*!
* @attention if the file system is not mounted and the encryption key can
* access it, this method will cause the file system to be mounted.
* @returns whether the key @key is occupying a keyslot in the encrypted
* file system.
*/
virtual bool encryptionKeyInUse(const SignOn::Key &key);
/*!
* Adds an encryption key to one of the available keyslots of the LUKS
* partition's header.
* @sa encryptionKeyInUse()
* @param key The key to be added/set.
* @param existingKey An already existing key.
* @returns true if succeeded, false otherwise.
*/
virtual bool addEncryptionKey(const SignOn::Key &key,
const SignOn::Key &existingKey);
/*!
* Releases an existing used keyslot in the LUKS partition's header.
* @param key The key to be removed.
* @param remainingKey Another valid key
* @attention The system cannot remain keyless.
* @returns true if succeeded, false otherwise.
*/
virtual bool removeEncryptionKey(const SignOn::Key &key,
const SignOn::Key &remainingKey);
Q_SIGNALS:
void fileSystemMounted();
void fileSystemUnmounting();
protected:
void setFileSystemMounted(bool isMounted);
void setFileSystemSetup(bool isSetup);
private:
AbstractCryptoManagerPrivate *d_ptr;
Q_DECLARE_PRIVATE(AbstractCryptoManager)
};
} //namespace
#endif // SIGNON_ABSTRACT_CRYPTO_MANAGER_H
signon-8.56+14.04.20140307/lib/signond/SignOn/key-handler.h 0000644 0000152 0177776 00000012542 12306320366 023333 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
/*!
* @copyright Copyright (C) 2011 Nokia Corporation.
* @license LGPL
*/
#ifndef SIGNON_KEY_HANDLER_H
#define SIGNON_KEY_HANDLER_H
#include "SignOn/abstract-key-manager.h"
#include
#include
namespace SignOn {
class AbstractCryptoManager;
class KeyHandlerPrivate;
typedef QList KeyManagersList;
/*!
* @class KeyHandler
* @brief Object holding the keys to the secure storage
*
* The KeyHandler is where all keys to the secure storage are held. It provides
* signals to notify when keys are inserted, authorized, removed, disabled, as
* well as methods to authorize and unauthorize keys.
*/
class SIGNON_EXPORT KeyHandler: public QObject
{
Q_OBJECT
public:
enum Authorizations {
None = 0,
FormatStorage = 1 << 0, /*!< Formats the secure storage */
};
Q_DECLARE_FLAGS(AuthorizeFlags, Authorizations);
/*!
* Constructor
*/
explicit KeyHandler(QObject *parent = 0);
/*!
* Destructor
*/
virtual ~KeyHandler();
/*!
* This method initializes the key managers.
*/
void initialize(AbstractCryptoManager *cryptoManager,
const KeyManagersList &keyManagers);
/*!
* @returns The CryptoManager.
*/
AbstractCryptoManager *cryptoManager() const;
/*!
* True if all key managers have been initialized and have started
* reporting their inserted keys.
*/
bool isReady() const;
/*!
* @returns the currently inserted keys.
*/
QSet insertedKeys() const;
/*!
* @param key The key to be tested.
* @returns true if @key is an authorized key.
*/
bool keyIsAuthorized(const SignOn::Key &key) const;
/*!
* Add @key to the list of keys which can be used to access the secure
* storage. If the KeyHandler is empty, this method will fail.
* @param key The key to be authorized.
* @returns true if the operation was successful.
* @sa keyAuthorized()
*/
bool authorizeKey(const SignOn::Key &key, AuthorizeFlags flags = None);
/*!
* Remove @key from the list of keys which can be used to access the
* secure storage. If the KeyHandler is empty, this method will fail.
* @param key The key to be revoked.
* @returns true if the operation was successful.
* @sa keyAuthorizationRevoked()
*/
bool revokeKeyAuthorization(const SignOn::Key &key);
/*!
* Returns true if a new key can be authorized by calling authorizeKey()
* without specifying the FormatStorage flag (that is, if the KeyHandler
* knows other keys which can open the storage).
*/
bool canAddKeyAuthorization() const;
Q_SIGNALS:
/*!
* Emitted after all key managers have been initialized and have reported
* about their inserted keys.
*/
void ready();
/*!
* Emitted when a new key is available. If the key is not yet known to
* signond, signond will call authorizeKey on the key managers before
* accepting it.
* @param key The new key
*/
void keyInserted(const SignOn::Key key);
/*!
* Emitted when a key is disabled. For instance, this signal can be
* emitted when a password expires or when a hardware key is removed.
* This signal will be emitted before the action is processed by the
* KeyHandler; this means that if for instance @key was an authorized key,
* calling keyIsAuthorized() from this signal's handler will still return
* true.
* @param key The key which has been disabled
*/
void keyDisabled(const SignOn::Key key);
/*!
* One of the key managers has asked that @key be removed. This means that
* the key manager will never provide the same key again, so its
* authorization to open the secure storage can be revoked.
* The keyDisabled() signal will always be emitted prior to this one.
* @param key The key which has been removed.
*/
void keyRemoved(const SignOn::Key key);
/*!
* Emitted when a key authorization has been revoked.
* @param key The key whose authorization was revoked.
*/
void keyAuthorizationRevoked(const SignOn::Key key);
/*!
* Emitted when a key has been authorized.
* @param key The key which was authorized.
*/
void keyAuthorized(const SignOn::Key key);
/*!
* Emitted when the last authorized key has been removed.
*/
void lastAuthorizedKeyRemoved(const SignOn::Key key);
private:
KeyHandlerPrivate *d_ptr;
Q_DECLARE_PRIVATE(KeyHandler)
};
} // namespace
#endif // SIGNON_KEY_HANDLER_H
signon-8.56+14.04.20140307/lib/signond/SignOn/SignOnExtension.pc.in 0000644 0000152 0177776 00000000511 12306320366 024773 0 ustar pbuser nogroup 0000000 0000000 prefix=$$INSTALL_PREFIX
exec_prefix=${prefix}
libdir=$$INSTALL_LIBDIR
includedir=${prefix}/include
plugindir=$$SIGNOND_EXTENSIONS_DIR
Name: SignOnExtension
Description: SignOn extension development
Version: $$PROJECT_VERSION
Requires: $${LIBQTCORE}
Libs: -L${libdir} -lsignon-extension
Cflags: -I${includedir}/signon-extension
signon-8.56+14.04.20140307/lib/signond/SignOn/key-handler.cpp 0000644 0000152 0177776 00000020164 12306320366 023665 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "abstract-crypto-manager.h"
#include "debug.h"
#include "key-handler.h"
#include
using namespace SignOn;
namespace SignOn {
class KeyHandlerPrivate: public QObject
{
Q_OBJECT
Q_DECLARE_PUBLIC(KeyHandler)
public:
KeyHandlerPrivate(KeyHandler *handler):
q_ptr(handler),
m_cryptoManager(0)
{
}
~KeyHandlerPrivate() {}
void initialize(AbstractCryptoManager *cryptoManager,
const KeyManagersList &keyManagers);
bool isReady() const
{
return m_readyKeyManagers.count() == m_keyManagers.count();
}
QSet authorizedInsertedKeys() const
{
QSet temp = m_insertedKeys;
return temp.intersect(m_authorizedKeys);
}
const SignOn::Key &anyAuthorizedKey() const
{
return *m_authorizedKeys.constBegin();
}
bool authorizeKey(const SignOn::Key &key, KeyHandler::AuthorizeFlags flags);
bool revokeKeyAuthorization(const SignOn::Key &key);
private Q_SLOTS:
void onKeyInserted(const SignOn::Key key);
void onKeyDisabled(const SignOn::Key key);
void onKeyRemoved(const SignOn::Key key);
private:
mutable KeyHandler *q_ptr;
AbstractCryptoManager *m_cryptoManager;
KeyManagersList m_keyManagers;
KeyManagersList m_readyKeyManagers;
QSet m_insertedKeys;
QSet m_authorizedKeys;
};
};
void KeyHandlerPrivate::initialize(AbstractCryptoManager *cryptoManager,
const KeyManagersList &keyManagers)
{
m_cryptoManager = cryptoManager;
m_keyManagers = keyManagers;
if (keyManagers.isEmpty()) {
TRACE() << "No key manager has been registered";
}
foreach (SignOn::AbstractKeyManager *keyManager, m_keyManagers) {
connect(keyManager,
SIGNAL(keyInserted(const SignOn::Key)),
SLOT(onKeyInserted(const SignOn::Key)));
connect(keyManager,
SIGNAL(keyDisabled(const SignOn::Key)),
SLOT(onKeyDisabled(const SignOn::Key)));
connect(keyManager,
SIGNAL(keyRemoved(const SignOn::Key)),
SLOT(onKeyRemoved(const SignOn::Key)));
keyManager->setup();
}
}
bool KeyHandlerPrivate::authorizeKey(const SignOn::Key &key,
KeyHandler::AuthorizeFlags flags)
{
Q_Q(KeyHandler);
if (m_authorizedKeys.contains(key)) {
BLAME() << "Key already authorized";
return true;
}
if (!m_cryptoManager->fileSystemIsSetup() ||
flags & KeyHandler::FormatStorage) {
m_authorizedKeys.clear();
m_cryptoManager->setEncryptionKey(key);
if (!m_cryptoManager->setupFileSystem()) {
BLAME() << "Failed to setup the encrypted partition";
return false;
}
} else { // FS is created and we must not reformat it
if (m_authorizedKeys.isEmpty()) {
BLAME() << "No authorized keys: cannot add new key";
return false;
}
SignOn::Key authorizedKey = anyAuthorizedKey();
if (!m_cryptoManager->fileSystemIsMounted()) {
m_cryptoManager->setEncryptionKey(authorizedKey);
if (!m_cryptoManager->mountFileSystem()) {
BLAME() << "Couldn't mount FS: cannot add new key";
return false;
}
}
// at this point, the FS is mounted
if (!m_cryptoManager->addEncryptionKey(key, authorizedKey)) {
BLAME() << "Couldn't add new key";
return false;
}
}
m_authorizedKeys.insert(key);
emit q->keyAuthorized(key);
return true;
}
bool KeyHandlerPrivate::revokeKeyAuthorization(const SignOn::Key &key)
{
Q_Q(KeyHandler);
if (!m_cryptoManager->fileSystemIsSetup()) {
TRACE() << "File system is not setup";
return false;
}
if (m_authorizedKeys.isEmpty()) {
BLAME() << "Cannot remove key: no authorized keys";
return false;
}
SignOn::Key authorizedKey = anyAuthorizedKey();
if (!m_cryptoManager->fileSystemIsMounted()) {
m_cryptoManager->setEncryptionKey(authorizedKey);
if (!m_cryptoManager->mountFileSystem()) {
BLAME() << "Couldn't mount FS: cannot remove key";
return false;
}
}
// at this point, the FS is mounted; remove the key
if (!m_cryptoManager->removeEncryptionKey(key, authorizedKey)) {
BLAME() << "Failed to remove key";
return false;
}
TRACE() << "Key successfully removed";
m_authorizedKeys.remove(key);
emit q->keyAuthorizationRevoked(key);
return true;
}
void KeyHandlerPrivate::onKeyInserted(const SignOn::Key key)
{
Q_Q(KeyHandler);
TRACE() << "Key inserted.";
if (!isReady()) {
SignOn::AbstractKeyManager *manager =
qobject_cast(sender());
if (!m_readyKeyManagers.contains(manager)) {
m_readyKeyManagers.append(manager);
if (isReady())
emit q->ready();
}
}
if (key.isEmpty()) return;
m_insertedKeys.insert(key);
if (m_cryptoManager->fileSystemIsSetup()) {
/* The `key in use` check will attempt to mount using the new key if
the file system is not already mounted
*/
if (m_cryptoManager->encryptionKeyInUse(key)) {
TRACE() << "Key already in use.";
if (!m_authorizedKeys.contains(key))
m_authorizedKeys.insert(key);
}
}
emit q->keyInserted(key);
}
void KeyHandlerPrivate::onKeyDisabled(const SignOn::Key key)
{
Q_Q(KeyHandler);
TRACE() << "Key disabled.";
emit q->keyDisabled(key);
m_insertedKeys.remove(key);
/* If no authorized inserted keys left, emit a special notification */
if (authorizedInsertedKeys().isEmpty() &&
m_authorizedKeys.contains(key)) {
emit q->lastAuthorizedKeyRemoved(key);
}
}
void KeyHandlerPrivate::onKeyRemoved(const SignOn::Key key)
{
Q_Q(KeyHandler);
TRACE() << "Key removed.";
// Make sure the key is disabled:
onKeyDisabled(key);
q->keyRemoved(key);
}
KeyHandler::KeyHandler(QObject *parent):
QObject(parent),
d_ptr(new KeyHandlerPrivate(this))
{
}
KeyHandler::~KeyHandler()
{
delete d_ptr;
}
void KeyHandler::initialize(AbstractCryptoManager *cryptoManager,
const KeyManagersList &keyManagers)
{
Q_D(KeyHandler);
d->initialize(cryptoManager, keyManagers);
}
AbstractCryptoManager *KeyHandler::cryptoManager() const
{
Q_D(const KeyHandler);
return d->m_cryptoManager;
}
bool KeyHandler::isReady() const
{
Q_D(const KeyHandler);
return d->isReady();
}
QSet KeyHandler::insertedKeys() const
{
Q_D(const KeyHandler);
return d->m_insertedKeys;
}
bool KeyHandler::keyIsAuthorized(const SignOn::Key &key) const
{
Q_D(const KeyHandler);
return d->m_authorizedKeys.contains(key);
}
bool KeyHandler::authorizeKey(const SignOn::Key &key, AuthorizeFlags flags)
{
Q_D(KeyHandler);
return d->authorizeKey(key, flags);
}
bool KeyHandler::revokeKeyAuthorization(const SignOn::Key &key)
{
Q_D(KeyHandler);
return d->revokeKeyAuthorization(key);
}
bool KeyHandler::canAddKeyAuthorization() const
{
Q_D(const KeyHandler);
return !d->m_authorizedKeys.isEmpty();
}
#include "key-handler.moc"
signon-8.56+14.04.20140307/lib/signond/SignOn/export.h 0000644 0000152 0177776 00000002070 12306320366 022444 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 SIGNON_EXPORT_H
#define SIGNON_EXPORT_H
#include
#ifdef SIGNON_EXPORT
# undef SIGNON_EXPORT
#endif
#ifdef BUILDING_SIGNON
# define SIGNON_EXPORT Q_DECL_EXPORT
#else
# define SIGNON_EXPORT
#endif
#endif // SIGNON_EXPORT_H
signon-8.56+14.04.20140307/lib/signond/SignOn/misc.cpp 0000644 0000152 0177776 00000004111 12306320366 022407 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "debug.h"
#include "export.h"
#include "misc.h"
extern "C" {
#include
#include
#include
}
#include
namespace SignOn {
SIGNON_EXPORT
bool setUserOwnership(const QString &filePath)
{
const char *userHomePath = QDir::homePath().toLatin1().data();
struct stat fileInfo;
if (stat(userHomePath, &fileInfo) != 0)
return false;
QByteArray filePathArray = filePath.toLocal8Bit();
const char *filePathStr = filePathArray.constData();
if (chown(filePathStr, fileInfo.st_uid , fileInfo.st_gid) != 0) {
BLAME() << "chown of" << filePathStr << "failed, errno:" << errno;
return false;
}
return true;
}
SIGNON_EXPORT
bool setFilePermissions(const QString &filePath,
const QFile::Permissions desiredPermissions,
bool keepExisting)
{
if (!QFile::exists(filePath)) return false;
QFile::Permissions newPermissions = desiredPermissions;
QFile file(filePath);
QFile::Permissions initialPermissions = file.permissions();
if (keepExisting)
newPermissions |= initialPermissions;
if (newPermissions != initialPermissions)
return file.setPermissions(newPermissions);
return true;
}
} //SignonDaemonNS
signon-8.56+14.04.20140307/lib/signond/SignOn/abstract-key-authorizer.h 0000644 0000152 0177776 00000006673 12306320366 025723 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
/*!
* @copyright Copyright (C) 2011 Nokia Corporation.
* @license LGPL
*/
#ifndef SIGNON_ABSTRACT_KEY_AUTHORIZER_H
#define SIGNON_ABSTRACT_KEY_AUTHORIZER_H
#include "SignOn/abstract-key-manager.h"
#include "SignOn/key-handler.h"
#include
namespace SignOn {
class AbstractKeyAuthorizerPrivate;
/*!
* @class AbstractKeyAuthorizer
* @brief Object holding the keys to the secure storage
*
* The AbstractKeyAuthorizer is where all keys to the secure storage are held.
* It provides signals to notify when keys are inserted, authorized, removed,
* disabled, as well as methods to authorize and unauthorize keys.
*/
class SIGNON_EXPORT AbstractKeyAuthorizer: public QObject
{
Q_OBJECT
public:
enum Result {
Denied = 0, /*!< Key should not be added to the keyring */
Approved, /*!< Key can be added to the keyring */
Exclusive, /*!< Key can be set as the only key in the ring */
};
/*!
* @enum Reason
* Flags specifying why signond is asking for authorizing a key.
* @sa queryKeyAuthorization
*/
enum Reasons {
SystemStarted = 1 << 0,
KeyInserted = 1 << 1,
StorageNeeded = 1 << 2,
};
Q_DECLARE_FLAGS(Reason, Reasons);
/*!
* Constructor
*/
explicit AbstractKeyAuthorizer(KeyHandler *keyHandler,
QObject *parent = 0);
/*!
* Destructor
*/
virtual ~AbstractKeyAuthorizer();
/*!
* @returns the KeyHandler object.
*/
KeyHandler *keyHandler() const;
/*!
* This method is called by signond when a decision needs to be taken
* on whether @key should be added to the list of keys authorized to
* access the secure storage.
* The result is delivered asynchronously through the
* keyAuthorizationQueried() signal.
* @note This method doesn't effectively add @key to the secure storage
* keyring; it simply asks whether @key should be authorized or not.
*
* @param key The key for which authorization is asked.
* @sa keyAuthorizationQueried()
*/
virtual void queryKeyAuthorization(const SignOn::Key &key, Reason reason);
Q_SIGNALS:
/*!
* Emitted to deliver an asynchronous response to the
* queryKeyAuthorization() method.
* @param key The key whose authorization has been queried.
* @param result The result of the query, as specified by the Result enum.
*/
void keyAuthorizationQueried(const SignOn::Key key, int result);
private:
AbstractKeyAuthorizerPrivate *d_ptr;
Q_DECLARE_PRIVATE(AbstractKeyAuthorizer)
};
} // namespace
#endif // SIGNON_ABSTRACT_KEY_AUTHORIZER_H
signon-8.56+14.04.20140307/lib/signond/SignOn/AbstractKeyAuthorizer 0000644 0000152 0177776 00000000055 12306320366 025167 0 ustar pbuser nogroup 0000000 0000000 #include
signon-8.56+14.04.20140307/lib/signond/SignOn/SignOn.pro 0000644 0000152 0177776 00000000067 12306320366 022675 0 ustar pbuser nogroup 0000000 0000000 TEMPLATE = subdirs
SUBDIRS = \
SignOnExtension.pro
signon-8.56+14.04.20140307/lib/signond/SignOn/KeyHandler 0000644 0000152 0177776 00000000041 12306320366 022717 0 ustar pbuser nogroup 0000000 0000000 #include
signon-8.56+14.04.20140307/lib/signond/SignOn/debug.cpp 0000644 0000152 0177776 00000002024 12306320366 022543 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
#include "debug.h"
using namespace SignOn;
SIGNON_EXPORT int signonLoggingLevel = 1; // criticals
namespace SignOn {
SIGNON_EXPORT void setLoggingLevel(int level)
{
signonLoggingLevel = level;
}
}; // namespace
signon-8.56+14.04.20140307/lib/signond/SignOn/ExtensionInterface 0000644 0000152 0177776 00000000051 12306320366 024467 0 ustar pbuser nogroup 0000000 0000000 #include
signon-8.56+14.04.20140307/lib/signond/SignOn/AbstractAccessControlManager 0000644 0000152 0177776 00000000065 12306320366 026420 0 ustar pbuser nogroup 0000000 0000000 #include
signon-8.56+14.04.20140307/lib/signond/SignOn/AbstractKeyManager 0000644 0000152 0177776 00000000052 12306320366 024402 0 ustar pbuser nogroup 0000000 0000000 #include
signon-8.56+14.04.20140307/lib/signond/SignOn/extension-interface.h 0000644 0000152 0177776 00000010467 12306320366 025106 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2010-2011 Nokia Corporation.
* Copyright (C) 2011 Canonical Ltd.
* Copyright (C) 2011 Intel Corporation.
*
* Contact: Alberto Mardegan
* Contact: Jussi Laako
*
* 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
*/
/*!
* @copyright Copyright (C) 2009-2011 Nokia Corporation.
* @license LGPL
*/
#ifndef SIGNON_EXTENSION_INTERFACE_H
#define SIGNON_EXTENSION_INTERFACE_H
#include
#include
#include
namespace SignOn {
class AbstractCryptoManager;
class AbstractKeyAuthorizer;
class AbstractKeyManager;
class AbstractSecretsStorage;
class KeyHandler;
class AbstractAccessControlManager;
/*!
* @class ExtensionInterface.
* Interface definition for signond extensions.
*/
class SIGNON_EXPORT ExtensionInterface
{
public:
virtual ~ExtensionInterface() {}
/*!
* Gets the KeyManager object.
*
* @return A key manager object, or 0 if none is provided by this plugin
*/
virtual AbstractKeyManager *keyManager(QObject *parent = 0) const;
};
/*!
* @class ExtensionInterface2.
* Interface definition for signond extensions.
*/
class SIGNON_EXPORT ExtensionInterface2: public ExtensionInterface
{
public:
virtual ~ExtensionInterface2() {}
/*!
* Gets the KeyAuthorizer object.
*
* @return A key authorizer object, or 0 if none is provided by this plugin
*/
virtual AbstractKeyAuthorizer *keyAuthorizer(KeyHandler *keyHandler,
QObject *parent = 0) const;
};
/*!
* @class ExtensionInterface3.
* Interface definition for signond extensions.
*/
class SIGNON_EXPORT ExtensionInterface3: public ExtensionInterface2
{
public:
virtual ~ExtensionInterface3() {}
/*!
* Gets the CryptoManager object, which will be used to setup the file
* system for the credentials storage.
* This object is instantiated only if the value of the "CryptoManager"
* setting in the signond configuration matches the plugin's
* QObject::objectName().
*
* @return A CryptoManager object, or 0 if none is provided by this plugin
*/
virtual AbstractCryptoManager *cryptoManager(QObject *parent = 0) const;
/*!
* Gets the SecretsStorage object, which is used to save and load the
* user's secrets, as well as authentication plugins' data.
* This object is instantiated only if the value of the "SecretsStorage"
* setting in the signond configuration matches the plugin's
* QObject::objectName().
*
* @return A SecretsStorage object, or 0 if none is provided by this plugin.
*/
virtual AbstractSecretsStorage *secretsStorage(QObject *parent = 0) const;
/*!
* Gets the AbstractAccessControlManager object, which will be used to
* check accesses to the credential database.
* This object is instantiated only if the value of the
* "AccessControlManager" setting in the signond configuration matches the
* plugin's QObject::objectName().
*
* @return An AbstractAccessControlManager object, or 0 if none is provided
* by this plugin
*/
virtual AbstractAccessControlManager *accessControlManager(
QObject *parent = 0) const;
};
} // namespace
Q_DECLARE_INTERFACE(SignOn::ExtensionInterface,
"com.nokia.SingleSignOn.ExtensionInterface/1.0")
Q_DECLARE_INTERFACE(SignOn::ExtensionInterface2,
"com.nokia.SingleSignOn.ExtensionInterface/2.0")
Q_DECLARE_INTERFACE(SignOn::ExtensionInterface3,
"com.nokia.SingleSignOn.ExtensionInterface/3.0")
#endif // SIGNON_EXTENSION_INTERFACE_H
signon-8.56+14.04.20140307/lib/signond/SignOn/debug.h 0000644 0000152 0177776 00000003602 12306320366 022213 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2011 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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 SIGNON_DEBUG_H
#define SIGNON_DEBUG_H
#include
#ifdef SIGNON_TRACE
#ifdef TRACE
#undef TRACE
#endif
#ifdef BLAME
#undef BLAME
#endif
#include
#ifdef DEBUG_ENABLED
/* 0 - fatal, 1 - critical(default), 2 - info/debug */
extern int signonLoggingLevel;
static inline bool debugEnabled()
{
return signonLoggingLevel >= 2;
}
static inline bool criticalsEnabled()
{
return signonLoggingLevel >= 1;
}
#define TRACE() \
if (debugEnabled()) qDebug() << __FILE__ << __LINE__ << __func__
#define BLAME() \
if (criticalsEnabled()) qCritical() << __FILE__ << __LINE__ << __func__
#else
static inline bool debugEnabled() { return false; }
static inline bool criticalsEnabled() { return false; }
#define TRACE() while (0) qDebug()
#define BLAME() while (0) qDebug()
#endif
#endif
namespace SignOn {
void setLoggingLevel(int level);
};
#endif // SIGNON_DEBUG_H
signon-8.56+14.04.20140307/lib/signond/SignOn/abstract-key-manager.h 0000644 0000152 0177776 00000013146 12306320366 025132 0 ustar pbuser nogroup 0000000 0000000 /*
* This file is part of signon
*
* Copyright (C) 2010 Nokia Corporation.
*
* Contact: Alberto Mardegan
*
* 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
*/
/*!
* @copyright Copyright (C) 2009-2011 Nokia Corporation.
* @license LGPL
*/
#ifndef SIGNON_ABSTRACT_KEY_MANAGER_H
#define SIGNON_ABSTRACT_KEY_MANAGER_H
#include
#include
#include