class Poco::Net::HTTPAuthenticationParams

Overview

Collection of name-value pairs of HTTP authentication header (i.e. More…

#include <HTTPAuthenticationParams.h>

class HTTPAuthenticationParams: public Poco::Net::NameValueCollection
{
public:
    // fields

    static const std::string REALM;
    static const std::string WWW_AUTHENTICATE;
    static const std::string PROXY_AUTHENTICATE;

    // construction

    HTTPAuthenticationParams();
    HTTPAuthenticationParams(const std::string& authInfo);
    HTTPAuthenticationParams(const HTTPRequest& request);

    HTTPAuthenticationParams(
        const HTTPResponse& response,
        const std::string& header = WWW_AUTHENTICATE
        );

    // methods

    HTTPAuthenticationParams&
    operator=(const HTTPAuthenticationParams& authParams);

    void
    fromAuthInfo(const std::string& authInfo);

    void
    fromRequest(const HTTPRequest& request);

    void
    fromResponse(
        const HTTPResponse& response,
        const std::string& header = WWW_AUTHENTICATE
        );

    void
    setRealm(const std::string& realm);

    const std::string&
    getRealm() const;

    std::string
    toString() const;
};

Inherited Members

public:
    // typedefs

    typedef Poco::ListMap<std::string, std::string> HeaderMap;
    typedef HeaderMap::Iterator Iterator;
    typedef HeaderMap::ConstIterator ConstIterator;

    // methods

    NameValueCollection&
    operator=(const NameValueCollection& nvc);

    void
    swap(NameValueCollection& nvc);

    const std::string&
    operator[](const std::string& name) const;

    void
    set(
        const std::string& name,
        const std::string& value
        );

    void
    add(
        const std::string& name,
        const std::string& value
        );

    const std::string&
    get(const std::string& name) const;

    const std::string&
    get(
        const std::string& name,
        const std::string& defaultValue
        ) const;

    bool
    has(const std::string& name) const;

    ConstIterator
    find(const std::string& name) const;

    ConstIterator
    begin() const;

    ConstIterator
    end() const;

    bool
    empty() const;

    std::size_t
    size() const;

    void
    erase(const std::string& name);

    void
    clear();

Detailed Documentation

Collection of name-value pairs of HTTP authentication header (i.e.

“realm”, “qop”, “nonce” in case of digest authentication header).

Construction

HTTPAuthenticationParams()

Creates an empty authentication parameters collection.

HTTPAuthenticationParams(const std::string& authInfo)

See fromAuthInfo() documentation.

HTTPAuthenticationParams(const HTTPRequest& request)

See fromRequest() documentation.

HTTPAuthenticationParams(
    const HTTPResponse& response,
    const std::string& header = WWW_AUTHENTICATE
    )

See fromResponse() documentation.

Methods

HTTPAuthenticationParams&
operator=(const HTTPAuthenticationParams& authParams)

Assigns the content of another HTTPAuthenticationParams.

void
fromAuthInfo(const std::string& authInfo)

Creates an HTTPAuthenticationParams by parsing authentication information.

void
fromRequest(const HTTPRequest& request)

Extracts authentication information from the request and creates HTTPAuthenticationParams by parsing it.

Throws a NotAuthenticatedException if no authentication information is contained in request. Throws a InvalidArgumentException if authentication scheme is unknown or invalid.

void
fromResponse(
    const HTTPResponse& response,
    const std::string& header = WWW_AUTHENTICATE
    )

Extracts authentication information from the response and creates HTTPAuthenticationParams by parsing it.

Throws a NotAuthenticatedException if no authentication information is contained in response. Throws a InvalidArgumentException if authentication scheme is unknown or invalid.

void
setRealm(const std::string& realm)

Sets the “realm” parameter to the provided string.

const std::string&
getRealm() const

Returns value of the “realm” parameter.

Throws NotFoundException is there is no “realm” set in the HTTPAuthenticationParams.

std::string
toString() const

Formats the HTTPAuthenticationParams for inclusion in HTTP request or response authentication header.