JWT token is now passed as BOSH URL parameter.

This commit is contained in:
paweldomas 2015-12-23 14:57:23 +01:00
parent 9d60af1a9d
commit ca8a147ea6
3 changed files with 16 additions and 17 deletions

View File

@ -325,8 +325,16 @@ function registerListeners() {
"dialog.connectError", pres);
});
APP.xmpp.addListener(XMPPEvents.ROOM_CONNECT_ERROR, function (pres) {
UI.messageHandler.openReportDialog(null,
"dialog.connectError", pres);
if (config.token &&
$(pres).find(
'>error[type="cancel"]' +
'>not-allowed[xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"]'
).length) {
messageHandler.showError("dialog.error", "dialog.tokenAuthFailed");
} else {
UI.messageHandler.openReportDialog(null,
"dialog.connectError", pres);
}
});
APP.xmpp.addListener(XMPPEvents.READY_TO_JOIN, function () {

View File

@ -562,10 +562,6 @@ module.exports = function(XMPP, eventEmitter) {
delete this.presMap["startMuted"];
}
if (config.token) {
pres.c('token', { xmlns: 'http://jitsi.org/jitmeet/auth-token'}).t(config.token).up();
}
pres.up();
this.connection.send(pres);
},

View File

@ -308,21 +308,16 @@ var XMPP = {
configDomain = config.hosts.domain;
}
var jid = configDomain || window.location.hostname;
var password = null;
if (config.token) {
password = config.token;
if (config.id) {
jid = config.id + "@" + jid;
} else {
jid = generateUserName() + "@" + jid;
}
}
connect(jid, password);
connect(jid);
},
createConnection: function () {
var bosh = config.bosh || '/http-bind';
// adds the room name used to the bosh connection
return new Strophe.Connection(bosh + '?room=' + APP.UI.getRoomNode());
bosh += '?room=' + APP.UI.getRoomNode();
if (config.token) {
bosh += "&token=" + config.token;
}
return new Strophe.Connection(bosh);
},
getStatusString: function (status) {
return Strophe.getStatusString(status);