cached_agent.h
Go to the documentation of this file.
/*
* Copyright © 2014 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License version 3,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Thomas Voß <thomas.voss@canonical.com>
*/
#ifndef CORE_TRUST_CACHED_AGENT_H_
#define CORE_TRUST_CACHED_AGENT_H_
#include <core/trust/agent.h>
namespace core
{
namespace trust
{
class CORE_TRUST_DLL_PUBLIC CachedAgent : public core::trust::Agent
{
public:
typedef std::shared_ptr<CachedAgent> Ptr;
struct Reporter
{
Reporter() = default;
virtual ~Reporter() = default;
virtual void report_cached_answer_found(const core::trust::Agent::RequestParameters&, const core::trust::Request&);
virtual void report_user_prompted_for_trust(const core::trust::Agent::RequestParameters&, const core::trust::Request::Answer&);
};
struct Configuration
{
std::shared_ptr<Agent> agent;
std::shared_ptr<Store> store;
std::shared_ptr<Reporter> reporter;
};
CachedAgent(const Configuration& configuration);
virtual ~CachedAgent() = default;
Request::Answer authenticate_request_with_parameters(const core::trust::Agent::RequestParameters& parameters) override;
private:
Configuration configuration;
};
}
}
#endif // CORE_TRUST_CACHED_AGENT_H_
core::trust::CachedAgent::Configuration::reporter
std::shared_ptr< Reporter > reporter
The reporter implementation.
Definition: cached_agent.h:58
core::trust::CachedAgent::Reporter
Abstract capturer of internal events for post-mortem debugging/analysis purposes. ...
Definition: cached_agent.h:36
core::trust::Request
The Request struct encapsulates information about a trust request answered by the user...
Definition: request.h:54
core
Definition: agent.h:28
core::trust::CachedAgent::Configuration::agent
std::shared_ptr< Agent > agent
The actual agent implementation for prompting the user.
Definition: cached_agent.h:54
core::trust::Request::Answer
Answer
Enumerates the possible answers given by a user.
Definition: request.h:65
core::trust::Agent
Abstracts user-prompting functionality.
Definition: agent.h:33
core::trust::Agent::RequestParameters
Summarizes all parameters for processing a trust request.
Definition: agent.h:65
core::trust::CachedAgent::Ptr
std::shared_ptr< CachedAgent > Ptr
To save some typing.
Definition: cached_agent.h:33
core::trust::CachedAgent
An agent implementation that uses a trust store instance to cache results.
Definition: cached_agent.h:29
core::trust::CachedAgent::Configuration::store
std::shared_ptr< Store > store
The store caching user answers to trust prompts.
Definition: cached_agent.h:56
agent.h
core::trust::CachedAgent::Configuration
Creation time parameters.
Definition: cached_agent.h:51
CORE_TRUST_DLL_PUBLIC
#define CORE_TRUST_DLL_PUBLIC
Definition: visibility.h:26