Ark Server API (ASE) - Wiki
Loading...
Searching...
No Matches
Poco::Net::HTTPDigestCredentials Class Reference

#include <HTTPDigestCredentials.h>

+ Collaboration diagram for Poco::Net::HTTPDigestCredentials:

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 &params) 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 &)
 
HTTPDigestCredentialsoperator= (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
 

Detailed Description

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.

Member Typedef Documentation

◆ NonceCounterMap

typedef std::map<std::string, int> Poco::Net::HTTPDigestCredentials::NonceCounterMap
private

Definition at line 150 of file HTTPDigestCredentials.h.

Constructor & Destructor Documentation

◆ HTTPDigestCredentials() [1/3]

Poco::Net::HTTPDigestCredentials::HTTPDigestCredentials ( )

◆ HTTPDigestCredentials() [2/3]

Poco::Net::HTTPDigestCredentials::HTTPDigestCredentials ( const std::string & username,
const std::string & password )

Creates an empty HTTPDigestCredentials object.

◆ ~HTTPDigestCredentials()

Poco::Net::HTTPDigestCredentials::~HTTPDigestCredentials ( )

Creates a HTTPDigestCredentials object with the given username and password.

◆ HTTPDigestCredentials() [3/3]

Poco::Net::HTTPDigestCredentials::HTTPDigestCredentials ( const HTTPDigestCredentials & )
private

Member Function Documentation

◆ authenticate() [1/2]

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.

◆ authenticate() [2/2]

void Poco::Net::HTTPDigestCredentials::authenticate ( HTTPRequest & request,
const HTTPResponse & response )

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

◆ clear()

void Poco::Net::HTTPDigestCredentials::clear ( )

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

◆ createAuthParams()

void Poco::Net::HTTPDigestCredentials::createAuthParams ( const HTTPRequest & request,
const HTTPAuthenticationParams & responseAuthParams )
private

◆ createNonce()

static std::string Poco::Net::HTTPDigestCredentials::createNonce ( )
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.

◆ empty()

bool Poco::Net::HTTPDigestCredentials::empty ( ) const
inline

Returns the password.

Definition at line 177 of file HTTPDigestCredentials.h.

◆ getPassword()

const std::string & Poco::Net::HTTPDigestCredentials::getPassword ( ) const
inline

Sets the password.

Definition at line 171 of file HTTPDigestCredentials.h.

◆ getUsername()

const std::string & Poco::Net::HTTPDigestCredentials::getUsername ( ) const
inline

Sets the username.

Definition at line 165 of file HTTPDigestCredentials.h.

◆ operator=()

HTTPDigestCredentials & Poco::Net::HTTPDigestCredentials::operator= ( const HTTPDigestCredentials & )
private

◆ proxyAuthenticate() [1/2]

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.

◆ proxyAuthenticate() [2/2]

void Poco::Net::HTTPDigestCredentials::proxyAuthenticate ( HTTPRequest & request,
const HTTPResponse & response )

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

◆ reset()

void Poco::Net::HTTPDigestCredentials::reset ( )

Destroys the HTTPDigestCredentials.

◆ setPassword()

void Poco::Net::HTTPDigestCredentials::setPassword ( const std::string & password)

Returns the username.

◆ setUsername()

void Poco::Net::HTTPDigestCredentials::setUsername ( const std::string & username)

Clears both username and password.

◆ updateAuthInfo()

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.

◆ updateAuthParams()

void Poco::Net::HTTPDigestCredentials::updateAuthParams ( const HTTPRequest & request)
private

◆ updateNonceCounter()

int Poco::Net::HTTPDigestCredentials::updateNonceCounter ( const std::string & nonce)
private

◆ updateProxyAuthInfo()

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.

◆ verifyAuthInfo()

bool Poco::Net::HTTPDigestCredentials::verifyAuthInfo ( const HTTPRequest & request) const

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

◆ verifyAuthParams()

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.

Member Data Documentation

◆ _nc

NonceCounterMap Poco::Net::HTTPDigestCredentials::_nc
private

Definition at line 155 of file HTTPDigestCredentials.h.

◆ _nonceCounter

int Poco::Net::HTTPDigestCredentials::_nonceCounter
staticprivate

Definition at line 157 of file HTTPDigestCredentials.h.

◆ _nonceMutex

Poco::FastMutex Poco::Net::HTTPDigestCredentials::_nonceMutex
staticprivate

Definition at line 158 of file HTTPDigestCredentials.h.

◆ _password

std::string Poco::Net::HTTPDigestCredentials::_password
private

Definition at line 153 of file HTTPDigestCredentials.h.

◆ _requestAuthParams

HTTPAuthenticationParams Poco::Net::HTTPDigestCredentials::_requestAuthParams
private

Definition at line 154 of file HTTPDigestCredentials.h.

◆ _username

std::string Poco::Net::HTTPDigestCredentials::_username
private

Definition at line 152 of file HTTPDigestCredentials.h.

◆ ALGORITHM_PARAM

const std::string Poco::Net::HTTPDigestCredentials::ALGORITHM_PARAM
staticprivate

Definition at line 141 of file HTTPDigestCredentials.h.

◆ AUTH_PARAM

const std::string Poco::Net::HTTPDigestCredentials::AUTH_PARAM
staticprivate

Definition at line 146 of file HTTPDigestCredentials.h.

◆ CNONCE_PARAM

const std::string Poco::Net::HTTPDigestCredentials::CNONCE_PARAM
staticprivate

Definition at line 147 of file HTTPDigestCredentials.h.

◆ DEFAULT_ALGORITHM

const std::string Poco::Net::HTTPDigestCredentials::DEFAULT_ALGORITHM
staticprivate

Definition at line 136 of file HTTPDigestCredentials.h.

◆ DEFAULT_QOP

const std::string Poco::Net::HTTPDigestCredentials::DEFAULT_QOP
staticprivate

Definition at line 137 of file HTTPDigestCredentials.h.

◆ NC_PARAM

const std::string Poco::Net::HTTPDigestCredentials::NC_PARAM
staticprivate

Definition at line 148 of file HTTPDigestCredentials.h.

◆ NONCE_PARAM

const std::string Poco::Net::HTTPDigestCredentials::NONCE_PARAM
staticprivate

Definition at line 138 of file HTTPDigestCredentials.h.

◆ OPAQUE_PARAM

const std::string Poco::Net::HTTPDigestCredentials::OPAQUE_PARAM
staticprivate

Definition at line 143 of file HTTPDigestCredentials.h.

◆ QOP_PARAM

const std::string Poco::Net::HTTPDigestCredentials::QOP_PARAM
staticprivate

Definition at line 140 of file HTTPDigestCredentials.h.

◆ REALM_PARAM

const std::string Poco::Net::HTTPDigestCredentials::REALM_PARAM
staticprivate

Definition at line 139 of file HTTPDigestCredentials.h.

◆ RESPONSE_PARAM

const std::string Poco::Net::HTTPDigestCredentials::RESPONSE_PARAM
staticprivate

Definition at line 145 of file HTTPDigestCredentials.h.

◆ SCHEME

const std::string Poco::Net::HTTPDigestCredentials::SCHEME
static

Creates a random nonce string.

Definition at line 126 of file HTTPDigestCredentials.h.

◆ URI_PARAM

const std::string Poco::Net::HTTPDigestCredentials::URI_PARAM
staticprivate

Definition at line 144 of file HTTPDigestCredentials.h.

◆ USERNAME_PARAM

const std::string Poco::Net::HTTPDigestCredentials::USERNAME_PARAM
staticprivate

Definition at line 142 of file HTTPDigestCredentials.h.


The documentation for this class was generated from the following file: