crossbario / autobahn-js

WAMP in JavaScript for Browsers and NodeJS
http://crossbar.io/autobahn
MIT License
1.43k stars 228 forks source link

Feature Request: return a promise in onchallenge #178

Closed konsultaner closed 6 years ago

konsultaner commented 8 years ago

I would like to have the chance to return a promise for the signature creation in the onchallenge handler. Some two factor authentications like oAuth2 have a async signature or token creation. I currently try to connect WAMP to oAuth2.

something like that:

return function (session, method, extra) {
    if (method === "wampcra") {
        return autobahn.auth_cra.sign(autobahn.auth_cra.derive_key(password || "", extra.salt,extra.iterations,extra.keylen), extra.challenge);
    } else if (method === "oauth2.authorization_code_grant") {
        return new Promise(...);
    }
}
oberstet commented 8 years ago

Yes, agreed. That would be useful!

konsultaner commented 6 years ago

@oberstet according to

https://github.com/cujojs/when/issues/505#issuecomment-374581157

and

https://github.com/crossbario/autobahn-js/blob/8ad8f0ece7112d9dca82f80240b28042b578474f/lib/session.js#L930

this issue is solved?

oberstet commented 6 years ago

yep, solved