authsession.cpp
1 /*
2  * This file is part of signon
3  *
4  * Copyright (C) 2009-2010 Nokia Corporation.
5  *
6  * Contact: Aurel Popirtac <ext-aurel.popirtac@nokia.com>
7  * Contact: Alberto Mardegan <alberto.mardegan@canonical.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public License
11  * version 2.1 as published by the Free Software Foundation.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21  * 02110-1301 USA
22  */
23 
24 #include <QObject>
25 #include <QMetaType>
26 
27 #include "libsignoncommon.h"
28 #include "authsession.h"
29 #include "authsessionimpl.h"
30 
31 
32 namespace SignOn {
33 
34 AuthSession::AuthSession(quint32 id, const QString &methodName,
35  QObject *parent):
36  QObject(parent),
37  impl(new AuthSessionImpl(this, id, methodName))
38 {
39  qRegisterMetaType<SessionData>("SessionData");
40  qRegisterMetaType<AuthSessionState>("AuthSession::AuthSessionState");
41 
42  if (qMetaTypeId<SessionData>() < QMetaType::User)
43  BLAME() << "AuthSession::AuthSession() - "
44  "SessionData meta type not registered.";
45 
46  if (qMetaTypeId<AuthSessionState>() < QMetaType::User)
47  BLAME() << "AuthSession::AuthSession() - "
48  "AuthSessionState meta type not registered.";
49 
50 }
51 
52 AuthSession::~AuthSession()
53 {
54  delete impl;
55 }
56 
57 const QString AuthSession::name() const
58 {
59  return impl->name();
60 }
61 
62 void AuthSession::queryAvailableMechanisms(const QStringList &wantedMechanisms)
63 {
64  impl->queryAvailableMechanisms(wantedMechanisms);
65 }
66 
67 void AuthSession::process(const SessionData& sessionData,
68  const QString &mechanism)
69 {
70  impl->process(sessionData, mechanism);
71 }
72 
74 {
75  impl->cancel();
76 }
77 
78 } //namespace SignOn
void cancel()
Cancels the ongoing challenge.
Definition: authsession.cpp:73
Data container to hold values for authentication session.
Definition: sessiondata.h:90
const QString name() const
Name of method for session.
Definition: authsession.cpp:57
void process(const SessionData &sessionData, const QString &mechanism=QString())
Processes sessionData in the authentication service.
Definition: authsession.cpp:67
AuthSession(quint32 id, const QString &methodName, QObject *parent=0)
Definition: authsession.cpp:34
void queryAvailableMechanisms(const QStringList &wantedMechanisms=QStringList())
Query list of available mechanisms.
Definition: authsession.cpp:62