From 4f3583cd7e9a3fc4e34dea51a56e2817e11520ec Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 25 Sep 2021 15:54:25 +0200 Subject: [PATCH] providers/proxy: make token_validity float and optional for backwards compat Signed-off-by: Jens Langhammer --- authentik/providers/proxy/api.py | 6 ++---- schema.yml | 4 +++- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/authentik/providers/proxy/api.py b/authentik/providers/proxy/api.py index 8e965e9a3..c1224b4df 100644 --- a/authentik/providers/proxy/api.py +++ b/authentik/providers/proxy/api.py @@ -1,7 +1,6 @@ """ProxyProvider API Views""" -from typing import Any +from typing import Any, Optional -from drf_spectacular.types import OpenApiTypes from drf_spectacular.utils import extend_schema_field from rest_framework.exceptions import ValidationError from rest_framework.fields import CharField, ListField, SerializerMethodField @@ -115,8 +114,7 @@ class ProxyOutpostConfigSerializer(ModelSerializer): """Embed OpenID Connect provider information""" return ProviderInfoView(request=self.context["request"]._request).get_info(obj) - @extend_schema_field(OpenApiTypes.INT) - def get_token_validity(self, obj: ProxyProvider) -> int: + def get_token_validity(self, obj: ProxyProvider) -> Optional[float]: """Get token validity as second count""" return timedelta_from_string(obj.token_validity).total_seconds() diff --git a/schema.yml b/schema.yml index 3b4217381..2101999cc 100644 --- a/schema.yml +++ b/schema.yml @@ -27379,7 +27379,9 @@ components: cookie_domain: type: string token_validity: - type: integer + type: number + format: float + nullable: true readOnly: true required: - external_host