signon
8.58
|
00001 /* 00002 * This file is part of signon 00003 * 00004 * Copyright (C) 2009-2010 Nokia Corporation. 00005 * Copyright (C) 2012-2013 Canonical Ltd. 00006 * 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 #ifndef SIGNONAUTHSESSION_H_ 00025 #define SIGNONAUTHSESSION_H_ 00026 00027 #include <QtCore> 00028 #include <QtDBus> 00029 00030 /* 00031 * TODO: remove invocation of plugin operations into the main signond process 00032 */ 00033 #include "signond-common.h" 00034 #include "signonsessioncore.h" 00035 00036 using namespace SignOn; 00037 00038 namespace SignonDaemonNS { 00039 00045 class SignonAuthSession: public QObject, protected QDBusContext 00046 { 00047 Q_OBJECT 00048 00049 public: 00050 inline SignonSessionCore *parent() const 00051 { 00052 return static_cast<SignonSessionCore *>(QObject::parent()); 00053 } 00054 00055 friend class SignonAuthSessionAdaptor; 00056 00057 static SignonAuthSession *createAuthSession(const quint32 id, 00058 const QString &method, 00059 SignonDaemon *parent, 00060 pid_t ownerPid); 00061 static void stopAllAuthSessions(); 00062 quint32 id() const; 00063 QString method() const; 00064 pid_t ownerPid() const; 00065 00066 public Q_SLOTS: 00067 QStringList queryAvailableMechanisms(const QStringList &wantedMechanisms); 00068 QVariantMap process(const QVariantMap &sessionDataVa, 00069 const QString &mechanism); 00070 void cancel(); 00071 void setId(quint32 id); 00072 void objectUnref(); 00073 00074 Q_SIGNALS: 00075 void stateChanged(int state, const QString &message); 00076 void unregistered(); 00077 00078 private Q_SLOTS: 00079 void stateChangedSlot(const QString &sessionKey, 00080 int state, 00081 const QString &message); 00082 00083 protected: 00084 SignonAuthSession(quint32 id, const QString &method, pid_t ownerPid); 00085 virtual ~SignonAuthSession(); 00086 00087 private: 00088 quint32 m_id; 00089 QString m_method; 00090 pid_t m_ownerPid; 00091 00092 Q_DISABLE_COPY(SignonAuthSession) 00093 }; //class SignonDaemon 00094 00095 } //namespace SignonDaemonNS 00096 00097 #endif //SIGNONAUTHSESSION_H_