My Project
authsession.cpp
1 /*
2  * This file is part of signon
3  *
4  * Copyright (C) 2009-2010 Nokia Corporation.
5  * Copyright (C) 2011-2016 Canonical Ltd.
6  *
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 #include "debug.h"
31 
32 
33 namespace SignOn {
34 
35 AuthSession::AuthSession(quint32 id, const QString &methodName,
36  QObject *parent):
37  QObject(parent),
38  impl(new AuthSessionImpl(this, id, methodName))
39 {
40  initDebug();
41 
42  qRegisterMetaType<SessionData>("SessionData");
43  qRegisterMetaType<AuthSessionState>("AuthSession::AuthSessionState");
44 
45  if (qMetaTypeId<SessionData>() < QMetaType::User)
46  BLAME() << "AuthSession::AuthSession() - "
47  "SessionData meta type not registered.";
48 
49  if (qMetaTypeId<AuthSessionState>() < QMetaType::User)
50  BLAME() << "AuthSession::AuthSession() - "
51  "AuthSessionState meta type not registered.";
52 
53 }
54 
55 AuthSession::~AuthSession()
56 {
57  delete impl;
58 }
59 
60 const QString AuthSession::name() const
61 {
62  return impl->name();
63 }
64 
65 void AuthSession::queryAvailableMechanisms(const QStringList &wantedMechanisms)
66 {
67  impl->queryAvailableMechanisms(wantedMechanisms);
68 }
69 
70 void AuthSession::process(const SessionData& sessionData,
71  const QString &mechanism)
72 {
73  impl->process(sessionData, mechanism);
74 }
75 
77 {
78  impl->cancel();
79 }
80 
81 } //namespace SignOn
const QString name() const
Name of method for session.
Definition: authsession.cpp:60
void queryAvailableMechanisms(const QStringList &wantedMechanisms=QStringList())
Query list of available mechanisms.
Definition: authsession.cpp:65
void process(const SessionData &sessionData, const QString &mechanism=QString())
Processes sessionData in the authentication service.
Definition: authsession.cpp:70
void cancel()
Cancels the ongoing challenge.
Definition: authsession.cpp:76
AuthSession(quint32 id, const QString &methodName, QObject *parent=0)
Definition: authsession.cpp:35
Data container to hold values for authentication session.
Definition: sessiondata.h:92