trust-store  1.1.0
Provides a common implementation of a trust store to be used by trusted helpers.
agent.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
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 Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Voß <thomas.voss@canonical.com>
17  */
18 
19 #ifndef CORE_TRUST_AGENT_H_
20 #define CORE_TRUST_AGENT_H_
21 
22 #include <core/trust/request.h>
24 #include <core/trust/visibility.h>
25 
26 #include <cstdint>
27 
28 namespace core
29 {
30 namespace trust
31 {
34 {
35 public:
37  Agent() = default;
38  virtual ~Agent() = default;
39 
40  Agent(const Agent&) = delete;
41  Agent(Agent&&) = delete;
42  Agent& operator=(const Agent&) = delete;
43  Agent& operator=(Agent&&) = delete;
47  struct Registry
48  {
50  typedef std::shared_ptr<Registry> Ptr;
51 
53  Registry() = default;
54  virtual ~Registry() = default;
58  virtual void register_agent_for_user(const core::trust::Uid& uid, const std::shared_ptr<core::trust::Agent>& agent) = 0;
59 
61  virtual void unregister_agent_for_user(const core::trust::Uid& uid) = 0;
62  };
63 
66  {
68  struct
69  {
75  std::string id;
76  } application;
80  std::string description;
81  };
82 
87  virtual Request::Answer authenticate_request_with_parameters(const RequestParameters& parameters) = 0;
88 };
89 
92 }
93 }
94 
95 #endif // CORE_TRUST_AGENT_H_
Abstracts functionality for storing agent instances and associating them with a user id...
Definition: agent.h:47
std::string description
An extended description that should be presented to the user on prompting.
Definition: agent.h:80
Feature feature
The service-specific feature identifier.
Definition: agent.h:78
std::string id
The id of the requesting application.
Definition: agent.h:75
core::trust::Pid pid
The process id of the requesting application.
Definition: agent.h:73
Definition: agent.h:28
core::trust::Uid uid
The user id under which the requesting application runs.
Definition: agent.h:71
Answer
Enumerates the possible answers given by a user.
Definition: request.h:65
Abstracts user-prompting functionality.
Definition: agent.h:33
Summarizes all parameters for processing a trust request.
Definition: agent.h:65
CORE_TRUST_DLL_PUBLIC bool operator==(const Agent::RequestParameters &lhs, const Agent::RequestParameters &rhs)
Returns true iff lhs and rhs are equal.
std::shared_ptr< Registry > Ptr
Convenience typedef for a shared ptr.
Definition: agent.h:50
#define CORE_TRUST_DLL_PUBLIC
Definition: visibility.h:26