diff --git a/authentik/api/v2/config.py b/authentik/api/v2/config.py index 0641d41f7..b39a0e196 100644 --- a/authentik/api/v2/config.py +++ b/authentik/api/v2/config.py @@ -5,7 +5,7 @@ from django.conf import settings from django.db import models from drf_spectacular.utils import extend_schema from kubernetes.config.incluster_config import SERVICE_HOST_ENV_NAME -from rest_framework.fields import BooleanField, CharField, ChoiceField, ListField +from rest_framework.fields import BooleanField, CharField, ChoiceField, IntegerField, ListField from rest_framework.permissions import AllowAny from rest_framework.request import Request from rest_framework.response import Response @@ -33,6 +33,11 @@ class ConfigSerializer(PassiveSerializer): capabilities = ListField(child=ChoiceField(choices=Capabilities.choices)) + cache_timeout = IntegerField(required=True) + cache_timeout_flows = IntegerField(required=True) + cache_timeout_policies = IntegerField(required=True) + cache_timeout_reputation = IntegerField(required=True) + class ConfigView(APIView): """Read-only view set that returns the current session's Configs""" @@ -65,6 +70,10 @@ class ConfigView(APIView): "error_reporting_environment": CONFIG.y("error_reporting.environment"), "error_reporting_send_pii": CONFIG.y("error_reporting.send_pii"), "capabilities": self.get_capabilities(), + "cache_timeout": int(CONFIG.y("redis.cache_timeout")), + "cache_timeout_flows": int(CONFIG.y("redis.cache_timeout_flows")), + "cache_timeout_policies": int(CONFIG.y("redis.cache_timeout_policies")), + "cache_timeout_reputation": int(CONFIG.y("redis.cache_timeout_reputation")), } ) return Response(config.data) diff --git a/schema.yml b/schema.yml index fbe0b454c..026aea14b 100644 --- a/schema.yml +++ b/schema.yml @@ -20625,7 +20625,19 @@ components: type: array items: $ref: '#/components/schemas/CapabilitiesEnum' + cache_timeout: + type: integer + cache_timeout_flows: + type: integer + cache_timeout_policies: + type: integer + cache_timeout_reputation: + type: integer required: + - cache_timeout + - cache_timeout_flows + - cache_timeout_policies + - cache_timeout_reputation - capabilities - error_reporting_enabled - error_reporting_environment