Constructor
new SASLMechanism(nameopt, isClientFirstopt, priorityopt)
PrivateConstructor: Strophe.SASLMechanism SASL auth mechanism abstraction.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String |
<optional> |
SASL Mechanism name. |
isClientFirst |
Boolean |
<optional> |
If client should send response first without challenge. |
priority |
Number |
<optional> |
Priority. |
Members
isClientFirst
If client sends response without initial server challenge.
mechname
Mechanism name.
priority
Determines which SASLMechanism is chosen for authentication (Higher is better). Users may override this to prioritize mechanisms differently.
Example: (This will cause Strophe to choose the mechanism that the server sent first)
Strophe.SASLPlain.priority = Strophe.SASLSHA1.priority;
See
Methods
clientChallenge(connection) → {string|Promise.<(string|false)>}
Called by the protocol implementation if the client is expected to send data first in the authentication exchange (i.e. isClientFirst === true).
Parameters:
Name | Type | Description |
---|---|---|
connection |
Connection | Target Connection. |
Returns:
Mechanism response.
- Type
- string | Promise.<(string|false)>
onChallenge(connection, challengeopt) → {string|Promise.<(string|false)>}
Called by protocol implementation on incoming challenge.
By deafult, if the client is expected to send data first (isClientFirst === true),
this method is called with challenge
as null on the first call,
unless clientChallenge
is overridden in the relevant subclass.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
connection |
Connection | Target Connection. |
|
challenge |
string |
<optional> |
current challenge to handle. |
Returns:
Mechanism response.
- Type
- string | Promise.<(string|false)>
onFailure()
Protocol informs mechanism implementation about SASL failure.
onStart(connection)
Called before starting mechanism on some connection.
Parameters:
Name | Type | Description |
---|---|---|
connection |
Connection | Target Connection. |
onSuccess()
Protocol informs mechanism implementation about SASL success.
test(connection) → {boolean}
Checks if mechanism able to run. To disable a mechanism, make this return false;
To disable plain authentication run
Strophe.SASLPlain.test = function() { return false; }
See
Parameters:
Name | Type | Description |
---|---|---|
connection |
Connection | Target Connection. |
Returns:
If mechanism was able to run.
- Type
- boolean