Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

call module that checks the jwt against the access service

alexbratu920c187f180fb4
diff --git a/resources/prosody-plugins/mod_auth_token.lua b/resources/prosody-plugins/mod_auth_token.lua
index 7811e9f4a2..7ae65d3ae3 100644
--- a/resources/prosody-plugins/mod_auth_token.lua
+++ b/resources/prosody-plugins/mod_auth_token.lua
@@ -85,6 +85,12 @@ function provider.get_sasl_handler(session)
return res, error, reason;
end
+ local shouldAllow = prosody.events.fire_event("jitsi-access-ban-check", session);
+ if shouldAllow == false then
+ log("warn", "user is banned")
+ return false, "not-allowed", "user is banned";
+ end
+
local customUsername
= prosody.events.fire_event("pre-jitsi-authentication", session);
diff --git a/resources/prosody-plugins/util.lib.lua b/resources/prosody-plugins/util.lib.lua
index c0689997e6..3203fe1201 100644
--- a/resources/prosody-plugins/util.lib.lua
+++ b/resources/prosody-plugins/util.lib.lua
@@ -267,13 +267,19 @@ end
--- retry @param retry number of times
-- @param url endpoint to be called
-- @param retry nr of retries, if retry is
+-- @param auth_token value to be passed as auth Bearer
-- nil there will be no retries
-- @returns result of the http call or nil if
-- the external call failed after the last retry
-function http_get_with_retry(url, retry)
+function http_get_with_retry(url, retry, auth_token)
local content, code;
local timeout_occurred;
local wait, done = async.waiter();
+ local request_headers = http_headers or {}
+ if auth_token ~= nil then
+ request_headers['Authorization'] = 'Bearer ' .. auth_token
+ end
+
local function cb(content_, code_, response_, request_)
if timeout_occurred == nil then
code = code_;
@@ -281,7 +287,7 @@ function http_get_with_retry(url, retry)
module:log("debug", "External call was successful, content %s", content_);
content = content_
else
- module:log("warn", "Error on public key request: Code %s, Content %s",
+ module:log("warn", "Error on GET request: Code %s, Content %s",
code_, content_);
end
done();
@@ -292,7 +298,7 @@ function http_get_with_retry(url, retry)
local function call_http()
return http.request(url, {
- headers = http_headers or {},
+ headers = request_headers,
method = "GET"
}, cb);
end
@@ -326,7 +332,7 @@ function http_get_with_retry(url, retry)
timer.add_task(http_timeout, cancel);
wait();
- return content;
+ return content, code;
end
-- Checks whether there is status in the <x node