Fix etherpad session authentication to work in cluster setups

Etherpad uses the sessionID cookie for authorization. In cluster setups the
host part of the URI which serves the html5 frontend is different from
the hostname part of the URI which serves etherpad. Therefore the
bbb-html5 client can't set a cookie for etherpad which contains the
etherpad sessionID.

This patch uses the `ep_auth_session` etherpad plugin which takes the
`sessionID` as query parameter, sets the cookie in the browser and
redirects the iframe to the pad URI.
This commit is contained in:
Daniel Schreiber 2022-05-15 21:48:05 +02:00
parent b0035170fb
commit dfd93e7959
3 changed files with 19 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import _ from 'lodash';
import Pads, { PadsUpdates } from '/imports/api/pads';
import Pads, { PadsSessions, PadsUpdates } from '/imports/api/pads';
import { makeCall } from '/imports/ui/services/api';
import Auth from '/imports/ui/services/auth';
import Settings from '/imports/ui/services/settings';
@ -47,9 +47,13 @@ const throttledCreateSession = _.throttle(createSession, THROTTLE_TIMEOUT, {
const buildPadURL = (padId) => {
if (padId) {
const params = getParams();
const url = Auth.authenticateURL(`${PADS_CONFIG.url}/p/${padId}?${params}`);
return url;
const padsSessions = PadsSessions.findOne({});
if (padsSessions && padsSessions.sessions) {
const params = getParams();
const sessionIds = padsSessions.sessions.map(session => Object.values(session)).join(',');
const url = Auth.authenticateURL(`${PADS_CONFIG.url}/auth_session?padName=${padId}&sessionID=${sessionIds}&${params}`);
return url;
}
}
return null;

View File

@ -49,6 +49,7 @@ npm install ./ep_redis_publisher-*.tgz
npm install ep_cursortrace
npm install ep_disable_chat
npm install --no-save --legacy-peer-deps ep_auth_session
mkdir -p staging/usr/share/etherpad-lite

View File

@ -22,6 +22,16 @@ location /pad/p/ {
auth_request_set $auth_status $upstream_status;
}
location /pad/auth_session {
rewrite /pad/auth_session(.*) /auth_session$1 break;
proxy_pass http://127.0.0.1:9001/;
proxy_pass_header Server;
proxy_set_header Host $host;
proxy_buffering off;
auth_request /bigbluebutton/connection/checkAuthorization;
auth_request_set $auth_status $upstream_status;
}
location /pad {
rewrite /pad/(.*) /$1 break;
rewrite ^/pad$ /pad/ permanent;