Monero
Loading...
Searching...
No Matches
epee::net_utils::http::http_client_auth Class Reference

Implements RFC 2617 digest auth. Digests from RFC 7616 can be added. More...

#include <http_auth.h>

Classes

struct  session

Public Types

enum  status : std::uint8_t { kSuccess = 0 , kBadPassword , kParseFailure }

Public Member Functions

 http_client_auth ()
 http_client_auth (login credentials)
status handle_401 (const http_response_info &response)
boost::optional< std::pair< std::string, std::string > > get_auth_field (const boost::string_ref method, const boost::string_ref uri)

Private Member Functions

status do_handle_401 (const http_response_info &)
boost::optional< std::pair< std::string, std::string > > do_get_auth_field (boost::string_ref, boost::string_ref)

Private Attributes

boost::optional< sessionuser

Detailed Description

Implements RFC 2617 digest auth. Digests from RFC 7616 can be added.

Member Enumeration Documentation

◆ status

Enumerator
kSuccess 
kBadPassword 
kParseFailure 

Constructor & Destructor Documentation

◆ http_client_auth() [1/2]

epee::net_utils::http::http_client_auth::http_client_auth ( )
inline

◆ http_client_auth() [2/2]

epee::net_utils::http::http_client_auth::http_client_auth ( login credentials)

Member Function Documentation

◆ do_get_auth_field()

boost::optional< std::pair< std::string, std::string > > epee::net_utils::http::http_client_auth::do_get_auth_field ( boost::string_ref method,
boost::string_ref uri )
private

◆ do_handle_401()

http_client_auth::status epee::net_utils::http::http_client_auth::do_handle_401 ( const http_response_info & response)
private

◆ get_auth_field()

boost::optional< std::pair< std::string, std::string > > epee::net_utils::http::http_client_auth::get_auth_field ( const boost::string_ref method,
const boost::string_ref uri )
inline

After calling handle_401, clients should call this function to generate an authentication field for every request.

Returns
A HTTP "Authorization" field if handle_401(...) previously returned kSuccess.

◆ handle_401()

status epee::net_utils::http::http_client_auth::handle_401 ( const http_response_info & response)
inline

Clients receiving a 401 response code from the server should call this function to process the server auth. Then, before every client request, get_auth_field() should be called to retrieve the newest authorization request.

Returns
kBadPassword if client will never be able to authenticate, kParseFailure if all server authentication responses were invalid, and kSuccess if get_auth_field is ready to generate authorization fields.

Member Data Documentation

◆ user

boost::optional<session> epee::net_utils::http::http_client_auth::user
private

The documentation for this class was generated from the following files: