Yate
Public Member Functions | Static Public Member Functions | Public Attributes
SASL Class Reference

SASL authentication mechanism. More...

#include <yatejabber.h>

Inheritance diagram for SASL:
GenObject

List of all members.

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)

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)

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 ( bool  plain,
const char *  realm = 0 
)

Constructor

Parameters:
plainTrue to build a plain password auth object
realmOptional server realm
~SASL ( ) [inline]

Destructor

References TelEngine::destruct().


Member Function Documentation

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
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(), Base64::encode(), and String::length().

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
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
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
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
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
bool parsePlain ( const DataBlock buf)

Parse plain password auth data

Parameters:
bufThe buffer to parse
Returns:
True if succesfully parsed
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
void setAuthParams ( const char *  user = 0,
const char *  pwd = 0 
)

Set auth params

Parameters:
userOptional username
pwdOptional password
bool validAuthReply ( const String reply) [inline]

Check if a challenge response reply is valid

Parameters:
replyThe reply to check
Returns:
True if valid

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