providers/*: pass policy result objects when access denied

This commit is contained in:
Jens Langhammer 2020-09-14 21:52:25 +02:00
parent 812cc0d2f1
commit 3cf558d594
2 changed files with 5 additions and 4 deletions

View File

@ -323,7 +323,7 @@ class AuthorizationFlowInitView(PolicyAccessMixin, View):
try:
application = self.provider_to_application(provider)
except Application.DoesNotExist:
return self.handle_no_permission_authorized()
return self.handle_no_permission_authenticated()
# Check if user is unauthenticated, so we pass the application
# for the identification stage
if not request.user.is_authenticated:
@ -331,7 +331,7 @@ class AuthorizationFlowInitView(PolicyAccessMixin, View):
# Check permissions
result = self.user_has_access(application)
if not result.passing:
return self.handle_no_permission_authorized()
return self.handle_no_permission_authenticated(result)
# TODO: End block
# Extract params so we can save them in the plan context
try:

View File

@ -62,8 +62,9 @@ class SAMLSSOView(PolicyAccessMixin, View):
)
if not request.user.is_authenticated:
return self.handle_no_permission(self.application)
if not self.user_has_access(self.application).passing:
return self.handle_no_permission_authorized()
has_access = self.user_has_access(self.application)
if not has_access.passing:
return self.handle_no_permission_authenticated(has_access)
# Call the method handler, which checks the SAML Request
method_response = super().dispatch(request, *args, application_slug, **kwargs)
if method_response: