Comments (5)
The idea (which I should be clear is somewhat half-baked) is that new mechanisms could be added by providing a function that returns an object implementing start() and step() methods.
As you say, at present the interface is synchronous. This is not because an asynchronous interface was ruled out, just that the examples I had in mind when writing the code weren't asynchronous (e.g. see below). I agree an asynchronous interface would be better and should not be too difficult a change.
At present the client_mechanisms()/server_mechanisms() functions return objects that have methods for enabling the 'built in' mechanisms (PLAIN, ANONYMOUS & EXTERNAL). You can then also add other mechanisms to that object. Potentially there could be a method to enable all the built in mechs, and maybe have that called based on an argument to the client_mechanisms() call.
from rhea.
An example of using an external library to provide a different mechanism (albeit synchronous).
`var container = require('rhea');
var args = require('../options.js').options({
'username': { describe: 'username to connect with'},
'password': { describe: 'password to connect with'},
'p': { alias: 'port', default: 5672, describe: 'port to connect to'}
}).help('help').argv;
var ScramSha1 = require('sasl-scram-sha-1');
function ExtendedClient (username, password) {
this.initial_args = {username: username, password: password};
this.impl = new ScramSha1();
}
ExtendedClient.prototype.start = function() {
return this.impl.response(this.initial_args);
};
ExtendedClient.prototype.step = function(challenge) {
this.impl.challenge(challenge.toString());
return this.impl.response(this.initial_args);
};
container.on('connection_open', function (context) {
console.log('Connected!');
context.connection.close();
});
container.connect({'port':args.port, 'sasl_mechanisms':{'SCRAM-SHA-1':function () { return new ExtendedClient(args.username, args.password)}}});
`
from rhea.
OK that's kindof what I had figured out - thanks!
from rhea.
@pierreca if you want to open another issue to get an async interface for alternative sasl mechanisms, I'll try to address that as soon as I get some time. I appreciate the feedback!
from rhea.
@grs thanks! no need for now - we're in a place where we use another amqp10 library and are just evaluating the cost to move or support a second option. once we're done investigating maybe we'll come back with requests :)
from rhea.
Related Issues (20)
- Regression in PR #382: Handle transfer with no payload HOT 1
- Receiver (Consumer) does not receive message that are larger than ~4.15kb HOT 3
- How can I access virtual host using rhea with TLS? HOT 13
- Does it supports OAUTH2 mechanism? HOT 2
- ulong correlation_id incorrecly serialized as uuid HOT 3
- Acknowledgments doesnt work HOT 6
- idle_time_out fires which event? HOT 15
- Publish Window Size Property HOT 2
- `NetClientConnectionOptions` and `TlsClientConnectionOptions` should be exported
- Wildcard Topics HOT 15
- loosing messages intermittently while consuming from Azure service bus HOT 1
- Is `absolute_expiry_time` in milliseconds? HOT 7
- amqp:resource-limit-exceeded ERROR HOT 1
- `sendable` event not fired after certain amount of messages HOT 1
- How to use filters dynamically ? HOT 12
- Regenerate or remove ssl certificates for examples
- Connection RabbitMQ through websocket HOT 2
- Sender appears to be ignoring max_frame_size HOT 4
- connection_detail does not support hostname HOT 5
- Issue and question - Detached receivers / draining credits HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rhea.