Skip to content

Commit bcdb4cb

Browse files
committed
Merge branch 'dev' of https://github.com/knaperek/djangosaml2 into dev
2 parents c505943 + df5125f commit bcdb4cb

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,9 +388,9 @@ This should be a view which takes a request, optional exception which occured
388388
and status code, and returns a response to serve the user. E.g. The default
389389
implementation looks like this::
390390

391-
def template_failure(request, exception=None, **kwargs):
391+
def template_failure(request, exception=None, status=403, **kwargs):
392392
""" Renders a simple template with an error message. """
393-
return render(request, 'djangosaml2/login_error.html', {'exception': exception}, status=kwargs.get('status', 403))
393+
return render(request, 'djangosaml2/login_error.html', {'exception': exception}, status=status)
394394

395395

396396
User attributes

djangosaml2/views.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from django.utils.decorators import method_decorator
2929
from django.views.decorators.csrf import csrf_exempt
3030
from django.views.generic import View
31+
from django.utils.module_loading import import_string
3132
from saml2 import BINDING_HTTP_POST, BINDING_HTTP_REDIRECT
3233
from saml2.client_base import LogoutError
3334
from saml2.config import SPConfig
@@ -379,7 +380,8 @@ def post(self, request, attribute_mapping=None, create_unknown_user=None):
379380
create_unknown_user=create_unknown_user)
380381
if user is None:
381382
logger.warning("Could not authenticate user received in SAML Assertion. Session info: %s", session_info)
382-
return self.handle_acs_failure(request, exception=PermissionDenied('No user could be authenticated.'))
383+
return self.handle_acs_failure(request, exception=PermissionDenied('No user could be authenticated.'),
384+
session_info=session_info)
383385

384386
auth.login(self.request, user)
385387
_set_subject_id(request.saml_session, session_info['name_id'])

0 commit comments

Comments
 (0)