155 const auto * b64token = std::get_if<authorization_value_t::token68_t>(
217 auto * b64token = std::get_if<authorization_value_t::token68_t>(
222 return params_t{ std::move(b64token->value) };
231 const std::optional< string_view_t > opt_field_value )
233 if( !opt_field_value )
238 if( !field_value_parse_result )
241 auto & parsed_value = *field_value_parse_result;
242 if(
"bearer" != parsed_value.auth_scheme )
305template<
typename Extra_Data >
370template<
typename Extra_Data >
Stuff related to value of Authorization HTTP-field.
const http_request_header_t & header() const noexcept
Get request header.
expected_t< params_t, extraction_error_t > perform_extraction_attempt(const std::optional< string_view_t > opt_field_value)
string_view_t to_string_view(extraction_error_t what) noexcept
Helper function to get a string name of extraction_error enum.
extraction_error_t
Error codes for failures of extraction of bearer authentification parameters.
@ no_auth_http_field
There is no HTTP field with authentification parameters.
@ not_bearer_auth_scheme
Different authentification scheme found. bearer authentification scheme is expected.
@ invalid_bearer_auth_param
Invalid value of parameter for bearer authentification scheme. The single parameter in the form of b6...
@ illegal_http_field_value
The HTTP field with authentification parameters can't be parsed.
expected_t< params_t, extraction_error_t > try_extract_params(const authorization_value_t &http_field)
Helper function for getting parameters of bearer authentification from an already parsed HTTP-field.
http_field_t http_field
Helper alies to omitt _t suffix.
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 bearer authentification.
std::string token
Access Token.