27namespace http_field_parsers
186 const auto *
token68 = std::get_if<authorization_value_t::token68_t>(
199 return make_unexpected(
292template<
typename Extra_Data >
359template<
typename Extra_Data >
Stuff related to value of Authorization HTTP-field.
expected_t< params_t, extraction_error_t > perform_extraction_attempt(const std::optional< string_view_t > opt_field_value)
extraction_error_t
Error codes for failures of extraction of basic authentification parameters.
@ not_basic_auth_scheme
Different authentification scheme found. Basic authentification scheme is expected.
@ token68_decode_error
Value of token68 parameter for basic authentification can't be decoded.
@ no_auth_http_field
There is no HTTP field with authentification parameters.
@ empty_username
Empty user name in username:password pair.
@ invalid_username_password_pair
Wrong format for username:password in decoded token68 parameter. Maybe there is no colon symbol.
@ illegal_http_field_value
The HTTP field with authentification parameters can't be parsed.
@ invalid_basic_auth_param
Invalid value of parameter for basic authentification scheme. The single parameter in the form of tok...
expected_t< params_t, extraction_error_t > try_extract_params(const authorization_value_t &http_field)
Helper function for getting parameters of basic authentification from an already parsed HTTP-field.
string_view_t to_string_view(extraction_error_t what) noexcept
Helper function to get a string name of extraction_error enum.
expected_t< std::string, decoding_error_t > try_decode(string_view_t str)
run_on_this_thread_settings_t< Traits > on_this_thread()
A special marker for the case when http_server must be run on the context of the current thread.
std::string_view string_view_t
http_field_t
C++ enum that repeats nodejs c-style enum.
nonstd::expected< T, E > expected_t
Tools for working with the value of Authorization HTTP-field.
static expected_t< authorization_value_t, restinio::easy_parser::parse_error_t > try_parse(string_view_t what)
An attempt to parse Authorization HTTP-field.
Parameters for basic authentification.
std::string username
Name of a user.
std::string password
Password for a user.