2
* Copyright (C) 2014 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Author : Arto Jalkanen <ajalkane@gmail.com>
19
#ifndef PAMAUTHENTICATION_H
20
#define PAMAUTHENTICATION_H
23
#include <QAbstractListModel>
24
#include <QStandardPaths>
27
// Forward declarations
32
// TODO: documentation
33
class PamAuthentication : public QObject
38
explicit PamAuthentication(QObject *parent = 0);
41
Q_INVOKABLE bool requireAuthentication();
43
Q_INVOKABLE bool validatePasswordToken(const QString &token);
45
Q_PROPERTY(QString serviceName READ serviceName WRITE setServiceName NOTIFY serviceNameChanged)
46
inline const QString &serviceName() const {
50
void setServiceName(const QString &serviceName);
52
void serviceNameChanged();
56
static int ConversationFunction(int num_msg,
57
const pam_message** msg,
61
bool initPam(pam_handle **pamHandle);
62
int validateAccount(pam_handle *pamHandle);
64
QString m_passwordToken;
65
QString m_serviceName;
69
#endif // PAMAUTHENTICATION_H