Anonymous Login in Openfire with Strophe
I am running openfire 3.6.4 and connecting with Strophe library. The setup is working fine. Now i want to do one thing i want a anon开发者_如何学Goymous login for my application and that login should also get subscribed to a room and receive the notification of that room. I have enabled the anonymous setting in openfire.
First, enable SASL ANONYMOUS in Strophe by passing in null for username and password to connect()
:
connection.connect(null,
null,
onConnect);
Next, just send presence to room@conference_service/nick:
var pres = $pres({to: 'room@conference_service/nick'});
connection.send(pres);
I did it by changing strophe.js
find: if (Strophe.getNodeFromJid(this.jid) === null &&
do_sasl_anonymous) {
Change to :
if (Strophe.getNodeFromJid(this.jid) === '' &&
do_sasl_anonymous) {
By changing the comparison of the Jid node from null to empty, I was able to authenticate anonymously when only submitting the domain part of the Jid, and still was able to authenticate with DIGEST when sumitting the full Jid and the password.
精彩评论