|
signon
8.40
|
00001 /* 00002 * This file is part of signon 00003 * 00004 * Copyright (C) 2009-2010 Nokia Corporation. 00005 * Copyright (C) 2012 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 QString getAuthSessionObjectPath(const quint32 id, 00058 const QString &method, 00059 SignonDaemon *parent, 00060 bool &supportsAuthMethod, 00061 pid_t ownerPid); 00062 static void stopAllAuthSessions(); 00063 quint32 id() const; 00064 QString method() const; 00065 void objectRegistered(); 00066 pid_t ownerPid() const; 00067 00068 public Q_SLOTS: 00069 QStringList queryAvailableMechanisms(const QStringList &wantedMechanisms); 00070 QVariantMap process(const QVariantMap &sessionDataVa, 00071 const QString &mechanism); 00072 void cancel(); 00073 void setId(quint32 id); 00074 void objectUnref(); 00075 00076 Q_SIGNALS: 00077 void stateChanged(int state, const QString &message); 00078 void unregistered(); 00079 00080 private Q_SLOTS: 00081 void stateChangedSlot(const QString &sessionKey, 00082 int state, 00083 const QString &message); 00084 00085 protected: 00086 SignonAuthSession(quint32 id, const QString &method, pid_t ownerPid); 00087 virtual ~SignonAuthSession(); 00088 00089 private: 00090 quint32 m_id; 00091 QString m_method; 00092 bool m_registered; 00093 pid_t m_ownerPid; 00094 00095 Q_DISABLE_COPY(SignonAuthSession) 00096 }; //class SignonDaemon 00097 00098 } //namespace SignonDaemonNS 00099 00100 #endif //SIGNONAUTHSESSION_H_