providers/proxy: make token_validity float and optional for backwards compat
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
617e90dca3
commit
4f3583cd7e
|
@ -1,7 +1,6 @@
|
||||||
"""ProxyProvider API Views"""
|
"""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 drf_spectacular.utils import extend_schema_field
|
||||||
from rest_framework.exceptions import ValidationError
|
from rest_framework.exceptions import ValidationError
|
||||||
from rest_framework.fields import CharField, ListField, SerializerMethodField
|
from rest_framework.fields import CharField, ListField, SerializerMethodField
|
||||||
|
@ -115,8 +114,7 @@ class ProxyOutpostConfigSerializer(ModelSerializer):
|
||||||
"""Embed OpenID Connect provider information"""
|
"""Embed OpenID Connect provider information"""
|
||||||
return ProviderInfoView(request=self.context["request"]._request).get_info(obj)
|
return ProviderInfoView(request=self.context["request"]._request).get_info(obj)
|
||||||
|
|
||||||
@extend_schema_field(OpenApiTypes.INT)
|
def get_token_validity(self, obj: ProxyProvider) -> Optional[float]:
|
||||||
def get_token_validity(self, obj: ProxyProvider) -> int:
|
|
||||||
"""Get token validity as second count"""
|
"""Get token validity as second count"""
|
||||||
return timedelta_from_string(obj.token_validity).total_seconds()
|
return timedelta_from_string(obj.token_validity).total_seconds()
|
||||||
|
|
||||||
|
|
|
@ -27379,7 +27379,9 @@ components:
|
||||||
cookie_domain:
|
cookie_domain:
|
||||||
type: string
|
type: string
|
||||||
token_validity:
|
token_validity:
|
||||||
type: integer
|
type: number
|
||||||
|
format: float
|
||||||
|
nullable: true
|
||||||
readOnly: true
|
readOnly: true
|
||||||
required:
|
required:
|
||||||
- external_host
|
- external_host
|
||||||
|
|
Reference in New Issue