authentik.root.websocket

root Websocket URLS

 1"""root Websocket URLS"""
 2
 3from importlib import import_module
 4
 5from channels.routing import URLRouter
 6from django.urls import path
 7from structlog.stdlib import get_logger
 8
 9from authentik.lib.config import CONFIG
10from authentik.lib.utils.reflection import get_apps
11
12LOGGER = get_logger()
13
14_websocket_urlpatterns = []
15for _authentik_app in get_apps():
16    try:
17        api_urls = import_module(f"{_authentik_app.name}.urls")
18    except ModuleNotFoundError:
19        continue
20    if not hasattr(api_urls, "websocket_urlpatterns"):
21        continue
22    urls: list = api_urls.websocket_urlpatterns
23    _websocket_urlpatterns.extend(urls)
24    LOGGER.debug(
25        "Mounted Websocket URLs",
26        app_name=_authentik_app.name,
27    )
28
29websocket_urlpatterns = [
30    path(
31        CONFIG.get("web.path", "/")[1:],
32        URLRouter(_websocket_urlpatterns),
33    ),
34]
LOGGER = <BoundLoggerLazyProxy(logger=None, wrapper_class=None, processors=None, context_class=None, initial_values={}, logger_factory_args=())>
websocket_urlpatterns = [<URLPattern ''>]
urls: list = [<URLPattern 'ws/rac/<str:token>/'>, <URLPattern 'ws/outpost_rac/<str:channel>/'>]