NetServices: Add support for Basic authentication

Change-Id: I304104f7096fd935212e1bfa3e988e7945cb5cec
This commit is contained in:
Niels Sascha Reedijk
2022-05-29 15:13:54 +01:00
parent f751534257
commit f9d9d20245
7 changed files with 179 additions and 4 deletions
+55
View File
@@ -308,6 +308,34 @@ namespace Network {
*/
/*!
\struct BHttpAuthentication
\ingroup netservices
\brief Describe username and password for basic authentication for the request.
\see These options are used by \ref BHttpRequest::Authentication() and
\ref BHttpRequest::SetAuthentication()
\since Haiku R1
*/
/*!
\var BString BHttpAuthentication::username
\brief The username for the request.
\since Haiku R1
*/
/*!
\var BString BHttpAuthentication::password
\brief The password for the request.
\since Haiku R1
*/
/*!
\class BHttpRequest
\ingroup netservices
@@ -478,6 +506,18 @@ namespace Network {
//! @{
/*!
\fn const BHttpAuthentication* BHttpRequest::Authentication() const noexcept
\brief Get the credentials for the authentication for the request.
\return When no credentials are set for this request, the method returns a \c nullptr.
Otherwise, it will return a pointer to the current BHttpAuthentication data set for this
request.
\since Haiku R1
*/
/*!
\fn const BHttpFields& BHttpRequest::Fields() const noexcept
\brief Get the additional header fields set for the request.
@@ -531,6 +571,21 @@ namespace Network {
//! @{
/*!
\fn void BHttpRequest::SetAuthentication(const BHttpAuthentication &authentication)
\brief Set the credentials to enable basic authentication for the request.
The Basic authorization line is added to the request upon setting the request details. There is
no support for other authentication schemes, like digest authentication.
\param authentication The credentials to apply to the request.
\exception std::bad_alloc This exception may be raised if it is impossible to allocate memory.
\since Haiku R1
*/
/*!
\fn void BHttpRequest::SetFields(const BHttpFields &fields)
\brief Set additional header \a fields for this request.