authentik.core.urls

authentik URL Configuration

  1"""authentik URL Configuration"""
  2
  3from django.conf import settings
  4from django.urls import path
  5
  6from authentik.core.api.application_entitlements import ApplicationEntitlementViewSet
  7from authentik.core.api.applications import ApplicationViewSet
  8from authentik.core.api.authenticated_sessions import AuthenticatedSessionViewSet
  9from authentik.core.api.devices import AdminDeviceViewSet, DeviceViewSet
 10from authentik.core.api.groups import GroupViewSet
 11from authentik.core.api.object_attributes import ObjectAttributeViewSet
 12from authentik.core.api.property_mappings import PropertyMappingViewSet
 13from authentik.core.api.providers import ProviderViewSet
 14from authentik.core.api.sources import (
 15    GroupSourceConnectionViewSet,
 16    SourceViewSet,
 17    UserSourceConnectionViewSet,
 18)
 19from authentik.core.api.tokens import TokenViewSet
 20from authentik.core.api.transactional_applications import TransactionalApplicationView
 21from authentik.core.api.users import UserViewSet
 22from authentik.core.setup.views import SetupView
 23from authentik.core.views.apps import RedirectToAppLaunch
 24from authentik.core.views.debug import AccessDeniedView, ServerLogAPI
 25from authentik.core.views.interface import (
 26    BrandDefaultRedirectView,
 27    InterfaceView,
 28    RootRedirectView,
 29)
 30from authentik.events.consumer import ClientConsumer
 31from authentik.flows.views.interface import FlowInterfaceView
 32from authentik.root.asgi_middleware import AuthMiddlewareStack
 33from authentik.root.middleware import ChannelsLoggingMiddleware
 34
 35urlpatterns = [
 36    path(
 37        "",
 38        RootRedirectView.as_view(),
 39        name="root-redirect",
 40    ),
 41    path(
 42        # We have to use this format since everything else uses application/o or application/saml
 43        "application/launch/<slug:application_slug>/",
 44        RedirectToAppLaunch.as_view(),
 45        name="application-launch",
 46    ),
 47    # Interfaces
 48    path(
 49        "if/admin/",
 50        BrandDefaultRedirectView.as_view(template_name="if/admin.html"),
 51        name="if-admin",
 52    ),
 53    path(
 54        "if/admin/<path:path>",
 55        BrandDefaultRedirectView.as_view(template_name="if/admin.html"),
 56        name="if-admin-path",
 57    ),
 58    path(
 59        "if/user/",
 60        BrandDefaultRedirectView.as_view(template_name="if/user.html"),
 61        name="if-user",
 62    ),
 63    path(
 64        "if/user/<path:path>",
 65        BrandDefaultRedirectView.as_view(template_name="if/user.html"),
 66        name="if-user-path",
 67    ),
 68    path(
 69        "if/flow/<slug:flow_slug>/",
 70        # FIXME: move this url to the flows app...also will cause all
 71        # of the reverse calls to be adjusted
 72        FlowInterfaceView.as_view(),
 73        name="if-flow",
 74    ),
 75    path(
 76        "setup",
 77        SetupView.as_view(),
 78        name="setup",
 79    ),
 80    # Fallback for WS
 81    path("ws/outpost/<uuid:pk>/", InterfaceView.as_view(template_name="if/admin.html")),
 82    path(
 83        "ws/client/",
 84        InterfaceView.as_view(template_name="if/admin.html"),
 85    ),
 86]
 87
 88api_urlpatterns = [
 89    ("core/authenticated_sessions", AuthenticatedSessionViewSet),
 90    ("core/applications", ApplicationViewSet),
 91    ("core/application_entitlements", ApplicationEntitlementViewSet),
 92    path(
 93        "core/transactional/applications/",
 94        TransactionalApplicationView.as_view(),
 95        name="core-transactional-application",
 96    ),
 97    ("core/groups", GroupViewSet),
 98    ("core/users", UserViewSet),
 99    ("core/tokens", TokenViewSet),
100    ("core/object_attributes", ObjectAttributeViewSet),
101    ("sources/all", SourceViewSet),
102    ("sources/user_connections/all", UserSourceConnectionViewSet),
103    ("sources/group_connections/all", GroupSourceConnectionViewSet),
104    ("providers/all", ProviderViewSet),
105    ("propertymappings/all", PropertyMappingViewSet),
106    ("authenticators/all", DeviceViewSet, "device"),
107    (
108        "authenticators/admin/all",
109        AdminDeviceViewSet,
110        "admin-device",
111    ),
112]
113
114websocket_urlpatterns = [
115    path(
116        "ws/client/",
117        ChannelsLoggingMiddleware(AuthMiddlewareStack(ClientConsumer.as_asgi())),
118    ),
119]
120
121if settings.DEBUG:
122    urlpatterns += [
123        path("debug/policy/deny/", AccessDeniedView.as_view(), name="debug-policy-deny"),
124    ]
125    api_urlpatterns += [
126        path("debug/log/", ServerLogAPI.as_view(), name="debug-log"),
127    ]
urlpatterns = [<URLPattern '' [name='root-redirect']>, <URLPattern 'application/launch/<slug:application_slug>/' [name='application-launch']>, <URLPattern 'if/admin/' [name='if-admin']>, <URLPattern 'if/admin/<path:path>' [name='if-admin-path']>, <URLPattern 'if/user/' [name='if-user']>, <URLPattern 'if/user/<path:path>' [name='if-user-path']>, <URLPattern 'if/flow/<slug:flow_slug>/' [name='if-flow']>, <URLPattern 'setup' [name='setup']>, <URLPattern 'ws/outpost/<uuid:pk>/'>, <URLPattern 'ws/client/'>]
api_urlpatterns = [('core/authenticated_sessions', <class 'authentik.core.api.authenticated_sessions.AuthenticatedSessionViewSet'>), ('core/applications', <class 'authentik.core.api.applications.ApplicationViewSet'>), ('core/application_entitlements', <class 'authentik.core.api.application_entitlements.ApplicationEntitlementViewSet'>), <URLPattern 'core/transactional/applications/' [name='core-transactional-application']>, ('core/groups', <class 'authentik.core.api.groups.GroupViewSet'>), ('core/users', <class 'authentik.core.api.users.UserViewSet'>), ('core/tokens', <class 'authentik.core.api.tokens.TokenViewSet'>), ('core/object_attributes', <class 'authentik.core.api.object_attributes.ObjectAttributeViewSet'>), ('sources/all', <class 'authentik.core.api.sources.SourceViewSet'>), ('sources/user_connections/all', <class 'authentik.core.api.sources.UserSourceConnectionViewSet'>), ('sources/group_connections/all', <class 'authentik.core.api.sources.GroupSourceConnectionViewSet'>), ('providers/all', <class 'authentik.core.api.providers.ProviderViewSet'>), ('propertymappings/all', <class 'authentik.core.api.property_mappings.PropertyMappingViewSet'>), ('authenticators/all', <class 'authentik.core.api.devices.DeviceViewSet'>, 'device'), ('authenticators/admin/all', <class 'authentik.core.api.devices.AdminDeviceViewSet'>, 'admin-device')]
websocket_urlpatterns = [<URLPattern 'ws/client/'>]