new SASLFactory()
Properties:
| Name | Type | Description |
|---|---|---|
enabled |
String[] | List of enabled mechanisms, in preference order |
available |
Object | map of available mechanisms, keyed by name |
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 offeredString | Array.<String> The offered mechanism name or names (in no particular order)
configObject <optional>
The session configuration
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:
- 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:
- an Object representating the mechanism configuration
- 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 mechObject The mechanism descriptor
Properties
Name Type Argument Description nameString The name of the mechanism
initfunction <optional>
The session initializer for the mechanism
stepStartfunction The first processing step
enableBoolean <optional>
true If the mechanism should be enabled immediately (as most-preferred)
Throws:
-
If {mech} does not describe a SASL mechanism
- Type
- TypeError
Returns:
This factory
- Type
- SASLFactory