basic_auth.hpp
// ---------------------------------------------------------------------
// pion: a Boost C++ framework for building lightweight HTTP interfaces
// ---------------------------------------------------------------------
// Copyright (C) 2007-2014 Splunk Inc. (https://github.com/splunk/pion)
//
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
//
#ifndef __PION_HTTP_BASIC_AUTH_HEADER__
#define __PION_HTTP_BASIC_AUTH_HEADER__
#include <map>
#include <string>
#include <pion/config.hpp>
#include <pion/http/auth.hpp>
namespace pion { // begin namespace pion
namespace http { // begin namespace http
class PION_API basic_auth :
public http::auth
{
public:
basic_auth(user_manager_ptr userManager, const std::string& realm="PION");
virtual ~basic_auth() {}
virtual bool handle_request(const http::request_ptr& http_request_ptr, const tcp::connection_ptr& tcp_conn);
virtual void set_option(const std::string& name, const std::string& value);
protected:
void handle_unauthorized(const http::request_ptr& http_request_ptr, const tcp::connection_ptr& tcp_conn);
static bool parse_authorization(std::string const &authorization, std::string &credentials);
static bool parse_credentials(std::string const &credentials, std::string &username, std::string &password);
private:
static const unsigned int CACHE_EXPIRATION;
std::string m_realm;
boost::posix_time::ptime m_cache_cleanup_time;
user_cache_type m_user_cache;
mutable boost::mutex m_cache_mutex;
};
} // end namespace http
} // end namespace pion
#endif
pion::http::basic_auth::~basic_auth
virtual ~basic_auth()
virtual destructor
Definition: basic_auth.hpp:35
pion::http::auth
Definition: auth.hpp:34
pion
Definition: admin_rights.hpp:19
pion::http::basic_auth
Definition: basic_auth.hpp:26