Ark Server API (ASE) - Wiki
|
#include <HTTPDigestCredentials.h>
Public Member Functions | |
HTTPDigestCredentials () | |
HTTPDigestCredentials (const std::string &username, const std::string &password) | |
Creates an empty HTTPDigestCredentials object. | |
~HTTPDigestCredentials () | |
Creates a HTTPDigestCredentials object with the given username and password. | |
void | reset () |
Destroys the HTTPDigestCredentials. | |
void | clear () |
void | setUsername (const std::string &username) |
Clears both username and password. | |
const std::string & | getUsername () const |
Sets the username. | |
void | setPassword (const std::string &password) |
Returns the username. | |
const std::string & | getPassword () const |
Sets the password. | |
bool | empty () const |
Returns the password. | |
void | authenticate (HTTPRequest &request, const HTTPResponse &response) |
Returns true if both username and password are empty, otherwise false. | |
void | authenticate (HTTPRequest &request, const HTTPAuthenticationParams &responseAuthParams) |
void | updateAuthInfo (HTTPRequest &request) |
void | proxyAuthenticate (HTTPRequest &request, const HTTPResponse &response) |
void | proxyAuthenticate (HTTPRequest &request, const HTTPAuthenticationParams &responseAuthParams) |
void | updateProxyAuthInfo (HTTPRequest &request) |
bool | verifyAuthInfo (const HTTPRequest &request) const |
bool | verifyAuthParams (const HTTPRequest &request, const HTTPAuthenticationParams ¶ms) const |
Static Public Member Functions | |
static std::string | createNonce () |
Static Public Attributes | |
static const std::string | SCHEME |
Creates a random nonce string. | |
Private Types | |
typedef std::map< std::string, int > | NonceCounterMap |
Private Member Functions | |
HTTPDigestCredentials (const HTTPDigestCredentials &) | |
HTTPDigestCredentials & | operator= (const HTTPDigestCredentials &) |
void | createAuthParams (const HTTPRequest &request, const HTTPAuthenticationParams &responseAuthParams) |
void | updateAuthParams (const HTTPRequest &request) |
int | updateNonceCounter (const std::string &nonce) |
Private Attributes | |
std::string | _username |
std::string | _password |
HTTPAuthenticationParams | _requestAuthParams |
NonceCounterMap | _nc |
Static Private Attributes | |
static const std::string | DEFAULT_ALGORITHM |
static const std::string | DEFAULT_QOP |
static const std::string | NONCE_PARAM |
static const std::string | REALM_PARAM |
static const std::string | QOP_PARAM |
static const std::string | ALGORITHM_PARAM |
static const std::string | USERNAME_PARAM |
static const std::string | OPAQUE_PARAM |
static const std::string | URI_PARAM |
static const std::string | RESPONSE_PARAM |
static const std::string | AUTH_PARAM |
static const std::string | CNONCE_PARAM |
static const std::string | NC_PARAM |
static int | _nonceCounter |
static Poco::FastMutex | _nonceMutex |
This is a utility class for working with HTTP Digest Authentication in HTTPRequest objects.
Note: currently, no qop or qop=auth is supported only.
Definition at line 35 of file HTTPDigestCredentials.h.
|
private |
Definition at line 150 of file HTTPDigestCredentials.h.
Poco::Net::HTTPDigestCredentials::HTTPDigestCredentials | ( | ) |
Poco::Net::HTTPDigestCredentials::HTTPDigestCredentials | ( | const std::string & | username, |
const std::string & | password ) |
Creates an empty HTTPDigestCredentials object.
Poco::Net::HTTPDigestCredentials::~HTTPDigestCredentials | ( | ) |
Creates a HTTPDigestCredentials object with the given username and password.
|
private |
void Poco::Net::HTTPDigestCredentials::authenticate | ( | HTTPRequest & | request, |
const HTTPAuthenticationParams & | responseAuthParams ) |
Parses WWW-Authenticate header of the HTTPResponse, initializes internal state, and adds authentication information to the given HTTPRequest.
void Poco::Net::HTTPDigestCredentials::authenticate | ( | HTTPRequest & | request, |
const HTTPResponse & | response ) |
Returns true if both username and password are empty, otherwise false.
void Poco::Net::HTTPDigestCredentials::clear | ( | ) |
Resets the HTTPDigestCredentials object to a clean state. Does not clear username and password.
|
private |
|
static |
Verifies the digest authentication information in the given HTTPRequest and HTTPAuthenticationParams by recomputing the response and comparing it with what's in the request.
|
inline |
Returns the password.
Definition at line 177 of file HTTPDigestCredentials.h.
|
inline |
Sets the password.
Definition at line 171 of file HTTPDigestCredentials.h.
|
inline |
Sets the username.
Definition at line 165 of file HTTPDigestCredentials.h.
|
private |
void Poco::Net::HTTPDigestCredentials::proxyAuthenticate | ( | HTTPRequest & | request, |
const HTTPAuthenticationParams & | responseAuthParams ) |
Parses Proxy-Authenticate header of the HTTPResponse, initializes internal state, and adds proxy authentication information to the given HTTPRequest.
void Poco::Net::HTTPDigestCredentials::proxyAuthenticate | ( | HTTPRequest & | request, |
const HTTPResponse & | response ) |
Updates internal state and adds authentication information to the given HTTPRequest.
void Poco::Net::HTTPDigestCredentials::reset | ( | ) |
Destroys the HTTPDigestCredentials.
void Poco::Net::HTTPDigestCredentials::setPassword | ( | const std::string & | password | ) |
Returns the username.
void Poco::Net::HTTPDigestCredentials::setUsername | ( | const std::string & | username | ) |
Clears both username and password.
void Poco::Net::HTTPDigestCredentials::updateAuthInfo | ( | HTTPRequest & | request | ) |
Initializes internal state according to information from the HTTPAuthenticationParams of the response, and adds authentication information to the given HTTPRequest.
Throws InvalidArgumentException if HTTPAuthenticationParams is invalid or some required parameter is missing. Throws NotImplementedException in case of unsupported digest algorithm or quality of protection method.
|
private |
|
private |
void Poco::Net::HTTPDigestCredentials::updateProxyAuthInfo | ( | HTTPRequest & | request | ) |
Initializes internal state according to information from the HTTPAuthenticationParams of the response, and adds proxy authentication information to the given HTTPRequest.
Throws InvalidArgumentException if HTTPAuthenticationParams is invalid or some required parameter is missing. Throws NotImplementedException in case of unsupported digest algorithm or quality of protection method.
bool Poco::Net::HTTPDigestCredentials::verifyAuthInfo | ( | const HTTPRequest & | request | ) | const |
Updates internal state and adds proxy authentication information to the given HTTPRequest.
bool Poco::Net::HTTPDigestCredentials::verifyAuthParams | ( | const HTTPRequest & | request, |
const HTTPAuthenticationParams & | params ) const |
Verifies the digest authentication information in the given HTTPRequest by recomputing the response and comparing it with what's in the request.
Note: This method creates a HTTPAuthenticationParams object from the request and calls verifyAuthParams() with request and params.
|
private |
Definition at line 155 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 157 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 158 of file HTTPDigestCredentials.h.
|
private |
Definition at line 153 of file HTTPDigestCredentials.h.
|
private |
Definition at line 154 of file HTTPDigestCredentials.h.
|
private |
Definition at line 152 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 141 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 146 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 147 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 136 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 137 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 148 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 138 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 143 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 140 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 139 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 145 of file HTTPDigestCredentials.h.
|
static |
Creates a random nonce string.
Definition at line 126 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 144 of file HTTPDigestCredentials.h.
|
staticprivate |
Definition at line 142 of file HTTPDigestCredentials.h.