mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 19:51:58 +01:00
added HTTP*Credentials::empty() and HTTP*Credentials::clear()
This commit is contained in:
@@ -55,6 +55,9 @@ public:
|
|||||||
~HTTPBasicCredentials();
|
~HTTPBasicCredentials();
|
||||||
/// Destroys the HTTPBasicCredentials.
|
/// Destroys the HTTPBasicCredentials.
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
/// Clears both username and password.
|
||||||
|
|
||||||
void setUsername(const std::string& username);
|
void setUsername(const std::string& username);
|
||||||
/// Sets the username.
|
/// Sets the username.
|
||||||
|
|
||||||
@@ -67,6 +70,9 @@ public:
|
|||||||
const std::string& getPassword() const;
|
const std::string& getPassword() const;
|
||||||
/// Returns the password.
|
/// Returns the password.
|
||||||
|
|
||||||
|
bool empty() const;
|
||||||
|
/// Returns true if both username and password are empty, otherwise false.
|
||||||
|
|
||||||
void authenticate(HTTPRequest& request) const;
|
void authenticate(HTTPRequest& request) const;
|
||||||
/// Adds authentication information to the given HTTPRequest.
|
/// Adds authentication information to the given HTTPRequest.
|
||||||
|
|
||||||
@@ -105,6 +111,12 @@ inline const std::string& HTTPBasicCredentials::getPassword() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool HTTPBasicCredentials::empty() const
|
||||||
|
{
|
||||||
|
return _username.empty() && _password.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Net
|
} } // namespace Poco::Net
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ public:
|
|||||||
/// and password of the credentials object.
|
/// and password of the credentials object.
|
||||||
/// Does nothing if URI has no user info part.
|
/// Does nothing if URI has no user info part.
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
/// Clears username, password and host.
|
||||||
|
|
||||||
void setUsername(const std::string& username);
|
void setUsername(const std::string& username);
|
||||||
/// Sets the username.
|
/// Sets the username.
|
||||||
|
|
||||||
@@ -111,6 +114,9 @@ public:
|
|||||||
/// Returns the target host. Only used for SSPI-based NTLM authentication using
|
/// Returns the target host. Only used for SSPI-based NTLM authentication using
|
||||||
/// the credentials of the currently logged-in user on Windows.
|
/// the credentials of the currently logged-in user on Windows.
|
||||||
|
|
||||||
|
bool empty() const;
|
||||||
|
/// Returns true if both username and password are empty, otherwise false.
|
||||||
|
|
||||||
void authenticate(HTTPRequest& request, const HTTPResponse& response);
|
void authenticate(HTTPRequest& request, const HTTPResponse& response);
|
||||||
/// Inspects WWW-Authenticate header of the response, initializes
|
/// Inspects WWW-Authenticate header of the response, initializes
|
||||||
/// the internal state (in case of digest authentication) and
|
/// the internal state (in case of digest authentication) and
|
||||||
@@ -216,6 +222,12 @@ inline const std::string& HTTPCredentials::getHost() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool HTTPCredentials::empty() const
|
||||||
|
{
|
||||||
|
return _digest.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Net
|
} } // namespace Poco::Net
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,10 @@ public:
|
|||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
/// Resets the HTTPDigestCredentials object to a clean state.
|
/// Resets the HTTPDigestCredentials object to a clean state.
|
||||||
|
/// Does not clear username and password.
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
/// Clears both username and password.
|
||||||
|
|
||||||
void setUsername(const std::string& username);
|
void setUsername(const std::string& username);
|
||||||
/// Sets the username.
|
/// Sets the username.
|
||||||
@@ -65,6 +69,9 @@ public:
|
|||||||
const std::string& getPassword() const;
|
const std::string& getPassword() const;
|
||||||
/// Returns the password.
|
/// Returns the password.
|
||||||
|
|
||||||
|
bool empty() const;
|
||||||
|
/// Returns true if both username and password are empty, otherwise false.
|
||||||
|
|
||||||
void authenticate(HTTPRequest& request, const HTTPResponse& response);
|
void authenticate(HTTPRequest& request, const HTTPResponse& response);
|
||||||
/// Parses WWW-Authenticate header of the HTTPResponse, initializes
|
/// Parses WWW-Authenticate header of the HTTPResponse, initializes
|
||||||
/// internal state, and adds authentication information to the given HTTPRequest.
|
/// internal state, and adds authentication information to the given HTTPRequest.
|
||||||
@@ -167,6 +174,12 @@ inline const std::string& HTTPDigestCredentials::getPassword() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool HTTPDigestCredentials::empty() const
|
||||||
|
{
|
||||||
|
return _username.empty() && _password.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Net
|
} } // namespace Poco::Net
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,10 @@ public:
|
|||||||
|
|
||||||
void reset();
|
void reset();
|
||||||
/// Resets the HTTPNTLMCredentials object to a clean state.
|
/// Resets the HTTPNTLMCredentials object to a clean state.
|
||||||
|
/// Does not clear username and password.
|
||||||
|
|
||||||
|
void clear();
|
||||||
|
/// Clears username, password and host.
|
||||||
|
|
||||||
void setUsername(const std::string& username);
|
void setUsername(const std::string& username);
|
||||||
/// Sets the username.
|
/// Sets the username.
|
||||||
@@ -64,6 +68,9 @@ public:
|
|||||||
const std::string& getPassword() const;
|
const std::string& getPassword() const;
|
||||||
/// Returns the password.
|
/// Returns the password.
|
||||||
|
|
||||||
|
bool empty() const;
|
||||||
|
/// Returns true if both username and password are empty, otherwise false.
|
||||||
|
|
||||||
void setHost(const std::string& host);
|
void setHost(const std::string& host);
|
||||||
/// Sets the target host.\
|
/// Sets the target host.\
|
||||||
///
|
///
|
||||||
@@ -149,6 +156,12 @@ inline bool HTTPNTLMCredentials::useSSPINTLM() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline bool HTTPNTLMCredentials::empty() const
|
||||||
|
{
|
||||||
|
return _username.empty() && _password.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} } // namespace Poco::Net
|
} } // namespace Poco::Net
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,13 @@ HTTPBasicCredentials::~HTTPBasicCredentials()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HTTPBasicCredentials::clear()
|
||||||
|
{
|
||||||
|
_username.clear();
|
||||||
|
_password.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void HTTPBasicCredentials::setUsername(const std::string& username)
|
void HTTPBasicCredentials::setUsername(const std::string& username)
|
||||||
{
|
{
|
||||||
_username = username;
|
_username = username;
|
||||||
|
|||||||
@@ -47,6 +47,13 @@ HTTPCredentials::~HTTPCredentials()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HTTPCredentials::clear()
|
||||||
|
{
|
||||||
|
_digest.clear();
|
||||||
|
_ntlm.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void HTTPCredentials::fromUserInfo(const std::string& userInfo)
|
void HTTPCredentials::fromUserInfo(const std::string& userInfo)
|
||||||
{
|
{
|
||||||
std::string username;
|
std::string username;
|
||||||
|
|||||||
@@ -121,6 +121,13 @@ void HTTPDigestCredentials::setPassword(const std::string& password)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HTTPDigestCredentials::clear()
|
||||||
|
{
|
||||||
|
_username.clear();
|
||||||
|
_password.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void HTTPDigestCredentials::authenticate(HTTPRequest& request, const HTTPResponse& response)
|
void HTTPDigestCredentials::authenticate(HTTPRequest& request, const HTTPResponse& response)
|
||||||
{
|
{
|
||||||
authenticate(request, HTTPAuthenticationParams(response));
|
authenticate(request, HTTPAuthenticationParams(response));
|
||||||
|
|||||||
@@ -52,6 +52,14 @@ void HTTPNTLMCredentials::reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void HTTPNTLMCredentials::clear()
|
||||||
|
{
|
||||||
|
_username.clear();
|
||||||
|
_password.clear();
|
||||||
|
_host.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void HTTPNTLMCredentials::setUsername(const std::string& username)
|
void HTTPNTLMCredentials::setUsername(const std::string& username)
|
||||||
{
|
{
|
||||||
_username = username;
|
_username = username;
|
||||||
|
|||||||
Reference in New Issue
Block a user