Home
HTTP module

BasicAuthenticator

Encodes and decodes HTTP Basic authentication credentials.

BasicAuthenticator

#include <icy/http/authenticator.h>
class BasicAuthenticator

Defined in src/http/include/icy/http/authenticator.h:99

Encodes and decodes HTTP Basic authentication credentials.

List of all members

NameKindOwner
BasicAuthenticatorfunctionDeclared here
BasicAuthenticatorfunctionDeclared here
BasicAuthenticatorfunctionDeclared here
BasicAuthenticatorfunctionDeclared here
~BasicAuthenticatorfunctionDeclared here
setUsernamefunctionDeclared here
usernamefunctionDeclared here
setPasswordfunctionDeclared here
passwordfunctionDeclared here
authenticatefunctionDeclared here
proxyAuthenticatefunctionDeclared here
parseAuthInfofunctionDeclared here
_usernamevariableDeclared here
_passwordvariableDeclared here
BasicAuthenticatorfunctionDeclared here
operator=functionDeclared here

Public Methods

ReturnNameDescription
BasicAuthenticatorCreates an empty basic authenticator.
BasicAuthenticatorCreates a basic authenticator with the given username and password.
BasicAuthenticator explicitExtracts basic authentication credentials from the given request.
BasicAuthenticator explicitParses a raw Basic authentication payload string. The value can be extracted from a request via [Request::getCredentials()](icy-http-Request.html#getcredentials).
~BasicAuthenticatorDestroys the basic authenticator.
voidsetUsernameSets the username.
const std::string &username constReturns the username.
voidsetPasswordSets the password.
const std::string &password constReturns the password.
voidauthenticate constAdds authentication information to the given http::Request.
voidproxyAuthenticate constAdds proxy authentication information to the given http::Request.

BasicAuthenticator

BasicAuthenticator()

Defined in src/http/include/icy/http/authenticator.h:103

Creates an empty basic authenticator.


BasicAuthenticator

BasicAuthenticator(const std::string & username, const std::string & password)

Defined in src/http/include/icy/http/authenticator.h:106

Creates a basic authenticator with the given username and password.


BasicAuthenticator

explicit

explicit BasicAuthenticator(const http::Request & request)

Defined in src/http/include/icy/http/authenticator.h:113

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)

Defined in src/http/include/icy/http/authenticator.h:117

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()

Defined in src/http/include/icy/http/authenticator.h:120

Destroys the basic authenticator.


setUsername

void setUsername(const std::string & username)

Defined in src/http/include/icy/http/authenticator.h:123

Sets the username.


username

const

const std::string & username() const

Defined in src/http/include/icy/http/authenticator.h:126

Returns the username.


setPassword

void setPassword(const std::string & password)

Defined in src/http/include/icy/http/authenticator.h:129

Sets the password.


password

const

const std::string & password() const

Defined in src/http/include/icy/http/authenticator.h:132

Returns the password.


authenticate

const

void authenticate(http::Request & request) const

Defined in src/http/include/icy/http/authenticator.h:135

Adds authentication information to the given http::Request.


proxyAuthenticate

const

void proxyAuthenticate(http::Request & request) const

Defined in src/http/include/icy/http/authenticator.h:138

Adds proxy authentication information to the given http::Request.

Protected Methods

ReturnNameDescription
voidparseAuthInfoExtracts 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)

Defined in src/http/include/icy/http/authenticator.h:144

Extracts username and password from Basic authentication info by base64-decoding authInfo and splitting the resulting std::string at the ':' delimiter.

Private Attributes

ReturnNameDescription
std::string_username
std::string_password

_username

std::string _username

Defined in src/http/include/icy/http/authenticator.h:150


_password

std::string _password

Defined in src/http/include/icy/http/authenticator.h:151

Private Methods

ReturnNameDescription
BasicAuthenticatorDeleted constructor.

BasicAuthenticator

BasicAuthenticator(const BasicAuthenticator &) = delete

Defined in src/http/include/icy/http/authenticator.h:147

Deleted constructor.