Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/candy-chat/candy.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Langfeld <ben@langfeld.me>2015-04-07 19:22:55 +0300
committerBen Klang <bklang@mojolingo.com>2015-07-22 04:25:38 +0300
commitf4320310e127cca6934161de6c1231800006e6cc (patch)
tree18858e33fd0c9a8818b987578a499dee0ba570fe
parent133e92a63e8d6adf9027f21e45e5eec7b6c7bb89 (diff)
Permit connecting with an alternative authcidfeature/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 <stream:stream to="..." and <bind/>, but use his own credentials in the the <auth/> packet per SASL's separation of authzid and authcid.
-rw-r--r--src/core.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core.js b/src/core.js
index 2296205..0531d66 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 {