KAuth

AuthBackend.h
1 /*
2  SPDX-FileCopyrightText: 2008 Nicola Gigante <[email protected]>
3  SPDX-FileCopyrightText: 2009-2010 Dario Freddi <[email protected]>
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 
15 namespace KAuth
16 {
17 typedef Action::DetailsMap DetailsMap;
18 
19 class AuthBackend : public QObject
20 {
21  Q_OBJECT
22  Q_DISABLE_COPY(AuthBackend)
23 
24 public:
25  enum Capability {
26  NoCapability = 0,
27  AuthorizeFromClientCapability = 1,
28  AuthorizeFromHelperCapability = 2,
29  CheckActionExistenceCapability = 4,
30  PreAuthActionCapability = 8,
31  };
32  Q_DECLARE_FLAGS(Capabilities, Capability)
33 
34  enum ExtraCallerIDVerificationMethod {
35  NoExtraCallerIDVerificationMethod,
36  VerifyAgainstDBusServiceName,
37  VerifyAgainstDBusServicePid,
38  };
39 
40  AuthBackend();
41  ~AuthBackend() override;
42  virtual void setupAction(const QString &action) = 0;
43  virtual void preAuthAction(const QString &action, QWidget *parent);
44  virtual Action::AuthStatus authorizeAction(const QString &action) = 0;
45  virtual Action::AuthStatus actionStatus(const QString &action) = 0;
46  virtual QByteArray callerID() const = 0;
47  virtual ExtraCallerIDVerificationMethod extraCallerIDVerificationMethod() const;
48  virtual bool isCallerAuthorized(const QString &action, const QByteArray &callerID, const QVariantMap &details) = 0;
49  virtual bool actionExists(const QString &action);
50  virtual QVariantMap backendDetails(const DetailsMap &details);
51 
52  Capabilities capabilities() const;
53 
54 protected:
55  void setCapabilities(Capabilities capabilities);
56 
57 Q_SIGNALS:
58  void actionStatusChanged(const QString &action, KAuth::Action::AuthStatus status);
59 
60 private:
61  class Private;
62  Private *const d;
63 };
64 
65 Q_DECLARE_OPERATORS_FOR_FLAGS(AuthBackend::Capabilities)
66 
67 } // namespace Auth
68 
69 Q_DECLARE_INTERFACE(KAuth::AuthBackend, "org.kde.kf5auth.AuthBackend/0.1")
70 
71 #endif
Q_OBJECTQ_OBJECT
QFlags< Capability > Capabilities
AuthStatus
The three values set by authorization methods.
Definition: action.h:82
KCONFIGCORE_EXPORT bool authorizeAction(const QString &action)
Q_SCRIPTABLE CaptureState status()
QMap< AuthDetail, QVariant > DetailsMap
Map of details.
Definition: action.h:110
Q_SIGNALSQ_SIGNALS
Definition: action.cpp:18
Capabilities capabilities()
Q_DISABLE_COPY(Class)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 6 2023 04:14:27 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.