BasicAuthenticator
BasicAuthenticator
#include <icy/http/authenticator.h>Encodes and decodes HTTP Basic authentication credentials.
Public Methods
| Return | Name | Description |
|---|---|---|
BasicAuthenticator | Creates an empty basic authenticator. | |
BasicAuthenticator | Creates a basic authenticator with the given username and password. | |
BasicAuthenticator explicit | Extracts basic authentication credentials from the given request. | |
BasicAuthenticator explicit | Parses a raw Basic authentication payload string. The value can be extracted from a request via [Request::getCredentials()](icy-http-Request.html#getcredentials). | |
~BasicAuthenticator | Destroys the basic authenticator. | |
void | setUsername | Sets the username. |
const std::string & | username const | Returns the username. |
void | setPassword | Sets the password. |
const std::string & | password const | Returns the password. |
void | authenticate const | Adds authentication information to the given http::Request. |
void | proxyAuthenticate const | Adds proxy authentication information to the given http::Request. |
BasicAuthenticator
BasicAuthenticator()Creates an empty basic authenticator.
BasicAuthenticator
BasicAuthenticator(const std::string & username, const std::string & password)Creates a basic authenticator with the given username and password.
BasicAuthenticator
explicit
explicit BasicAuthenticator(const http::Request & request)Extracts basic authentication credentials from the given request.
Throws a NotAuthenticatedException if the request does not contain basic authentication information.
BasicAuthenticator
explicit
explicit BasicAuthenticator(const std::string & authInfo)Parses a raw Basic authentication payload string. The value can be extracted from a request via [Request::getCredentials()](icy-http-Request.html#getcredentials).
~BasicAuthenticator
~BasicAuthenticator()Destroys the basic authenticator.
setUsername
void setUsername(const std::string & username)Sets the username.
username
const
const std::string & username() constReturns the username.
setPassword
void setPassword(const std::string & password)Sets the password.
password
const
const std::string & password() constReturns the password.
authenticate
const
void authenticate(http::Request & request) constAdds authentication information to the given http::Request.
proxyAuthenticate
const
void proxyAuthenticate(http::Request & request) constAdds proxy authentication information to the given http::Request.
Protected Methods
| Return | Name | Description |
|---|---|---|
void | parseAuthInfo | Extracts username and password from Basic authentication info by base64-decoding authInfo and splitting the resulting std::string at the ':' delimiter. |
parseAuthInfo
void parseAuthInfo(std::string_view authInfo)Extracts username and password from Basic authentication info by base64-decoding authInfo and splitting the resulting std::string at the ':' delimiter.
Private Attributes
_username
std::string _username_password
std::string _passwordPrivate Methods
| Return | Name | Description |
|---|---|---|
BasicAuthenticator | Deleted constructor. |
BasicAuthenticator
BasicAuthenticator(const BasicAuthenticator &) = deleteDeleted constructor.
