amqp-node
Version:
An AMQP 0-9-1 (e.g., RabbitMQ) library and client.
32 lines (27 loc) • 748 B
JavaScript
;
// Different kind of credentials that can be supplied when opening a
// connection, corresponding to SASL mechanisms There's only two
// useful mechanisms that RabbitMQ implements:
// * PLAIN (send username and password in the plain)
// * EXTERNAL (assume the server will figure out who you are from
// context, i.e., your SSL certificate)
var plain = function (user, passwd) {
return {
mechanism: 'PLAIN',
response: function () {
return new Buffer(['', user, passwd].join(String.fromCharCode(0)))
}
};
};
var external = function () {
return {
mechanism: 'EXTERNAL',
response: function () {
return new Buffer('');
}
};
};
module.exports = {
plain: plain,
external: external
};