# class SASL | SASL authentication mechanism. More...
Full name | `TelEngine::SASL`
Definition | `#include <libs/yjabber/yatejabber.h>`
Inherits | TelEngine::GenObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- 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)
- inline void buildAuthRspReply (String& buf, const String& rsp)
- inline bool validAuthReply (const String& reply)
- bool buildMD5Challenge (String& buf)
- inline 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 Static Methods

- 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 Members

- bool m_plain
- NamedList* m_params
- String m_realm
- String m_nonce
- String m_cnonce
- unsigned int m_nonceCount

## Detailed Description

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

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

Constructor

Parameters:

plain | True to build a plain password auth object
realm | Optional server realm

~SASL () | ### ~SASL

Destructor

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

Set auth params

Parameters:

user | Optional username
pwd | Optional password

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

Build a client initial auth or challenge response

Parameters:

buf | Destination buffer. It will be filled with Base64 encoded result
digestUri | Digest MD5 URI

Returns: True on success

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

Build a server reply to challenge response

Parameters:

buf | Destination buffer. It will be filled with Base64 encoded result
rsp | The response

inline bool validAuthReply (const String& reply) | ### validAuthReply

Check if a challenge response reply is valid

Parameters:

reply | The reply to check

Returns: True if valid

bool buildMD5Challenge (String& buf) | ### buildMD5Challenge

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

Parameters:

buf | Destination buffer

Returns: True on success

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

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

Parameters:

dest | Destination string
password | The password to use
challengeRsp | True if building a Digest MD5 challenge response, false if building a challenge response reply

bool parsePlain (const DataBlock& buf) | ### parsePlain

Parse plain password auth data

Parameters:

buf | The buffer to parse

Returns: True if succesfully parsed

bool parseMD5Challenge (const String& buf) | ### parseMD5Challenge

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

Parameters:

buf | Already checked for valid UTF8 characters input string

Returns: True on success

bool parseMD5ChallengeRsp (const String& buf) | ### parseMD5ChallengeRsp

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

Parameters:

buf | Already checked for valid UTF8 characters input string

Returns: True on success

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

[static]

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

Parameters:

buf | Input buffer
user | Destination buffer for username part
pwd | Destination buffer for password part
authzid | Optional destination buffer for authorization identity part

Returns: True on success

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

[static]

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

Parameters:

dest | Destination string
params | List of parameters
password | The password to use
challengeRsp | True if building a Digest MD5 challenge response, false if building a challenge response reply

bool m_plain | ### m_plain

NamedList* m_params | ### m_params

String m_realm | ### m_realm

String m_nonce | ### m_nonce

String m_cnonce | ### m_cnonce

unsigned int m_nonceCount | ### m_nonceCount

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.