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

#include <AuthorizationBuilder.hpp>

Public Member Functions

 AuthorizationBuilder (const AuthorizationBuilder &orig)
 
std::string usernameRealmAndPassword (const std::string &username, const std::string &realm, const std::string &password)
 
std::string userRealmPassNonceCnonce (const std::string &username, const std::string &realm, const std::string &password, const std::string &nonce, const std::string &cnonce)
 
std::string methodAndURL (const std::string &method, const std::string &url)
 
std::string methodURLAndBodyHash (const std::string &method, const std::string &url, const std::string &bodyHash)
 
std::string response (const std::string &hash1, const std::string &nonce, const std::string &nonceCount, const std::string &clientNonce, const std::string &qop, const std::string &hash2)
 
std::string response (const std::string &hash1, const std::string &nonce, const std::string &hash2)
 

Detailed Description

AuthorizationBuilder class.

Testable helper class to build the parts of the Digest response. Takes various parts of the response and combines them appropriately, using the MD5 hashing algorithm where necessary.

Member Function Documentation

std::string mlclient::internals::AuthorizationBuilder::methodAndURL ( const std::string &  method,
const std::string &  url 
)

Constructs the HA2 hash from the HTTP method and the document portion of the URL.

Parameters
methodThe HTTP method (GET, POST, etc.)
urlThe document path portion of the url.
Returns
The MD5 hash of the values
std::string mlclient::internals::AuthorizationBuilder::methodURLAndBodyHash ( const std::string &  method,
const std::string &  url,
const std::string &  bodyHash 
)

Constructs the alternate HA2 hash from the HTTP method, the path portion of the URL, and the hash of the body contents.

Parameters
methodThe HTTP method (GET, POST, etc.)
urlThe document path portion of the url.
bodyHashThe hash of the body contents.
std::string mlclient::internals::AuthorizationBuilder::response ( const std::string &  hash1,
const std::string &  nonce,
const std::string &  nonceCount,
const std::string &  clientNonce,
const std::string &  qop,
const std::string &  hash2 
)

Construct a digest response.

Parameters
hash1The appropriate HA1 hash
nonceThe server provided nonce
nonceCountThe client side counter to prevent replay attacks.
clientNonceThe client generated nonce
qopThe qop value returned from the server
hash2The approparite HA2 hash
Returns
The MD5 encoded hash of the values
std::string mlclient::internals::AuthorizationBuilder::response ( const std::string &  hash1,
const std::string &  nonce,
const std::string &  hash2 
)

Construct a digest response

Parameters
hash1The appropriate HA1 hash
nonceThe server provided nonce
hash2The approparite HA2 hash
Returns
The MD5 encoded hash of the values
std::string mlclient::internals::AuthorizationBuilder::usernameRealmAndPassword ( const std::string &  username,
const std::string &  realm,
const std::string &  password 
)

Constructs the username password realm hash (one of the candidate HA1 hashes)

Parameters
usernameThe username
realmThe authentication realm
passwordThe user (plaintext) password
Returns
The MD5 hash of the values
std::string mlclient::internals::AuthorizationBuilder::userRealmPassNonceCnonce ( const std::string &  username,
const std::string &  realm,
const std::string &  password,
const std::string &  nonce,
const std::string &  cnonce 
)

Constructs the alternate HA1 construct that includes the nonce and cnonce.

Parameters
usernameThe username
realmThe authentication realm
passwordThe user (plaintext) password
nonceThe server provided nonce
cnonceThe client provided nonce
Returns
The MD5 hash of the values

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