Skip to content
This repository has been archived by the owner on Nov 21, 2024. It is now read-only.

Commit

Permalink
Permit connecting with an alternative authcid
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
benlangfeld committed Apr 15, 2015
1 parent 80e058f commit ae07a58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 4 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
5 changes: 3 additions & 2 deletions src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ae07a58

Please sign in to comment.