Poco::Net

class HTTPNTLMCredentials

File Information

Library: Net
Package: HTTP
Header: Poco/Net/HTTPNTLMCredentials.h

Description

This is a utility class for working with HTTP NTLMv2 Authentication in HTTPRequest objects.

Member Summary

Member Functions: authenticate, clear, empty, getHost, getPassword, getUsername, proxyAuthenticate, reset, setHost, setPassword, setUsername, updateAuthInfo, updateProxyAuthInfo

Constructors

HTTPNTLMCredentials

HTTPNTLMCredentials();

Creates an empty HTTPNTLMCredentials object.

HTTPNTLMCredentials

HTTPNTLMCredentials(
    const std::string & username,
    const std::string & password
);

Creates a HTTPNTLMCredentials object with the given username and password.

HTTPNTLMCredentials

HTTPNTLMCredentials(
    const std::string & username,
    const std::string & password,
    const std::string & host
);

Creates a HTTPNTLMCredentials object with the given username, password and target host.

Destructor

~HTTPNTLMCredentials

~HTTPNTLMCredentials();

Destroys the HTTPNTLMCredentials.

Member Functions

authenticate

void authenticate(
    HTTPRequest & request,
    const HTTPResponse & response
);

Parses WWW-Authenticate header of the HTTPResponse, initializes internal state, and adds authentication information to the given HTTPRequest.

authenticate

void authenticate(
    HTTPRequest & request,
    const std::string & ntlmChallengeBase64
);

Initializes internal state according to information from the ntlmChallengeBase64, and adds authentication information to the given HTTPRequest.

Throws InvalidArgumentException if responseAuthParams is invalid.

clear

void clear();

Clears username, password and host.

empty inline

bool empty() const;

Returns true if both username and password are empty, otherwise false.

getHost inline

const std::string & getHost() const;

Returns the target host.

getPassword inline

const std::string & getPassword() const;

Returns the password.

getUsername inline

const std::string & getUsername() const;

Returns the username.

proxyAuthenticate

void proxyAuthenticate(
    HTTPRequest & request,
    const HTTPResponse & response
);

Parses Proxy-Authenticate header of the HTTPResponse, initializes internal state, and adds proxy authentication information to the given HTTPRequest.

proxyAuthenticate

void proxyAuthenticate(
    HTTPRequest & request,
    const std::string & ntlmChallengeBase64
);

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.

reset

void reset();

Resets the HTTPNTLMCredentials object to a clean state. Does not clear username and password.

setHost

void setHost(
    const std::string & host
);

Sets the target host.

Used for SSPI-based NTLM authentication only.

setPassword

void setPassword(
    const std::string & password
);

Sets the password.

setUsername

void setUsername(
    const std::string & username
);

Sets the username.

updateAuthInfo

void updateAuthInfo(
    HTTPRequest & request
);

Updates internal state and adds authentication information to the given HTTPRequest.

updateProxyAuthInfo

void updateProxyAuthInfo(
    HTTPRequest & request
);

Updates internal state and adds proxy authentication information to the given HTTPRequest.

Variables

SCHEME static

static const std::string SCHEME;

Securely control IoT edge devices from anywhere   Connect a Device