From d900a2b6a9feb6d2c2dd57045dfc90a93d542b63 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 20 Sep 2021 19:19:36 +0200 Subject: [PATCH] *: fix lookup_fields Signed-off-by: Jens Langhammer --- authentik/api/authentication.py | 2 +- authentik/core/api/applications.py | 1 - authentik/core/api/sources.py | 1 - authentik/core/api/tokens.py | 1 - authentik/flows/api/flows.py | 1 - authentik/sources/ldap/api.py | 1 - authentik/sources/oauth/api/source.py | 1 - authentik/sources/plex/api/source.py | 1 - authentik/sources/saml/api.py | 1 - 9 files changed, 1 insertion(+), 9 deletions(-) diff --git a/authentik/api/authentication.py b/authentik/api/authentication.py index 88680244c..a069f4681 100644 --- a/authentik/api/authentication.py +++ b/authentik/api/authentication.py @@ -40,7 +40,6 @@ def bearer_auth(raw_header: bytes) -> Optional[User]: raise AuthenticationFailed("Malformed header") tokens = Token.filter_not_expired(key=password, intent=TokenIntents.INTENT_API) if not tokens.exists(): - LOGGER.info("Authenticating via secret_key") user = token_secret_key(password) if not user: raise AuthenticationFailed("Token invalid/expired") @@ -58,6 +57,7 @@ def token_secret_key(value: str) -> Optional[User]: outposts = Outpost.objects.filter(managed=MANAGED_OUTPOST) if not outposts: return None + LOGGER.info("Authenticating via secret_key") outpost = outposts.first() return outpost.user diff --git a/authentik/core/api/applications.py b/authentik/core/api/applications.py index 42b4aa3db..e8a92e3a6 100644 --- a/authentik/core/api/applications.py +++ b/authentik/core/api/applications.py @@ -77,7 +77,6 @@ class ApplicationViewSet(UsedByMixin, ModelViewSet): "meta_publisher", ] lookup_field = "slug" - lookup_value_regex = r"^[-a-zA-Z0-9_]+\Z" ordering = ["name"] def _filter_queryset_for_list(self, queryset: QuerySet) -> QuerySet: diff --git a/authentik/core/api/sources.py b/authentik/core/api/sources.py index 328433e16..18239ee16 100644 --- a/authentik/core/api/sources.py +++ b/authentik/core/api/sources.py @@ -62,7 +62,6 @@ class SourceViewSet( queryset = Source.objects.none() serializer_class = SourceSerializer lookup_field = "slug" - lookup_value_regex = r"^[-a-zA-Z0-9_]+\Z" def get_queryset(self): # pragma: no cover return Source.objects.select_subclasses() diff --git a/authentik/core/api/tokens.py b/authentik/core/api/tokens.py index a174b3671..24c5b76e7 100644 --- a/authentik/core/api/tokens.py +++ b/authentik/core/api/tokens.py @@ -66,7 +66,6 @@ class TokenViewSerializer(PassiveSerializer): class TokenViewSet(UsedByMixin, ModelViewSet): """Token Viewset""" - lookup_value_regex = r"^[-a-zA-Z0-9_]+\Z" lookup_field = "identifier" queryset = Token.objects.all() serializer_class = TokenSerializer diff --git a/authentik/flows/api/flows.py b/authentik/flows/api/flows.py index 3f11da33e..602cc4654 100644 --- a/authentik/flows/api/flows.py +++ b/authentik/flows/api/flows.py @@ -108,7 +108,6 @@ class FlowViewSet(UsedByMixin, ModelViewSet): queryset = Flow.objects.all() serializer_class = FlowSerializer lookup_field = "slug" - lookup_value_regex = r"^[-a-zA-Z0-9_]+\Z" search_fields = ["name", "slug", "designation", "title"] filterset_fields = ["flow_uuid", "name", "slug", "designation"] diff --git a/authentik/sources/ldap/api.py b/authentik/sources/ldap/api.py index 914c4bffb..aae8e643a 100644 --- a/authentik/sources/ldap/api.py +++ b/authentik/sources/ldap/api.py @@ -69,7 +69,6 @@ class LDAPSourceViewSet(UsedByMixin, ModelViewSet): queryset = LDAPSource.objects.all() serializer_class = LDAPSourceSerializer lookup_field = "slug" - lookup_value_regex = r"^[-a-zA-Z0-9_]+\Z" filterset_fields = [ "name", "slug", diff --git a/authentik/sources/oauth/api/source.py b/authentik/sources/oauth/api/source.py index 713397946..0beafb976 100644 --- a/authentik/sources/oauth/api/source.py +++ b/authentik/sources/oauth/api/source.py @@ -84,7 +84,6 @@ class OAuthSourceViewSet(UsedByMixin, ModelViewSet): queryset = OAuthSource.objects.all() serializer_class = OAuthSourceSerializer lookup_field = "slug" - lookup_value_regex = r"^[-a-zA-Z0-9_]+\Z" filterset_fields = [ "name", "slug", diff --git a/authentik/sources/plex/api/source.py b/authentik/sources/plex/api/source.py index 37f489e19..fb56c178c 100644 --- a/authentik/sources/plex/api/source.py +++ b/authentik/sources/plex/api/source.py @@ -49,7 +49,6 @@ class PlexSourceViewSet(UsedByMixin, ModelViewSet): queryset = PlexSource.objects.all() serializer_class = PlexSourceSerializer lookup_field = "slug" - lookup_value_regex = r"^[-a-zA-Z0-9_]+\Z" filterset_fields = [ "name", "slug", diff --git a/authentik/sources/saml/api.py b/authentik/sources/saml/api.py index 2bfbf08dd..ec6a78799 100644 --- a/authentik/sources/saml/api.py +++ b/authentik/sources/saml/api.py @@ -40,7 +40,6 @@ class SAMLSourceViewSet(UsedByMixin, ModelViewSet): queryset = SAMLSource.objects.all() serializer_class = SAMLSourceSerializer lookup_field = "slug" - lookup_value_regex = r"^[-a-zA-Z0-9_]+\Z" filterset_fields = "__all__" ordering = ["name"]