diff --git a/JitsiConference.js b/JitsiConference.js index 7058408d5..f39d8fafa 100644 --- a/JitsiConference.js +++ b/JitsiConference.js @@ -52,7 +52,7 @@ function JitsiConference(options) { */ JitsiConference.prototype.join = function (password) { if(this.room) - this.room.join(password, this.connection.tokenPassword); + this.room.join(password); }; /** diff --git a/JitsiConnection.js b/JitsiConnection.js index ef1d749d2..aadbff8fa 100644 --- a/JitsiConnection.js +++ b/JitsiConnection.js @@ -1,32 +1,17 @@ var JitsiConference = require("./JitsiConference"); var XMPP = require("./modules/xmpp/xmpp"); -var RandomUtil = require("./modules/util/RandomUtil"); - -/** - * Utility method that generates user name based on random hex values. - * Eg. 12345678-1234-1234-12345678 - * @returns {string} - */ -function generateUserName() { - return RandomUtil.random8digitsHex() + "-" + RandomUtil.random4digitsHex() + "-" + - RandomUtil.random4digitsHex() + "-" + RandomUtil.random8digitsHex(); -} /** * Creates new connection object for the Jitsi Meet server side video conferencing service. Provides access to the * JitsiConference interface. * @param appID identification for the provider of Jitsi Meet video conferencing services. - * @param tokenPassword secret generated by the provider of Jitsi Meet video conferencing services. - * The token will be send to the provider from the Jitsi Meet server deployment for authorization of the current client. - * The format is: - * passwordToken = token + "_" + roomName + "_" + ts - * See doc/tokens.md for more info on how tokens are generated. + * @param token the JWT token used to authenticate with the server(optional) * @param options Object with properties / settings related to connection with the server. * @constructor */ -function JitsiConnection(appID, tokenPassword, options) { +function JitsiConnection(appID, token, options) { this.appID = appID; - this.tokenPassword = tokenPassword; + this.token = token; this.options = options; this.xmpp = new XMPP(options); this.conferences = {}; @@ -40,14 +25,6 @@ JitsiConnection.prototype.connect = function (options) { if(!options) options = {}; - // If we have token provided use it as a password and generate random username - if (this.tokenPassword) { - options.password = this.tokenPassword; - if (!options.id) { - options.id = generateUserName() + "@" + this.options.hosts.domain; - } - } - this.xmpp.connect(options.id, options.password); } diff --git a/libs/strophe/strophe.js b/libs/strophe/strophe.js index 0c484549f..3ccfa77a3 100644 --- a/libs/strophe/strophe.js +++ b/libs/strophe/strophe.js @@ -2640,10 +2640,12 @@ Strophe.Connection.prototype = { } if (!acceptable) { + console.error("req: ", elem, "Resp:", stanza); throw { name: "StropheError", message: "Got answer to IQ from wrong jid:" + from + - "\nExpected jid: " + expectedFrom + "\nExpected jid: " + expectedFrom +"" + + "\n stanza to String: " + stanza.toString() }; } diff --git a/modules/xmpp/ChatRoom.js b/modules/xmpp/ChatRoom.js index 9ace80a71..672eb8326 100644 --- a/modules/xmpp/ChatRoom.js +++ b/modules/xmpp/ChatRoom.js @@ -112,17 +112,17 @@ ChatRoom.prototype.updateDeviceAvailability = function (devices) { }); }; -ChatRoom.prototype.join = function (password, tokenPassword) { +ChatRoom.prototype.join = function (password) { if(password) this.password = password; var self = this; this.moderator.allocateConferenceFocus(function() { - self.sendPresence(tokenPassword); + self.sendPresence(); }.bind(this)); }; -ChatRoom.prototype.sendPresence = function (tokenPassword) { +ChatRoom.prototype.sendPresence = function () { if (!this.presMap['to']) { // Too early to send presence - not initialized return; @@ -142,11 +142,6 @@ ChatRoom.prototype.sendPresence = function (tokenPassword) { pres.c('c', this.connection.caps.generateCapsAttrs()).up(); } - if (tokenPassword) { - pres.c('token', { xmlns: 'http://jitsi.org/jitmeet/auth-token'}) - .t(tokenPassword).up(); - } - parser.JSON2packet(this.presMap.nodes, pres); this.connection.send(pres); }; diff --git a/modules/xmpp/xmpp.js b/modules/xmpp/xmpp.js index ec1409c6b..74514c916 100644 --- a/modules/xmpp/xmpp.js +++ b/modules/xmpp/xmpp.js @@ -14,6 +14,12 @@ var authenticatedUser = false; function createConnection(bosh) { bosh = bosh || '/http-bind'; + // Append token as URL param + if (this.token) { + bosh += bosh.indexOf('?') == -1 ? + '?token=' + this.token : '&token=' + this.token; + } + return new Strophe.Connection(bosh); };