fixed GH #478: HTTPCredentials and HTTPAuthenticationParams support multiple WWW-Authenticate headers

This commit is contained in:
Guenter Obiltschnig
2014-11-19 21:25:36 +01:00
parent b8503e82e0
commit 88b203f483
8 changed files with 72 additions and 22 deletions

View File

@@ -46,7 +46,7 @@ public:
explicit HTTPAuthenticationParams(const HTTPRequest& request);
/// See fromRequest() documentation.
explicit HTTPAuthenticationParams(const HTTPResponse& response);
HTTPAuthenticationParams(const HTTPResponse& response, const std::string& header = WWW_AUTHENTICATE);
/// See fromResponse() documentation.
virtual ~HTTPAuthenticationParams();
@@ -68,7 +68,7 @@ public:
/// Throws a InvalidArgumentException if authentication scheme is
/// unknown or invalid.
void fromResponse(const HTTPResponse& response);
void fromResponse(const HTTPResponse& response, const std::string& header = WWW_AUTHENTICATE);
/// Extracts authentication information from the response and creates
/// HTTPAuthenticationParams by parsing it.
///
@@ -91,6 +91,8 @@ public:
/// request or response authentication header.
static const std::string REALM;
static const std::string WWW_AUTHENTICATE;
static const std::string PROXY_AUTHENTICATE;
private:
void parse(std::string::const_iterator first, std::string::const_iterator last);

View File

@@ -52,6 +52,9 @@ public:
~HTTPDigestCredentials();
/// Destroys the HTTPDigestCredentials.
void reset();
/// Resets the HTTPDigestCredentials object to a clean state.
void setUsername(const std::string& username);
/// Sets the username.