added 2 methods to the conference related to external auth
This commit is contained in:
parent
c1867a64e0
commit
ba1ee6d360
|
@ -1,4 +1,4 @@
|
|||
/* global Strophe, $ */
|
||||
/* global Strophe, $, Promise */
|
||||
/* jshint -W101 */
|
||||
var logger = require("jitsi-meet-logger").getLogger(__filename);
|
||||
var RTC = require("./modules/RTC/RTC");
|
||||
|
@ -52,6 +52,13 @@ JitsiConference.prototype.join = function (password) {
|
|||
this.room.join(password, this.connection.tokenPassword);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if joined to the conference.
|
||||
*/
|
||||
JitsiConference.prototype.isJoined = function () {
|
||||
return this.room && this.room.joined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Leaves the conference.
|
||||
*/
|
||||
|
@ -61,6 +68,40 @@ JitsiConference.prototype.leave = function () {
|
|||
this.room = null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns name of this conference.
|
||||
*/
|
||||
JitsiConference.prototype.getName = function () {
|
||||
return this.options.name;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if external authentication is enabled for this conference.
|
||||
*/
|
||||
JitsiConference.prototype.isExternalAuthEnabled = function () {
|
||||
return this.room && this.room.moderator.isExternalAuthEnabled();
|
||||
};
|
||||
|
||||
/**
|
||||
* Get url for external authentication.
|
||||
* @param {boolean} [urlForPopup] if true then return url for login popup,
|
||||
* else url of login page.
|
||||
* @returns {Promise}
|
||||
*/
|
||||
JitsiConference.prototype.getExternalAuthUrl = function (urlForPopup) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (!this.isExternalAuthEnabled()) {
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
if (urlForPopup) {
|
||||
this.room.moderator.getPopupLoginUrl(resolve, reject);
|
||||
} else {
|
||||
this.room.moderator.getLoginUrl(resolve, reject);
|
||||
}
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the local tracks.
|
||||
*/
|
||||
|
@ -267,7 +308,7 @@ JitsiConference.prototype.lock = function (password) {
|
|||
}, function (err) {
|
||||
reject(err);
|
||||
}, function () {
|
||||
reject(JitsiConferenceErrors.PASSWORD_REQUIRED);
|
||||
reject(JitsiConferenceErrors.PASSWORD_NOT_SUPPORTED);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
@ -478,6 +519,18 @@ function setupListeners(conference) {
|
|||
conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
|
||||
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_JOINED);
|
||||
});
|
||||
conference.room.addListener(XMPPEvents.ROOM_JOIN_ERROR, function (pres) {
|
||||
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONNECTION_ERROR, pres);
|
||||
});
|
||||
conference.room.addListener(XMPPEvents.ROOM_CONNECT_ERROR, function (pres) {
|
||||
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.CONNECTION_ERROR, pres);
|
||||
});
|
||||
conference.room.addListener(XMPPEvents.PASSWORD_REQUIRED, function (pres) {
|
||||
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.PASSWORD_REQUIRED, pres);
|
||||
});
|
||||
conference.room.addListener(XMPPEvents.AUTHENTICATION_REQUIRED, function () {
|
||||
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.AUTHENTICATION_REQUIRED);
|
||||
});
|
||||
// FIXME
|
||||
// conference.room.addListener(XMPPEvents.MUC_JOINED, function () {
|
||||
// conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_LEFT);
|
||||
|
@ -501,7 +554,7 @@ function setupListeners(conference) {
|
|||
conference.eventEmitter.emit(JitsiConferenceEvents.CONNECTION_RESTORED);
|
||||
});
|
||||
conference.room.addListener(XMPPEvents.CONFERENCE_SETUP_FAILED, function () {
|
||||
conference.eventEmitter.emit(JitsiConferenceEvents.SETUP_FAILED);
|
||||
conference.eventEmitter.emit(JitsiConferenceEvents.CONFERENCE_FAILED, JitsiConferenceErrors.SETUP_FAILED);
|
||||
});
|
||||
|
||||
conference.room.addListener(XMPPEvents.MESSAGE_RECEIVED, function (jid, displayName, txt, myJid, ts) {
|
||||
|
|
|
@ -7,6 +7,10 @@ var JitsiConferenceErrors = {
|
|||
* Indicates that a password is required in order to join the conference.
|
||||
*/
|
||||
PASSWORD_REQUIRED: "conference.passwordRequired",
|
||||
/**
|
||||
* Indicates that client must be authenticated to create the conference.
|
||||
*/
|
||||
AUTHENTICATION_REQUIRED: "conference.authenticationRequired",
|
||||
/**
|
||||
* Indicates that password cannot be set for this conference.
|
||||
*/
|
||||
|
@ -16,6 +20,10 @@ var JitsiConferenceErrors = {
|
|||
* conference.
|
||||
*/
|
||||
CONNECTION_ERROR: "conference.connectionError",
|
||||
/**
|
||||
* Indicates that the conference setup failed.
|
||||
*/
|
||||
SETUP_FAILED: "conference.setup_failed",
|
||||
/**
|
||||
* Indicates that there is no available videobridge.
|
||||
*/
|
||||
|
|
|
@ -69,9 +69,9 @@ var JitsiConferenceEvents = {
|
|||
*/
|
||||
CONNECTION_RESTORED: "conference.connectionRestored",
|
||||
/**
|
||||
* Indicates that the conference setup failed.
|
||||
* Indicates that conference failed.
|
||||
*/
|
||||
SETUP_FAILED: "conference.setup_failed",
|
||||
CONFERENCE_FAILED: "conference.failed",
|
||||
/**
|
||||
* Indicates that conference has been joined.
|
||||
*/
|
||||
|
|
1401
lib-jitsi-meet.js
1401
lib-jitsi-meet.js
File diff suppressed because it is too large
Load Diff
|
@ -354,7 +354,7 @@ Moderator.prototype.allocateConferenceFocus = function (callback) {
|
|||
);
|
||||
};
|
||||
|
||||
Moderator.prototype.getLoginUrl = function (urlCallback) {
|
||||
Moderator.prototype.getLoginUrl = function (urlCallback, failureCallback) {
|
||||
var iq = $iq({to: this.getFocusComponent(), type: 'get'});
|
||||
iq.c('login-url', {
|
||||
xmlns: 'http://jitsi.org/protocol/focus',
|
||||
|
@ -372,14 +372,17 @@ Moderator.prototype.getLoginUrl = function (urlCallback) {
|
|||
} else {
|
||||
logger.error(
|
||||
"Failed to get auth url from the focus", result);
|
||||
failureCallback(result);
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
logger.error("Get auth url error", error);
|
||||
failureCallback(error);
|
||||
}
|
||||
);
|
||||
};
|
||||
Moderator.prototype.getPopupLoginUrl = function (urlCallback) {
|
||||
|
||||
Moderator.prototype.getPopupLoginUrl = function (urlCallback, failureCallback) {
|
||||
var iq = $iq({to: this.getFocusComponent(), type: 'get'});
|
||||
iq.c('login-url', {
|
||||
xmlns: 'http://jitsi.org/protocol/focus',
|
||||
|
@ -398,10 +401,12 @@ Moderator.prototype.getPopupLoginUrl = function (urlCallback) {
|
|||
} else {
|
||||
logger.error(
|
||||
"Failed to get POPUP auth url from the focus", result);
|
||||
failureCallback(result);
|
||||
}
|
||||
},
|
||||
function (error) {
|
||||
logger.error('Get POPUP auth url error', error);
|
||||
failureCallback(error);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@ -435,6 +440,3 @@ Moderator.prototype.logout = function (callback) {
|
|||
};
|
||||
|
||||
module.exports = Moderator;
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue