Class: SASLClientFactory

SASLClientFactory

Class used to manage and create client-oriented SASL sessions.

new SASLClientFactory()

Creates a new, empty, SASLClientFactory.

Extends

Methods

create(offered, config) → {SASLSession}

Creates a new SASL session with the given offered mechanisms. This method uses the intersection of #enabled and {offered} mechanisms, in the declared order, to determine how to create the session.

If the mechanism defines a "init" method, it is called with a shallow copy of {config}.

Parameters:
Name Type Argument Description
offered String | Array.<String>

The offered mechanism name or names (in no particular order)

config Object <optional>

The session configuration

Inherited From:
Returns:

A new server-oriented session, or null if no offered mechanisms are suitable

Type
SASLSession

register(mech, enable) → {SASLFactory}

Registers a mechanism in this factory.

The argument {mech} defines the operations for this session. It contains the name of the mechanism, optionally a property for a session intializer function, and a property for each step in the process.

The session initializer is expected to take one argument:

  1. an Object representing the initial user-provided configuration.

It returns {true} if the mechanism is ready to use, or {false} if the mechanism cannot be used.

The step functions are named "step<step-name>", camel-cased. Each step function is expected to take two arguments:

  1. an Object representating the mechanism configuration
  2. a Buffer containing octets from the remote endpoint

The function returns either an Object or a Promise. The Object is expected to have the following:

"state"
the next step in the mechanism
"data" (optional)
the Buffer of octets to send to the remote endpoint

Additionally, it can have other properties that are to be exposed out to the user (via sazzle.SASLSession#properties).

Parameters:
Name Type Argument Description
mech Object

The mechanism descriptor

Properties
Name Type Argument Description
name String

The name of the mechanism

init function <optional>

The session initializer for the mechanism

stepStart function

The first processing step

enable Boolean <optional>

true If the mechanism should be enabled immediately (as most-preferred)

Inherited From:
Throws:
If {mech} does not describe a SASL mechanism
Type
TypeError
Returns:

This factory

Type
SASLFactory
Copyright © 2012-2014, Matthew A. Miller
Documentation generated by JSDoc 3.2.2 on 2014-12-04T09:26:33-07:00 using the DocStrap template.