SourcePro® API Reference Guide

 
List of all members | Public Member Functions | Static Protected Member Functions
RWHttpBasicAuthorizationHeader Class Reference

Helper class that defines an Authorization header for Basic Access Authentication. More...

#include <rw/http/RWHttpBasicAuthorizationHeader.h>

Inheritance diagram for RWHttpBasicAuthorizationHeader:
RWHttpAuthorizationHeaderBase RWHttpHeaderBase

Public Member Functions

 RWHttpBasicAuthorizationHeader ()
 
 RWHttpBasicAuthorizationHeader (const RWCString &username, const RWCString &password, bool padding=false)
 
 RWHttpBasicAuthorizationHeader (const RWHttpGenericHeader &hdr)
 
RWCString getPassword () const
 
RWCString getUsername () const
 
virtual RWCString getValue () const
 
void setPassword (const RWCString &password)
 
void setUsername (const RWCString &username)
 
- Public Member Functions inherited from RWHttpHeaderBase
virtual bool append (const RWCString &str)
 
virtual RWCString asString (void) const
 
RWCString getLabel (void) const
 
RWHttpHeaderType getType () const
 
bool operator!= (const RWHttpHeaderBase &) const
 
bool operator< (const RWHttpHeaderBase &hdr) const
 
bool operator== (const RWHttpHeaderBase &h) const
 

Static Protected Member Functions

static RWCString decodeString (const RWCString &str)
 
static RWCString encodeString (const RWCString &str, bool padding)
 

Additional Inherited Members

- Static Public Member Functions inherited from RWHttpHeaderBase
static unsigned hash (const RWHttpHeaderBase &)
 
- Protected Member Functions inherited from RWHttpAuthorizationHeaderBase
 RWHttpAuthorizationHeaderBase ()
 
- Protected Member Functions inherited from RWHttpHeaderBase
 RWHttpHeaderBase (void)
 
 RWHttpHeaderBase (const RWCString &label, RWHttpHeaderType type=RW_HTTP_ENTITY_HEADER)
 

Detailed Description

RWHttpBasicAuthorizationHeader is a specialization class of RWHttpAuthorizationHeaderBase. It is a helper class that formats and encodes its contents as Authorization: basic header_value, where header_value is the username and password used for basic authentication.

Constructor & Destructor Documentation

RWHttpBasicAuthorizationHeader::RWHttpBasicAuthorizationHeader ( )
inline

Constructs a default RWHttpBasicAuthorizationHeader object with the label Authorization and the username and password set to empty strings.

RWHttpBasicAuthorizationHeader::RWHttpBasicAuthorizationHeader ( const RWCString username,
const RWCString password,
bool  padding = false 
)
inline

Constructs a RWHttpBasicAuthorizationHeader object with the label Authorization, a username of username, and a password of password.

RWHttpBasicAuthorizationHeader::RWHttpBasicAuthorizationHeader ( const RWHttpGenericHeader hdr)

Constructs an RWHttpBasicAuthorizationHeader object from an RWHttpGenericHeader representing a basic Authorization HTTP header. If the RWHttpGenericHeader does not represent a basic Authorization HTTP header or if the value of the RWHttpGenericHeader does not conform to the formatting of a basic Authorization value, an RWHttpHeaderParseError exception is thrown.

Member Function Documentation

static RWCString RWHttpBasicAuthorizationHeader::decodeString ( const RWCString str)
staticprotected

Returns a RWCString representing the plain text version of the base64 encoded string str. The RWCString should contain 7-bit US-ASCII data.

static RWCString RWHttpBasicAuthorizationHeader::encodeString ( const RWCString str,
bool  padding 
)
staticprotected

Returns a RWCString representing the base64 encoded version of str. The RWCString should contain 7-bit US-ASCII data.

RWCString RWHttpBasicAuthorizationHeader::getPassword ( void  ) const
inline

Returns the internal value of password as a RWCString.

RWCString RWHttpBasicAuthorizationHeader::getUsername ( void  ) const
inline

Returns the internal value of username as a RWCString.

virtual RWCString RWHttpBasicAuthorizationHeader::getValue ( ) const
virtual

Returns a RWCString consisting of the word Basic followed by a base64 encoded string representing username:password.

Implements RWHttpHeaderBase.

void RWHttpBasicAuthorizationHeader::setPassword ( const RWCString password)
inline

Assigns password to the internal password.

void RWHttpBasicAuthorizationHeader::setUsername ( const RWCString username)
inline

Assigns username to the internal username.

Copyright © 2023 Rogue Wave Software, Inc., a Perforce company. All Rights Reserved.