From 373793ce9a598ae29a3a372fa5275944571482d4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 2 Mar 2021 16:58:55 +0100 Subject: [PATCH] policies: show more information when provider fails to resolve application --- authentik/core/models.py | 2 +- authentik/policies/views.py | 8 +++++--- swagger.yaml | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/authentik/core/models.py b/authentik/core/models.py index 24b3687f5..1e556734d 100644 --- a/authentik/core/models.py +++ b/authentik/core/models.py @@ -90,7 +90,7 @@ class UserManager(DjangoUserManager): class User(GuardianUserMixin, AbstractUser): - """Custom User model to allow easier adding o f user-based settings""" + """Custom User model to allow easier adding of user-based settings""" uuid = models.UUIDField(default=uuid4, editable=False) name = models.TextField(help_text=_("User's display name.")) diff --git a/authentik/policies/views.py b/authentik/policies/views.py index c4a0fae49..36184b0de 100644 --- a/authentik/policies/views.py +++ b/authentik/policies/views.py @@ -62,9 +62,11 @@ class PolicyAccessView(AccessMixin, View): return self.handle_no_permission() try: self.resolve_provider_application() - except (Application.DoesNotExist, Provider.DoesNotExist): - LOGGER.warning("failed to resolve application") - return self.handle_no_permission_authenticated() + except (Application.DoesNotExist, Provider.DoesNotExist) as exc: + LOGGER.warning("failed to resolve application", exc=exc) + return self.handle_no_permission_authenticated( + PolicyResult(False, _("Failed to resolve application")) + ) # Check if user is unauthenticated, so we pass the application # for the identification stage if not request.user.is_authenticated: diff --git a/swagger.yaml b/swagger.yaml index a072c0ecd..36a416513 100755 --- a/swagger.yaml +++ b/swagger.yaml @@ -9657,7 +9657,7 @@ definitions: readOnly: true readOnly: true user: - description: Custom User model to allow easier adding o f user-based settings + description: Custom User model to allow easier adding of user-based settings required: - password - username @@ -11871,7 +11871,7 @@ definitions: description: Optional fixed data to enforce on user enrollment. type: object created_by: - description: Custom User model to allow easier adding o f user-based settings + description: Custom User model to allow easier adding of user-based settings required: - password - username