From 9ce5d8810c157553355d743b3dd1bb50b5d2b1eb Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Tue, 7 Apr 2015 13:16:50 -0300 Subject: [PATCH 1/4] Use upstream strophejs-plugins --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index b4f50d23..c980b87c 100644 --- a/bower.json +++ b/bower.json @@ -33,7 +33,7 @@ "dependencies": { "jquery": "~1.10.2", "strophe": "1.1.3", - "strophejs-plugins": "benlangfeld/strophejs-plugins#30fb089457addc37e01d69c3536dee868a90a9ad", + "strophejs-plugins": "strophe/strophejs-plugins#07db748ca084a951709969f1002e4c4614af5fcf", "mustache": "0.3.0", "jquery-i18n": "1.1.1" } From 6ffcec32ae001837d27d86b45c857afb7dc557ff Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Wed, 15 Apr 2015 10:38:36 -0300 Subject: [PATCH 2/4] Upgrade to latest Strophe.js release --- bower.json | 6 +++--- tests/intern.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bower.json b/bower.json index c980b87c..2944fb82 100644 --- a/bower.json +++ b/bower.json @@ -31,9 +31,9 @@ "tests" ], "dependencies": { - "jquery": "~1.10.2", - "strophe": "1.1.3", - "strophejs-plugins": "strophe/strophejs-plugins#07db748ca084a951709969f1002e4c4614af5fcf", + "jquery": "~1.11.0", + "strophe": "strophe/strophejs#1.2.1", + "strophejs-plugins": "strophe/strophejs-plugins#39d67d66e900bce8b990d9214bffe6593a96ddf7", "mustache": "0.3.0", "jquery-i18n": "1.1.1" } diff --git a/tests/intern.js b/tests/intern.js index 52d41405..22007b01 100644 --- a/tests/intern.js +++ b/tests/intern.js @@ -51,7 +51,7 @@ define({ // Packages that should be registered with the loader in each testing environment packages: [ { name: 'candy', location: '.' } - , { name: 'jquery', location: 'bower_components/jquery', main: 'jquery' } + , { name: 'jquery', location: 'bower_components/jquery/dist', main: 'jquery' } , { name: 'sinon', location: 'node_modules/sinon/lib', main: 'sinon' } , { name: 'sinon-chai', location: 'node_modules/sinon-chai/lib', main: 'sinon-chai' } , { name: 'lolex', location: 'node_modules/lolex', main: 'lolex' } From 133e92a63e8d6adf9027f21e45e5eec7b6c7bb89 Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Wed, 15 Apr 2015 11:30:18 -0300 Subject: [PATCH 3/4] Released StropheJS has a bug in AMD definition Fixed at https://github.com/strophe/strophejs/commit/fb717ab6fe6b7776659d2204807f99a28e92f651 --- bower.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bower.json b/bower.json index 2944fb82..4b579e5a 100644 --- a/bower.json +++ b/bower.json @@ -32,9 +32,12 @@ ], "dependencies": { "jquery": "~1.11.0", - "strophe": "strophe/strophejs#1.2.1", + "strophe": "strophe/strophejs#72914b87f56cf12e5e6a40c293cb9c6397bc7d16", "strophejs-plugins": "strophe/strophejs-plugins#39d67d66e900bce8b990d9214bffe6593a96ddf7", "mustache": "0.3.0", "jquery-i18n": "1.1.1" + }, + "resolutions": { + "strophe": "72914b87f56cf12e5e6a40c293cb9c6397bc7d16" } } From f4320310e127cca6934161de6c1231800006e6cc Mon Sep 17 00:00:00 2001 From: Ben Langfeld Date: Tue, 7 Apr 2015 13:22:55 -0300 Subject: [PATCH 4/4] Permit connecting with an alternative authcid This permits imitation of other users (for example, if usera@example.com is allowed to create a session as userb@example.com, he will provide the JID userb@example.com in , but use his own credentials in the the packet per SASL's separation of authzid and authcid. --- src/core.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core.js b/src/core.js index 22962050..0531d667 100644 --- a/src/core.js +++ b/src/core.js @@ -261,8 +261,9 @@ Candy.Core = (function(self, Strophe, $) { * (String) password - Password of the user * (String) nick - Nick of the user. Set one if you want to anonymously connect but preset a nick. If jidOrHost is a domain * and this param is not set, Candy will prompt for a nick. + * (String) authcid - Authentication identity (username) if different from the JID. */ - self.connect = function(jidOrHost, password, nick) { + self.connect = function(jidOrHost, password, nick, authcid) { // Reset before every connection attempt to make sure reconnections work after authfail, alltabsclosed, ... _connection.reset(); self.registerEventHandlers(); @@ -291,7 +292,7 @@ Candy.Core = (function(self, Strophe, $) { } // authentication - _connection.connect(_getEscapedJidFromJid(jidOrHost) + '/' + _options.resource, password, Candy.Core.Event.Strophe.Connect); + _connection.connect(_getEscapedJidFromJid(jidOrHost) + '/' + _options.resource, password, Candy.Core.Event.Strophe.Connect, undefined, undefined, undefined, authcid); if (nick) { _user = new self.ChatUser(jidOrHost, nick); } else {