Compare commits

...
This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.

2 Commits

Author SHA1 Message Date
Jens Langhammer 5a7508d2e0 core: fix token expiration not being updated upon key rotation
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-08-12 17:24:19 +02:00
Jens Langhammer 9c31ea1aa6 core: fix expired tokens not being returned by API
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
2021-08-12 17:24:19 +02:00
2 changed files with 2 additions and 1 deletions

View File

@ -48,7 +48,7 @@ class TokenViewSet(UsedByMixin, ModelViewSet):
"""Token Viewset""" """Token Viewset"""
lookup_field = "identifier" lookup_field = "identifier"
queryset = Token.filter_not_expired() queryset = Token.objects.all()
serializer_class = TokenSerializer serializer_class = TokenSerializer
search_fields = [ search_fields = [
"identifier", "identifier",

View File

@ -438,6 +438,7 @@ class Token(ManagedModel, ExpiringModel):
from authentik.events.models import Event, EventAction from authentik.events.models import Event, EventAction
self.key = default_token_key() self.key = default_token_key()
self.expires = default_token_duration()
self.save(*args, **kwargs) self.save(*args, **kwargs)
Event.new( Event.new(
action=EventAction.SECRET_ROTATE, action=EventAction.SECRET_ROTATE,