10 #ifndef __PION_HTTP_COOKIE_AUTH_HEADER__ 11 #define __PION_HTTP_COOKIE_AUTH_HEADER__ 15 #include <boost/random.hpp> 16 #include <pion/config.hpp> 17 #include <pion/http/auth.hpp> 45 const std::string& login=
"/login",
46 const std::string& logout=
"/logout",
47 const std::string& redirect=
"");
69 virtual bool handle_request(
const http::request_ptr& http_request_ptr,
const tcp::connection_ptr& tcp_conn);
84 virtual void set_option(
const std::string& name,
const std::string& value);
97 bool process_login(
const http::request_ptr& http_request_ptr,
const tcp::connection_ptr& tcp_conn);
105 void handle_unauthorized(
const http::request_ptr& http_request_ptr,
const tcp::connection_ptr& tcp_conn);
113 void handle_redirection(
const http::request_ptr& http_request_ptr,
const tcp::connection_ptr& tcp_conn,
114 const std::string &redirection_url,
const std::string &new_cookie=
"",
bool delete_cookie=
false);
122 void handle_ok(
const http::request_ptr& http_request_ptr,
const tcp::connection_ptr& tcp_conn,
123 const std::string &new_cookie=
"",
bool delete_cookie=
false);
128 void expire_cache(
const boost::posix_time::ptime &time_now);
134 static const unsigned int CACHE_EXPIRATION;
137 static const unsigned int RANDOM_COOKIE_BYTES;
140 static const std::string AUTH_COOKIE_NAME;
146 std::string m_logout;
149 std::string m_redirect;
152 boost::mt19937 m_random_gen;
155 boost::uniform_int<> m_random_range;
158 boost::variate_generator<boost::mt19937&, boost::uniform_int<> > m_random_die;
161 boost::posix_time::ptime m_cache_cleanup_time;
164 user_cache_type m_user_cache;
167 mutable boost::mutex m_cache_mutex;
virtual ~cookie_auth()
virtual destructor