signon  8.58
signonauthsession.h
Go to the documentation of this file.
1 /*
2  * This file is part of signon
3  *
4  * Copyright (C) 2009-2010 Nokia Corporation.
5  * Copyright (C) 2012-2013 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 #ifndef SIGNONAUTHSESSION_H_
25 #define SIGNONAUTHSESSION_H_
26 
27 #include <QtCore>
28 #include <QtDBus>
29 
30 /*
31  * TODO: remove invocation of plugin operations into the main signond process
32  */
33 #include "signond-common.h"
34 #include "signonsessioncore.h"
35 
36 using namespace SignOn;
37 
38 namespace SignonDaemonNS {
39 
45 class SignonAuthSession: public QObject, protected QDBusContext
46 {
47  Q_OBJECT
48 
49 public:
50  inline SignonSessionCore *parent() const
51  {
52  return static_cast<SignonSessionCore *>(QObject::parent());
53  }
54 
56 
57  static SignonAuthSession *createAuthSession(const quint32 id,
58  const QString &method,
59  SignonDaemon *parent,
60  pid_t ownerPid);
61  static void stopAllAuthSessions();
62  quint32 id() const;
63  QString method() const;
64  pid_t ownerPid() const;
65 
66 public Q_SLOTS:
67  QStringList queryAvailableMechanisms(const QStringList &wantedMechanisms);
68  QVariantMap process(const QVariantMap &sessionDataVa,
69  const QString &mechanism);
70  void cancel();
71  void setId(quint32 id);
72  void objectUnref();
73 
74 Q_SIGNALS:
75  void stateChanged(int state, const QString &message);
76  void unregistered();
77 
78 private Q_SLOTS:
79  void stateChangedSlot(const QString &sessionKey,
80  int state,
81  const QString &message);
82 
83 protected:
84  SignonAuthSession(quint32 id, const QString &method, pid_t ownerPid);
85  virtual ~SignonAuthSession();
86 
87 private:
88  quint32 m_id;
89  QString m_method;
90  pid_t m_ownerPid;
91 
92  Q_DISABLE_COPY(SignonAuthSession)
93 }; //class SignonDaemon
94 
95 } //namespace SignonDaemonNS
96 
97 #endif //SIGNONAUTHSESSION_H_
Daemon side representation of authentication session.
Daemon side representation of authentication session.
SignonSessionCore * parent() const
RemotePluginProcess * process
Definition: main.cpp:43