Przeglądaj źródła

feat(auth) remove external auth mechanisms

release-8443
Saúl Ibarra Corretgé 3 lat temu
rodzic
commit
dda9ec120a

+ 0
- 28
JitsiConference.js Wyświetl plik

@@ -855,34 +855,6 @@ JitsiConference.prototype.getAuthLogin = function() {
855 855
     return this.authIdentity;
856 856
 };
857 857
 
858
-/**
859
- * Check if external authentication is enabled for this conference.
860
- */
861
-JitsiConference.prototype.isExternalAuthEnabled = function() {
862
-    return this.room && this.room.xmpp.moderator.isExternalAuthEnabled();
863
-};
864
-
865
-/**
866
- * Get url for external authentication.
867
- * @param {boolean} [urlForPopup] if true then return url for login popup,
868
- *                                else url of login page.
869
- * @returns {Promise}
870
- */
871
-JitsiConference.prototype.getExternalAuthUrl = function(urlForPopup) {
872
-    return new Promise((resolve, reject) => {
873
-        if (!this.isExternalAuthEnabled()) {
874
-            reject();
875
-
876
-            return;
877
-        }
878
-        if (urlForPopup) {
879
-            this.room.xmpp.moderator.getPopupLoginUrl(this.room.roomjid, resolve, reject);
880
-        } else {
881
-            this.room.xmpp.moderator.getLoginUrl(this.room.roomjid, resolve, reject);
882
-        }
883
-    });
884
-};
885
-
886 858
 /**
887 859
  * Returns the local tracks of the given media type, or all local tracks if no
888 860
  * specific type is given.

+ 0
- 2
JitsiMeetJS.ts Wyświetl plik

@@ -27,7 +27,6 @@ import Settings from './modules/settings/Settings';
27 27
 import LocalStatsCollector from './modules/statistics/LocalStatsCollector';
28 28
 import precallTest from './modules/statistics/PrecallTest';
29 29
 import Statistics from './modules/statistics/statistics';
30
-import AuthUtil from './modules/util/AuthUtil';
31 30
 import GlobalOnErrorHandler from './modules/util/GlobalOnErrorHandler';
32 31
 import ScriptUtil from './modules/util/ScriptUtil';
33 32
 import * as VideoSIPGWConstants from './modules/videosipgw/VideoSIPGWConstants';
@@ -559,7 +558,6 @@ export default {
559 558
      * interest to lib-jitsi-meet clients.
560 559
      */
561 560
     util: {
562
-        AuthUtil,
563 561
         ScriptUtil,
564 562
         browser
565 563
     }

+ 0
- 35
modules/util/AuthUtil.js Wyświetl plik

@@ -1,35 +0,0 @@
1
-const AuthUtil = {
2
-    /**
3
-     * Creates the URL pointing to JWT token authentication service. It is
4
-     * formatted from the 'urlPattern' argument which can contain the following
5
-     * constants:
6
-     * '{room}' - name of the conference room passed as <tt>roomName</tt>
7
-     * argument to this method.
8
-     * '{roleUpgrade}' - will contain 'true' if the URL will be used for
9
-     * the role upgrade scenario, where user connects from anonymous domain and
10
-     * then gets upgraded to the moderator by logging-in from the popup window.
11
-     *
12
-     * @param urlPattern a URL pattern pointing to the login service
13
-     * @param roomName the name of the conference room for which the user will
14
-     * be authenticated
15
-     * @param {boolean} roleUpgrade <tt>true</tt> if the URL will be used for role
16
-     * upgrade scenario, where the user logs-in from the popup window in order
17
-     * to have the moderator rights granted
18
-     *
19
-     * @returns {string|null} the URL pointing to JWT login service or
20
-     * <tt>null</tt> if 'urlPattern' is not a string and the URL can not be
21
-     * constructed.
22
-     */
23
-    getTokenAuthUrl(urlPattern, roomName, roleUpgrade) {
24
-        const url = urlPattern;
25
-
26
-        if (typeof url !== 'string') {
27
-            return null;
28
-        }
29
-
30
-        return url.replace('{room}', roomName)
31
-            .replace('{roleUpgrade}', roleUpgrade === true);
32
-    }
33
-};
34
-
35
-module.exports = AuthUtil;

+ 4
- 110
modules/xmpp/moderator.js Wyświetl plik

@@ -1,7 +1,7 @@
1 1
 /* eslint-disable newline-per-chained-call */
2 2
 import { getLogger } from '@jitsi/logger';
3 3
 import $ from 'jquery';
4
-import { $iq, Strophe } from 'strophe.js';
4
+import { $iq } from 'strophe.js';
5 5
 
6 6
 import { CONNECTION_REDIRECTED } from '../../JitsiConnectionEvents';
7 7
 import FeatureFlags from '../flags/FeatureFlags';
@@ -55,9 +55,6 @@ export default class Moderator extends Listenable {
55 55
         this.getNextErrorTimeout = createExpBackoffTimer(1000);
56 56
         this.options = xmpp.options;
57 57
 
58
-        // External authentication stuff
59
-        this.externalAuthEnabled = false;
60
-
61 58
         // Whether SIP gateway (jigasi) support is enabled. TODO: use presence so it can be changed based on jigasi
62 59
         // availability.
63 60
         this.sipGatewayEnabled = false;
@@ -133,14 +130,6 @@ export default class Moderator extends Listenable {
133 130
         return false;
134 131
     }
135 132
 
136
-    /**
137
-     * Is external authentication enabled.
138
-     * @returns {boolean}
139
-     */
140
-    isExternalAuthEnabled() {
141
-        return this.externalAuthEnabled;
142
-    }
143
-
144 133
     /**
145 134
      * Is sip gw enabled.
146 135
      * @returns {boolean}
@@ -385,10 +374,7 @@ export default class Moderator extends Listenable {
385 374
 
386 375
         logger.info(`Authentication enabled: ${authenticationEnabled}`);
387 376
 
388
-        this.externalAuthEnabled = conferenceRequest.properties.externalAuth === 'true';
389
-        logger.info(`External authentication enabled: ${this.externalAuthEnabled}`);
390
-
391
-        if (!this.externalAuthEnabled && conferenceRequest.sessionId) {
377
+        if (conferenceRequest.sessionId) {
392 378
             logger.info(`Received sessionId: ${conferenceRequest.sessionId}`);
393 379
             Settings.sessionId = conferenceRequest.sessionId;
394 380
         }
@@ -507,13 +493,6 @@ export default class Moderator extends Listenable {
507 493
         // Not authorized to create new room
508 494
         const notAuthorized = $(error).find('>error>not-authorized').length > 0;
509 495
 
510
-        if (notAuthorized
511
-            && Strophe.getDomainFromJid(error.getAttribute('to')) !== this.options.hosts.anonymousdomain) {
512
-            // FIXME "is external" should come either from the focus or
513
-            // config.js
514
-            this.externalAuthEnabled = true;
515
-        }
516
-
517 496
         this._handleError(roomJid, invalidSession, notAuthorized, callback);
518 497
     }
519 498
 
@@ -568,84 +547,6 @@ export default class Moderator extends Listenable {
568 547
         });
569 548
     }
570 549
 
571
-    /**
572
-     * Gets the login URL by requesting it to jicofo.
573
-     * @param roomJid The room jid to use.
574
-     * @param urlCallback The success callback.
575
-     * @param failureCallback The error callback.
576
-     */
577
-    getLoginUrl(roomJid, urlCallback, failureCallback) {
578
-        this._getLoginUrl(roomJid, /* popup */ false, urlCallback, failureCallback);
579
-    }
580
-
581
-    /**
582
-     * Gets the login URL by requesting it to jicofo.
583
-     * @param {boolean} popup false for {@link Moderator#getLoginUrl} or true for
584
-     * {@link Moderator#getPopupLoginUrl}
585
-     * @param roomJid - The room jid to use.
586
-     * @param urlCb
587
-     * @param failureCb
588
-     */
589
-    _getLoginUrl(roomJid, popup, urlCb, failureCb) {
590
-        const iq = $iq({
591
-            to: this.targetJid,
592
-            type: 'get'
593
-        });
594
-        const attrs = {
595
-            xmlns: 'http://jitsi.org/protocol/focus',
596
-            room: roomJid,
597
-            'machine-uid': Settings.machineId
598
-        };
599
-        let str = 'auth url'; // for logger
600
-
601
-        if (popup) {
602
-            attrs.popup = true;
603
-            str = `POPUP ${str}`;
604
-        }
605
-        iq.c('login-url', attrs);
606
-
607
-        /**
608
-         * Implements a failure callback which reports an error message and an error
609
-         * through (1) GlobalOnErrorHandler, (2) logger, and (3) failureCb.
610
-         *
611
-         * @param {string} errmsg the error messsage to report
612
-         * @param {*} error the error to report (in addition to errmsg)
613
-         */
614
-        function reportError(errmsg, err) {
615
-            GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
616
-            logger.error(errmsg, err);
617
-            failureCb(err);
618
-        }
619
-
620
-        this.connection.sendIQ(
621
-            iq,
622
-            result => {
623
-                let url = $(result)
624
-                    .find('login-url')
625
-                    .attr('url');
626
-
627
-                url = decodeURIComponent(url);
628
-                if (url) {
629
-                    logger.info(`Got ${str}: ${url}`);
630
-                    urlCb(url);
631
-                } else {
632
-                    reportError(`Failed to get ${str} from the focus`, result);
633
-                }
634
-            },
635
-            reportError.bind(undefined, `Get ${str} error`)
636
-        );
637
-    }
638
-
639
-    /**
640
-     * Gets the login URL by requesting it to jicofo.
641
-     * @param roomJid The room jid to use.
642
-     * @param urlCallback The success callback.
643
-     * @param failureCallback The error callback.
644
-     */
645
-    getPopupLoginUrl(roomJid, urlCallback, failureCallback) {
646
-        this._getLoginUrl(roomJid, /* popup */ true, urlCallback, failureCallback);
647
-    }
648
-
649 550
     /**
650 551
      * Logout by sending conference IQ.
651 552
      * @param callback
@@ -669,16 +570,9 @@ export default class Moderator extends Listenable {
669 570
         this.connection.sendIQ(
670 571
             iq,
671 572
             result => {
672
-                let logoutUrl = $(result)
673
-                    .find('logout')
674
-                    .attr('logout-url');
675
-
676
-                if (logoutUrl) {
677
-                    logoutUrl = decodeURIComponent(logoutUrl);
678
-                }
679
-                logger.info(`Log out OK, url: ${logoutUrl}`, result);
573
+                logger.info('Log out OK', result);
680 574
                 Settings.sessionId = undefined;
681
-                callback(logoutUrl);
575
+                callback();
682 576
             },
683 577
             error => {
684 578
                 const errmsg = 'Logout error';

+ 0
- 2
types/hand-crafted/JitsiMeetJS.d.ts Wyświetl plik

@@ -16,7 +16,6 @@ import TrackVADEmitter, { VADProcessor } from './modules/detection/TrackVADEmitt
16 16
 import RecordingConstants from './modules/recording/recordingConstants';
17 17
 import JitsiLocalTrack from './modules/RTC/JitsiLocalTrack';
18 18
 import PrecallTest from './modules/statistics/PrecallTest';
19
-import AuthUtil from './modules/util/AuthUtil';
20 19
 import ScriptUtil from './modules/util/ScriptUtil';
21 20
 import { VideoSIPGWConstants } from './modules/videosipgw/VideoSIPGWConstants';
22 21
 import AudioMixer from './modules/webaudio/AudioMixer';
@@ -140,7 +139,6 @@ export type JitsiMeetJSType = {
140 139
   precallTest: PrecallTest;
141 140
 
142 141
   util: {
143
-    AuthUtil: { getTokenAuthUrl: typeof AuthUtil.getTokenAuthUrl },
144 142
     ScriptUtil: { loadScript: typeof ScriptUtil.loadScript },
145 143
     browser: BrowserCapabilities
146 144
   }

Ładowanie…
Anuluj
Zapisz