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 [email protected] is allowed to create a session as [email protected], he will provide the JID [email protected] 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 d977990 commit ce92afd
Showing 1 changed file with 3 additions and 2 deletions.
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 ce92afd

Please sign in to comment.