Software / code / prosody-modules
File
mod_http_authentication/mod_http_authentication.lua @ 6249:12a2989c7cc1
mod_limits_exception: obsolete
diff --git a/mod_limits_exception/README.md b/mod_limits_exception/README.md
--- a/mod_limits_exception/README.md
+++ b/mod_limits_exception/README.md
@@ -1,6 +1,8 @@
---
+labels:
+- Stage-Obsolete
summary: Allow specified JIDs to bypass rate limits
-...
+---
This module allows you to configure a list of JIDs that should be allowed to
bypass rate limit restrictions.
| author | Menel <menel@snikket.de> |
|---|---|
| date | Mon, 12 May 2025 10:57:17 +0200 |
| parent | 3442:05725785e3a6 |
line wrap: on
line source
module:set_global(); local b64_decode = require "util.encodings".base64.decode; local server = require "net.http.server"; local credentials = module:get_option_string("http_credentials", "username:secretpassword"); local unauthed_endpoints = module:get_option_set("unauthenticated_http_endpoints", { "/http-bind", "/http-bind/" })._items; module:wrap_object_event(server._events, false, function (handlers, event_name, event_data) local request = event_data.request; if event_name ~= "http-error" and request and not unauthed_endpoints[request.path] then local response = event_data.response; local headers = request.headers; if not headers.authorization then response.headers.www_authenticate = ("Basic realm=%q"):format(module.host.."/"..module.name); return 401; end local user_password = b64_decode(headers.authorization:match("%s(%S*)$")); if user_password ~= credentials then return 401; end end return handlers(event_name, event_data); end);