Yate
SASL Class Reference

SASL authentication mechanism. More...

#include <yatejabber.h>

Inheritance diagram for SASL:
GenObject

Public Member Functions

 SASL (bool plain, const char *realm=0)
 
 ~SASL ()
 
void setAuthParams (const char *user=0, const char *pwd=0)
 
bool buildAuthRsp (String &buf, const char *digestUri=0)
 
void buildAuthRspReply (String &buf, const String &rsp)
 
bool validAuthReply (const String &reply)
 
bool buildMD5Challenge (String &buf)
 
void buildMD5Digest (String &dest, const char *password, bool challengeRsp=true)
 
bool parsePlain (const DataBlock &buf)
 
bool parseMD5Challenge (const String &buf)
 
bool parseMD5ChallengeRsp (const String &buf)
 
- Public Member Functions inherited from GenObject
 GenObject ()
 
virtual ~GenObject ()
 
virtual bool alive () const
 
virtual void destruct ()
 
virtual const StringtoString () const
 
virtual const StringtraceId () const
 
virtual void * getObject (const String &name) const
 
NamedCountergetObjCounter () const
 
NamedCountersetObjCounter (NamedCounter *counter)
 

Static Public Member Functions

static bool parsePlain (const DataBlock &buf, String &user, String &pwd, String *authzid=0)
 
static void buildMD5Digest (String &dest, const NamedList &params, const char *password, bool challengeRsp=true)
 
- Static Public Member Functions inherited from GenObject
static void * getObject (const String &name, const GenObject *obj)
 
static bool getObjCounting ()
 
static void setObjCounting (bool enable)
 
static NamedCountergetObjCounter (const String &name, bool create=true)
 
static ObjListgetObjCounters ()
 

Public Attributes

bool m_plain
 
NamedListm_params
 
String m_realm
 
String m_nonce
 
String m_cnonce
 
unsigned int m_nonceCount
 

Detailed Description

SASL authentication mechanism.

This class handles PLAIN (rfc 4616) and DIGEST (rfc 2831) SASL authentication

Constructor & Destructor Documentation

◆ SASL()

SASL ( bool plain,
const char * realm = 0 )

Constructor

Parameters
plainTrue to build a plain password auth object
realmOptional server realm

Referenced by buildMD5Digest().

◆ ~SASL()

~SASL ( )
inline

Destructor

Member Function Documentation

◆ buildAuthRsp()

bool buildAuthRsp ( String & buf,
const char * digestUri = 0 )

Build a client initial auth or challenge response

Parameters
bufDestination buffer. It will be filled with Base64 encoded result
digestUriDigest MD5 URI
Returns
True on success

◆ buildAuthRspReply()

void buildAuthRspReply ( String & buf,
const String & rsp )
inline

Build a server reply to challenge response

Parameters
bufDestination buffer. It will be filled with Base64 encoded result
rspThe response

References String::c_str(), DataBlock::clear(), Base64::encode(), and String::length().

◆ buildMD5Challenge()

bool buildMD5Challenge ( String & buf)

Build an MD5 challenge from this object. Generate a new nonce and increase nonce count

Parameters
bufDestination buffer
Returns
True on success

◆ buildMD5Digest() [1/2]

void buildMD5Digest ( String & dest,
const char * password,
bool challengeRsp = true )
inline

Build a Digest MD5 SASL (RFC 2831) to be sent with authentication responses

Parameters
destDestination string
passwordThe password to use
challengeRspTrue if building a Digest MD5 challenge response, false if building a challenge response reply

References buildMD5Digest().

Referenced by buildMD5Digest(), and validAuthReply().

◆ buildMD5Digest() [2/2]

static void buildMD5Digest ( String & dest,
const NamedList & params,
const char * password,
bool challengeRsp = true )
static

Build a Digest MD5 SASL (RFC 2831) to be sent with authentication responses

Parameters
destDestination string
paramsList of parameters
passwordThe password to use
challengeRspTrue if building a Digest MD5 challenge response, false if building a challenge response reply

References SASL().

◆ parseMD5Challenge()

bool parseMD5Challenge ( const String & buf)

Parse and decode a buffer containing a SASL Digest MD5 challenge.

Parameters
bufAlready checked for valid UTF8 characters input string
Returns
True on success

◆ parseMD5ChallengeRsp()

bool parseMD5ChallengeRsp ( const String & buf)

Parse and decode a buffer containing a SASL Digest MD5 response. Check realm, nonce and nonce count

Parameters
bufAlready checked for valid UTF8 characters input string
Returns
True on success

◆ parsePlain() [1/2]

bool parsePlain ( const DataBlock & buf)

Parse plain password auth data

Parameters
bufThe buffer to parse
Returns
True if succesfully parsed

◆ parsePlain() [2/2]

static bool parsePlain ( const DataBlock & buf,
String & user,
String & pwd,
String * authzid = 0 )
static

Parse and decode a buffer containing SASL plain authentication data as defined in RFC 4616

Parameters
bufInput buffer
userDestination buffer for username part
pwdDestination buffer for password part
authzidOptional destination buffer for authorization identity part
Returns
True on success

◆ setAuthParams()

void setAuthParams ( const char * user = 0,
const char * pwd = 0 )

Set auth params

Parameters
userOptional username
pwdOptional password

◆ validAuthReply()

bool validAuthReply ( const String & reply)
inline

Check if a challenge response reply is valid

Parameters
replyThe reply to check
Returns
True if valid

References buildMD5Digest().


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