Skip to content

v1.0.3 #244

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changes
=======

v1.0.3 (2020-02-04)
- Django Logout behaviour improved


v1.0.2 (2020-01-24)
- RequestVersionTooLow exception handled in ACS
- Better exception handling for Malformed SAML Response
Expand Down
2 changes: 1 addition & 1 deletion djangosaml2/templates/djangosaml2/wayf.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>Where are you from?</h1>
<p>Please select your <strong>Identity Provider</strong> from the following list:</p>
<ul>
{% for url, name in available_idps %}
<li><a href="{% url 'saml2_login' %}?idp={{ url }}{% if came_from %}&next={{ came_from }}{% endif %}">{{ name }}</a></li>
<li><a href="{% url 'saml2_login' %}?idp={{ url }}{% if came_from %}&next={{ came_from }}{% endif %}">{{ name|default_if_none:url }}</a></li>
{% endfor %}
</ul>
</body>
Expand Down
11 changes: 7 additions & 4 deletions djangosaml2/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ def get_sp_config(self, request: HttpRequest) -> SPConfig:
def get_state_client(self, request: HttpRequest):
conf = self.get_sp_config(request)
state = StateCache(request.saml_session)
client = Saml2Client(conf, state_cache=state, identity_cache=IdentityCache(request.saml_session))
client = Saml2Client(
conf, state_cache=state,
identity_cache=IdentityCache(request.saml_session)
)
return state, client


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

auth.logout(request)
state.sync()
Expand Down Expand Up @@ -567,8 +570,8 @@ def do_logout_service(self, request, data, binding):

def finish_logout(request, response, next_page=None):
if (getattr(settings, 'SAML_IGNORE_LOGOUT_ERRORS', False) or (response and response.status_ok())):
if next_page is None and hasattr(settings, 'LOGOUT_REDIRECT_URL'):
next_page = settings.LOGOUT_REDIRECT_URL
if not next_page:
next_page = getattr(settings, 'LOGOUT_REDIRECT_URL', '/')
logger.debug('Performing django logout with a next_page of %s', next_page)
return AuthLogoutView.as_view()(request, next_page=next_page)
logger.error('Unknown error during the logout')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def read(*rnames):

setup(
name='djangosaml2',
version='1.0.2',
version='1.0.3',
description='pysaml2 integration for Django',
long_description=read('README.rst'),
classifiers=[
Expand Down