26#ifndef ROUTER_HTTP_AUTH_BACKEND_INCLUDED 
   27#define ROUTER_HTTP_AUTH_BACKEND_INCLUDED 
   31#include <system_error> 
   35#include <rapidjson/document.h> 
   57                                       const std::string &authdata) = 0;
 
   66  using stat_res = std::pair<std::error_code, struct stat>;
 
  132  using iterator = std::map<key_type, value_type>::iterator;
 
  142  std::error_code from_file(
const std::string &
filename);
 
  150  std::error_code from_stream(std::istream &is);
 
  155  void to_stream(std::ostream &os);
 
  161    credentials_cache_.erase(username);
 
  162    return credentials_.erase(username);
 
  172    auto res = credentials_.insert({username, authdata});
 
  174      auto elem_it = res.first;
 
  176      elem_it->second = authdata;
 
  184    return credentials_.find(username);
 
  191    return credentials_.find(username);
 
  220  std::error_code authenticate(
const key_type &username,
 
  233  static std::string hash_password(
const std::string &
password);
 
  234  std::error_code from_stream_(std::istream &is);
 
  236  bool is_file_{
false};
 
check if a file was modified.
Definition: http_auth_backend.h:82
 
FileModified(const FileMeta &meta)
Definition: http_auth_backend.h:85
 
bool operator==(const FileModified &b) const
check if two FileModified's are equal.
Definition: http_auth_backend.cc:70
 
FileMeta meta_
Definition: http_auth_backend.h:93
 
hashed key store.
Definition: http_auth_backend.h:123
 
iterator begin() noexcept
begin iterator.
Definition: http_auth_backend.h:207
 
std::string cache_type
Definition: http_auth_backend.h:127
 
const_iterator begin() const noexcept
const begin iterator.
Definition: http_auth_backend.h:212
 
const_iterator end() const noexcept
const end iterator.
Definition: http_auth_backend.h:202
 
iterator find(const key_type &username)
find username in cache.
Definition: http_auth_backend.h:183
 
const_iterator find(const key_type &username) const
find username in cache.
Definition: http_auth_backend.h:190
 
std::map< key_type, value_type > credentials_
Definition: http_auth_backend.h:240
 
size_t erase(const key_type &username)
remove username from credential cache.
Definition: http_auth_backend.h:160
 
std::string key_type
Definition: http_auth_backend.h:125
 
std::string value_type
Definition: http_auth_backend.h:126
 
void set(const key_type &username, const value_type &authdata)
set username and password in cache.
Definition: http_auth_backend.h:171
 
std::map< key_type, value_type >::iterator iterator
iterator
Definition: http_auth_backend.h:132
 
std::map< key_type, cache_type > credentials_cache_
Definition: http_auth_backend.h:241
 
iterator end() noexcept
end iterator.
Definition: http_auth_backend.h:197
 
FileModified file_meta_
Definition: http_auth_backend.h:238
 
std::string filename_
Definition: http_auth_backend.h:237
 
std::map< key_type, value_type >::const_iterator const_iterator
const iterator
Definition: http_auth_backend.h:137
 
Base class of all AuthBackends.
Definition: http_auth_backend.h:45
 
HttpAuthBackend(HttpAuthBackend &&)=default
 
HttpAuthBackend & operator=(const HttpAuthBackend &)=default
 
virtual ~HttpAuthBackend()=0
destructor.
 
HttpAuthBackend(const HttpAuthBackend &)=default
 
virtual std::error_code authenticate(const std::string &username, const std::string &authdata)=0
authentication username with authdata against backend.
 
HttpAuthBackend & operator=(HttpAuthBackend &&)=default
 
HttpAuthBackend()=default
 
#define HTTP_AUTH_BACKEND_LIB_EXPORT
Definition: http_auth_backend_lib_export.h:15
 
Define rapidjson::SizeType to be std::uint64_t.
 
static char * password
Definition: mysql_secure_installation.cc:58
 
uint16_t value_type
Definition: vt100.h:184
 
int key_type
Definition: method.h:38
 
const char * filename
Definition: pfs_example_component_population.cc:67