Skip to content

Commit 945fb85

Browse files
authored
v1.0.3 (#244)
* Wayf page with fallback value if any display name for idps * v1.0.3
1 parent fd6a823 commit 945fb85

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

CHANGES

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
Changes
22
=======
33

4+
v1.0.3 (2020-02-04)
5+
- Django Logout behaviour improved
6+
7+
48
v1.0.2 (2020-01-24)
59
- RequestVersionTooLow exception handled in ACS
610
- Better exception handling for Malformed SAML Response

djangosaml2/templates/djangosaml2/wayf.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ <h1>Where are you from?</h1>
99
<p>Please select your <strong>Identity Provider</strong> from the following list:</p>
1010
<ul>
1111
{% for url, name in available_idps %}
12-
<li><a href="{% url 'saml2_login' %}?idp={{ url }}{% if came_from %}&next={{ came_from }}{% endif %}">{{ name }}</a></li>
12+
<li><a href="{% url 'saml2_login' %}?idp={{ url }}{% if came_from %}&next={{ came_from }}{% endif %}">{{ name|default_if_none:url }}</a></li>
1313
{% endfor %}
1414
</ul>
1515
</body>

djangosaml2/views.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,10 @@ def get_sp_config(self, request: HttpRequest) -> SPConfig:
8282
def get_state_client(self, request: HttpRequest):
8383
conf = self.get_sp_config(request)
8484
state = StateCache(request.saml_session)
85-
client = Saml2Client(conf, state_cache=state, identity_cache=IdentityCache(request.saml_session))
85+
client = Saml2Client(
86+
conf, state_cache=state,
87+
identity_cache=IdentityCache(request.saml_session)
88+
)
8689
return state, client
8790

8891

@@ -466,7 +469,7 @@ def get(self, request, *args, **kwargs):
466469
logger.exception('Error Handled - SLO not supported by IDP: {}'.format(exp))
467470
auth.logout(request)
468471
state.sync()
469-
return HttpResponseRedirect(settings.LOGOUT_REDIRECT_URL)
472+
return HttpResponseRedirect(getattr(settings, 'LOGOUT_REDIRECT_URL', '/'))
470473

471474
auth.logout(request)
472475
state.sync()
@@ -567,8 +570,8 @@ def do_logout_service(self, request, data, binding):
567570

568571
def finish_logout(request, response, next_page=None):
569572
if (getattr(settings, 'SAML_IGNORE_LOGOUT_ERRORS', False) or (response and response.status_ok())):
570-
if next_page is None and hasattr(settings, 'LOGOUT_REDIRECT_URL'):
571-
next_page = settings.LOGOUT_REDIRECT_URL
573+
if not next_page:
574+
next_page = getattr(settings, 'LOGOUT_REDIRECT_URL', '/')
572575
logger.debug('Performing django logout with a next_page of %s', next_page)
573576
return AuthLogoutView.as_view()(request, next_page=next_page)
574577
logger.error('Unknown error during the logout')

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def read(*rnames):
2424

2525
setup(
2626
name='djangosaml2',
27-
version='1.0.2',
27+
version='1.0.3',
2828
description='pysaml2 integration for Django',
2929
long_description=read('README.rst'),
3030
classifiers=[

0 commit comments

Comments
 (0)