From c2b9dc5c75e96eb0236ac88b816a167f626912f9 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 3 Sep 2021 10:08:19 +0200 Subject: [PATCH] api: cache schema, fix server urls Signed-off-by: Jens Langhammer --- authentik/api/v3/urls.py | 6 +++--- authentik/root/settings.py | 4 ++-- schema.yml | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/authentik/api/v3/urls.py b/authentik/api/v3/urls.py index 5becbb89a..d6c58a3f8 100644 --- a/authentik/api/v3/urls.py +++ b/authentik/api/v3/urls.py @@ -1,6 +1,6 @@ """api v3 urls""" from django.urls import path -from django.views.decorators.csrf import csrf_exempt +from django.views.decorators.cache import cache_page from drf_spectacular.views import SpectacularAPIView from rest_framework import routers @@ -225,7 +225,7 @@ urlpatterns = ( FlowExecutorView.as_view(), name="flow-executor", ), - path("sentry/", csrf_exempt(SentryTunnelView.as_view()), name="sentry"), - path("schema/", SpectacularAPIView.as_view(), name="schema"), + path("sentry/", SentryTunnelView.as_view(), name="sentry"), + path("schema/", cache_page(86400)(SpectacularAPIView.as_view()), name="schema"), ] ) diff --git a/authentik/root/settings.py b/authentik/root/settings.py index 27f70de06..c5bf7a5e8 100644 --- a/authentik/root/settings.py +++ b/authentik/root/settings.py @@ -154,10 +154,10 @@ SPECTACULAR_SETTINGS = { "SCHEMA_PATH_PREFIX_TRIM": True, "SERVERS": [ { - "url": "http://authentik.tld/api/v3/", + "url": "/api/v3/", }, { - "url": "http://authentik.tld/api/v2beta/", + "url": "/api/v2beta/", }, ], "CONTACT": { diff --git a/schema.yml b/schema.yml index 066bfafa9..7570d3e9f 100644 --- a/schema.yml +++ b/schema.yml @@ -29105,5 +29105,5 @@ components: in: header name: Authorization servers: -- url: http://authentik.tld/api/v3/ -- url: http://authentik.tld/api/v2beta/ +- url: /api/v3/ +- url: /api/v2beta/