trust-store  2.0.0
Provides a common implementation of a trust store to be used by trusted helpers.
cached_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_CACHED_AGENT_H_
20 #define CORE_TRUST_CACHED_AGENT_H_
21 
22 #include <core/trust/agent.h>
23 
24 namespace core
25 {
26 namespace trust
27 {
30 {
31 public:
33  typedef std::shared_ptr<CachedAgent> Ptr;
34 
36  struct Reporter
37  {
39  Reporter() = default;
40  virtual ~Reporter() = default;
44  virtual void report_cached_answer_found(const core::trust::Agent::RequestParameters&, const core::trust::Request&);
45 
47  virtual void report_user_prompted_for_trust(const core::trust::Agent::RequestParameters&, const core::trust::Request::Answer&);
48  };
49 
52  {
54  std::shared_ptr<Agent> agent;
56  std::shared_ptr<Store> store;
58  std::shared_ptr<Reporter> reporter;
59  };
60 
66  CachedAgent(const Configuration& configuration);
68  virtual ~CachedAgent() = default;
72  Request::Answer authenticate_request_with_parameters(const core::trust::Agent::RequestParameters& parameters) override;
73 
74 private:
76  Configuration configuration;
77 };
78 }
79 }
80 
81 #endif // CORE_TRUST_CACHED_AGENT_H_
std::shared_ptr< Reporter > reporter
The reporter implementation.
Definition: cached_agent.h:58
Abstract capturer of internal events for post-mortem debugging/analysis purposes. ...
Definition: cached_agent.h:36
The Request struct encapsulates information about a trust request answered by the user...
Definition: request.h:54
Definition: agent.h:28
std::shared_ptr< Agent > agent
The actual agent implementation for prompting the user.
Definition: cached_agent.h:54
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
std::shared_ptr< CachedAgent > Ptr
To save some typing.
Definition: cached_agent.h:33
An agent implementation that uses a trust store instance to cache results.
Definition: cached_agent.h:29
std::shared_ptr< Store > store
The store caching user answers to trust prompts.
Definition: cached_agent.h:56
Creation time parameters.
Definition: cached_agent.h:51
#define CORE_TRUST_DLL_PUBLIC
Definition: visibility.h:26