MarkLogic Connect
MarkLogic Connect Client API Collection
Public Member Functions | Protected Member Functions | Friends | List of all members
mlclient::internals::Credentials Class Reference

#include <Credentials.hpp>

Public Member Functions

 Credentials ()
 
 Credentials (const std::string &username, const std::string &password)
 
 Credentials (const std::string &username, const std::string &password, const std::string &cnonce, const uint32_t &nc)
 
 Credentials (const std::wstring &username, const std::wstring &password)
 
bool canAuthenticate (void) const
 
void parseWWWAuthenticateHeader (const std::string &_raw)
 
std::string getNonce (void) const
 
std::string getQop (void) const
 
std::string getOpaque (void) const
 
std::string getRealm (void) const
 

Protected Member Functions

std::string authenticate (const std::string &method, const std::string &uri, const std::string &auth_header)
 
std::string authenticate (const std::string &method, const std::string &uri)
 
std::string generateRandomCnonce (void) const
 

Friends

class AuthenticatingProxy
 

Detailed Description

Used to manage the credentials for digest authentication. Normally the username and password are initially known. As part of the Digest challenge, the server will return a qop value, nonce, and relam. The client is responsible for generating a client side nonce and for managing the nonce count.

Constructor & Destructor Documentation

mlclient::internals::Credentials::Credentials ( )

Constructor

mlclient::internals::Credentials::Credentials ( const std::string &  username,
const std::string &  password 
)

Constructor

Parameters
usernameThe username
passwordThe user's (plaintext) password
mlclient::internals::Credentials::Credentials ( const std::string &  username,
const std::string &  password,
const std::string &  cnonce,
const uint32_t &  nc 
)

Constructor

Parameters
usernameThe username
passwordThe user's (plaintext) password
cnonceThe client side nonce
ncThe nonce count
mlclient::internals::Credentials::Credentials ( const std::wstring &  username,
const std::wstring &  password 
)

Constructor

Parameters
usernameThe username
passwordThe user's (plaintext) password

Member Function Documentation

std::string mlclient::internals::Credentials::authenticate ( const std::string &  method,
const std::string &  uri,
const std::string &  auth_header 
)
protected

Generate the authentication header contents. This is what goes into the Authorize header. Parses the incoming authenticate header to produce the response header.

Parameters
methodThe HTTP method used.
uriThe path portion of the URI
auth_headerThe contents of the WWW Authenticate header
Returns
The contents of the Authorization header
std::string mlclient::internals::Credentials::authenticate ( const std::string &  method,
const std::string &  uri 
)
protected

Generate the authentication header contents. This is what goes into the Authorize header. Requires that the credentials are set up to perform authentication and have a qop and nonce.

Parameters
methodThe HTTP method used.
uriThe path portion of the URI
Returns
The contents of the Authorization header
bool mlclient::internals::Credentials::canAuthenticate ( void  ) const

Returns the if the credentials are capable of generating a response to the digest challenge.

Returns
Weather or not it can generate a challenge response
std::string mlclient::internals::Credentials::generateRandomCnonce ( void  ) const
protected

Generate a random client nonce.

Returns
A random nonce value
std::string mlclient::internals::Credentials::getNonce ( void  ) const

Returns the server provided nonce

Returns
The nonce
std::string mlclient::internals::Credentials::getOpaque ( void  ) const

Returns the server provided opaque value

Returns
The opaque
std::string mlclient::internals::Credentials::getQop ( void  ) const

Returns the server provided qop

Returns
The qop
std::string mlclient::internals::Credentials::getRealm ( void  ) const

Returns the server provided realm

Returns
The realm
void mlclient::internals::Credentials::parseWWWAuthenticateHeader ( const std::string &  _raw)

Parses the Authenticate header to extract the nonce, the qop and the realm. Once the credentials have been provided the authenticate header, the credentials will be capable of formulating a response to the digest challenge.

Parameters
_rawThe raw WWW Authenticate header

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