1/*
2 SPDX-FileCopyrightText: 2008 Nicola Gigante <nicola.gigante@gmail.com>
3 SPDX-FileCopyrightText: 2009-2010 Dario Freddi <drf@kde.org>
4
5 SPDX-License-Identifier: LGPL-2.1-or-later
6*/
7
8#ifndef KAUTH_AUTH_BACKEND_H
9#define KAUTH_AUTH_BACKEND_H
10
11#include <QObject>
12
13#include "action.h"
14
15namespace KAuth
16{
17typedef Action::DetailsMap DetailsMap;
18
19class AuthBackend : public QObject
20{
21 Q_OBJECT
22 Q_DISABLE_COPY(AuthBackend)
23
24public:
25 enum Capability {
26 NoCapability = 0,
27 AuthorizeFromClientCapability = 1,
28 AuthorizeFromHelperCapability = 2,
29 PreAuthActionCapability = 4,
30 };
31 Q_DECLARE_FLAGS(Capabilities, Capability)
32
33 AuthBackend();
34 ~AuthBackend() override;
35 virtual void setupAction(const QString &action) = 0;
36 virtual void preAuthAction(const QString &action, QWindow *parent);
37 virtual Action::AuthStatus authorizeAction(const QString &action) = 0;
38 virtual Action::AuthStatus actionStatus(const QString &action) = 0;
39 virtual QByteArray callerID() const = 0;
40 virtual bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details) = 0;
41 virtual QVariantMap backendDetails(const DetailsMap &details);
42
43 Capabilities capabilities() const;
44
45protected:
46 void setCapabilities(Capabilities capabilities);
47
48Q_SIGNALS:
49 void actionStatusChanged(const QString &action, KAuth::Action::AuthStatus status);
50
51private:
52 class Private;
53 Private *const d;
54};
55
56Q_DECLARE_OPERATORS_FOR_FLAGS(AuthBackend::Capabilities)
57
58} // namespace Auth
59
60Q_DECLARE_INTERFACE(KAuth::AuthBackend, "org.kde.kf6auth.AuthBackend/0.1")
61
62#endif
63

source code of kauth/src/AuthBackend.h