authsession.cpp
00001 /*
00002  * This file is part of signon
00003  *
00004  * Copyright (C) 2009-2010 Nokia Corporation.
00005  *
00006  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
00007  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public License
00011  * version 2.1 as published by the Free Software Foundation.
00012  *
00013  * This library is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00016  * Lesser General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU Lesser General Public
00019  * License along with this library; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
00021  * 02110-1301 USA
00022  */
00023 
00024 #include <QObject>
00025 #include <QMetaType>
00026 
00027 #include "libsignoncommon.h"
00028 #include "authsession.h"
00029 #include "authsessionimpl.h"
00030 
00031 
00032 namespace SignOn {
00033 
00034 AuthSession::AuthSession(quint32 id, const QString &methodName,
00035                          QObject *parent):
00036     QObject(parent),
00037     impl(new AuthSessionImpl(this, id, methodName))
00038 {
00039     qRegisterMetaType<SessionData>("SessionData");
00040     qRegisterMetaType<AuthSessionState>("AuthSession::AuthSessionState");
00041 
00042     if (qMetaTypeId<SessionData>() < QMetaType::User)
00043         BLAME() << "AuthSession::AuthSession() - "
00044             "SessionData meta type not registered.";
00045 
00046     if (qMetaTypeId<AuthSessionState>() < QMetaType::User)
00047         BLAME() << "AuthSession::AuthSession() - "
00048             "AuthSessionState meta type not registered.";
00049 
00050 }
00051 
00052 AuthSession::~AuthSession()
00053 {
00054     delete impl;
00055 }
00056 
00057 const QString AuthSession::name() const
00058 {
00059     return impl->name();
00060 }
00061 
00062 void AuthSession::queryAvailableMechanisms(const QStringList &wantedMechanisms)
00063 {
00064     impl->queryAvailableMechanisms(wantedMechanisms);
00065 }
00066 
00067 void AuthSession::process(const SessionData& sessionData,
00068                           const QString &mechanism)
00069 {
00070     impl->process(sessionData, mechanism);
00071 }
00072 
00073 void AuthSession::cancel()
00074 {
00075     impl->cancel();
00076 }
00077 
00078 } //namespace SignOn