CppCMS

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

session_cookies.h
1 //
3 // Copyright (C) 2008-2012 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
4 //
5 // See accompanying file COPYING.TXT file for licensing details.
6 //
8 #ifndef CPPCMS_SESSION_COOKIES_H
9 #define CPPCMS_SESSION_COOKIES_H
10 #include <cppcms/session_api.h>
11 #include <booster/hold_ptr.h>
12 #include <booster/noncopyable.h>
13 #include <booster/auto_ptr_inc.h>
14 #include <string>
15 namespace cppcms {
16 class session_interface;
17
21 namespace sessions {
22
34 class encryptor : public booster::noncopyable {
35 public:
40 virtual std::string encrypt(std::string const &plain) = 0;
46 virtual bool decrypt(std::string const &cipher,std::string &plain) = 0;
50 virtual ~encryptor() {}
51 };
52
58 class encryptor_factory {
59 public:
63 virtual std::auto_ptr<encryptor> get() = 0;
64
68 virtual ~encryptor_factory() {}
69 };
70
74 class CPPCMS_API session_cookies : public session_api {
75 public:
79 session_cookies(std::auto_ptr<encryptor> encryptor);
83 ~session_cookies();
84
88 virtual void save(session_interface &,std::string const &data,time_t timeout,bool newone ,bool on_server);
89
93 virtual bool load(session_interface &,std::string &data,time_t &timeout);
94
98 virtual bool is_blocking();
99
103 virtual void clear(session_interface &);
104 private:
105 struct _data;
106 booster::hold_ptr<_data> d;
107 std::auto_ptr<encryptor> encryptor_;
108 };
109 } // sessions
110 } // cppcms
111
112 #endif
cppcms::sessions::encryptor_factory
This is an interface for an object that creates new encryptors.
Definition: session_cookies.h:58
booster::hold_ptr< _data >
cppcms::sessions::encryptor::decrypt
virtual bool decrypt(std::string const &cipher, std::string &plain)=0
cppcms::sessions::session_cookies
The implementation of session_api using encrypted or signed cookies.
Definition: session_cookies.h:74
cppcms::session_interface
This class provides an access to an application for session management.
Definition: session_interface.h:107
cppcms
This is the namespace where all CppCMS functionality is placed.
Definition: application.h:19
cppcms::sessions::encryptor::encrypt
virtual std::string encrypt(std::string const &plain)=0
cppcms::sessions::encryptor::~encryptor
virtual ~encryptor()
Definition: session_cookies.h:50
cppcms::session_api
This class represents the most generic implementation of session storage device.
Definition: session_api.h:32
cppcms::sessions::encryptor_factory::~encryptor_factory
virtual ~encryptor_factory()
Definition: session_cookies.h:68
cppcms::sessions::encryptor
This is an interface to generic session cookies encryption or signing API.
Definition: session_cookies.h:34
booster::noncopyable
This class makes impossible to copy any class derived from this one.
Definition: noncopyable.h:15