From 44f4011ecfe62583ca98fe6e8f64f7921a0b4d4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Tue, 30 Sep 2014 12:41:22 +0200 Subject: [PATCH] redirect logout to wcs --- conf.d/biblio | 2 +- conf.d/espace_famille | 2 +- mandaye_vincennes/filters/vincennes.py | 5 +++++ mandaye_vincennes/mappers/biblio_vincennes.py | 19 +++++----------- mandaye_vincennes/mappers/duonet_vincennes.py | 18 +++++++-------- .../mappers/famille_vincennes.py | 22 +++++++------------ 6 files changed, 29 insertions(+), 39 deletions(-) diff --git a/conf.d/biblio b/conf.d/biblio index ef438f2..a2d8e0a 100644 --- a/conf.d/biblio +++ b/conf.d/biblio @@ -8,5 +8,5 @@ "saml2_idp_metadata": "http://authentic.local/idp/saml2/metadata", "saml2_signature_public_key": "certs/saml.crt", "saml2_signature_private_key": "certs/saml.key", - "saml2_sp_logout_url": "/sezhame/logout" + "sp_logout_url": "/sezhame/mandayelogout" } diff --git a/conf.d/espace_famille b/conf.d/espace_famille index 3a57f3f..16f1379 100644 --- a/conf.d/espace_famille +++ b/conf.d/espace_famille @@ -8,5 +8,5 @@ "saml2_idp_metadata": "http://authentic.local/idp/saml2/metadata", "saml2_signature_public_key": "certs/saml.crt", "saml2_signature_private_key": "certs/saml.key", - "saml2_sp_logout_url": "/vincennes-noredirect/deconnexion.do" + "sp_logout_url": "/vincennes-noredirect/mandayelogout" } diff --git a/mandaye_vincennes/filters/vincennes.py b/mandaye_vincennes/filters/vincennes.py index 7067e51..2cee234 100644 --- a/mandaye_vincennes/filters/vincennes.py +++ b/mandaye_vincennes/filters/vincennes.py @@ -6,12 +6,16 @@ from urlparse import parse_qs from BeautifulSoup import BeautifulSoup import lxml.html +from mandaye import config from mandaye.log import logger from mandaye.response import _302, _401 from mandaye.template import serve_template from mandaye.backends.default import Association +def local_logout(env, values, request, response): + return _302(config.template_vars.get('wcs_url'), response.cookies) + def get_associate_form(env, values): """ Return association template content """ @@ -65,6 +69,7 @@ def get_multi_template(env, values, current_account): class Biblio: + def resp_html_login_page(self, env, values, request, response): """ msg: response message body env: Mandaye environment diff --git a/mandaye_vincennes/mappers/biblio_vincennes.py b/mandaye_vincennes/mappers/biblio_vincennes.py index 6d44045..49f8334 100644 --- a/mandaye_vincennes/mappers/biblio_vincennes.py +++ b/mandaye_vincennes/mappers/biblio_vincennes.py @@ -73,21 +73,12 @@ mapping = [ } }, { - 'path': r'%s$' % END_POINTS_PATH['single_logout'], + 'path': r'/sezhame/mandayelogout$', 'method': 'GET', - 'response': { - 'auth': 'single_logout', - } - }, - { - 'path': r'%s$' % END_POINTS_PATH['single_logout_return'], - 'method': 'GET', - 'response': { - 'auth': 'single_logout_return', - 'values': { - 'next_url': '/shezame' - } - } + 'target': '/sezhame/logout', + 'on_response': [{ + 'filter': vincennes.local_logout, + }] }, { 'path': r'/mandaye/associate$', diff --git a/mandaye_vincennes/mappers/duonet_vincennes.py b/mandaye_vincennes/mappers/duonet_vincennes.py index a22fd4b..1ccf00a 100644 --- a/mandaye_vincennes/mappers/duonet_vincennes.py +++ b/mandaye_vincennes/mappers/duonet_vincennes.py @@ -1,8 +1,8 @@ from mandaye.auth.saml2 import END_POINTS_PATH -from mandaye_vincennes.filters.vincennes import Duonet +from mandaye_vincennes.filters import vincennes -filters = Duonet() +filters = vincennes.Duonet() duonet_key = 'CV4j27Em0dM%3d' form_values = { @@ -76,22 +76,22 @@ mapping = [ } } }, - { - 'path': r'%s$' % END_POINTS_PATH['single_logout'], - 'method': 'GET', - 'response': {'auth': 'single_logout',} - }, { 'path': r'%s$' % END_POINTS_PATH['single_logout_return'], 'method': 'GET', 'response': { 'auth': 'single_logout_return', 'values': { - 'next_url': '/Connect.aspx?key=%s' % duonet_key, + 'next_url': '/mandayelogout', } } }, - + { + 'path': r'/mandayelogout$', + 'method': 'GET', + 'target': '/Connect.aspx?key=%s' % duonet_key, + 'on_response': [{'filter': vincennes.local_logout}] + }, { 'path': r'/mandaye/sso$', 'method': 'GET', diff --git a/mandaye_vincennes/mappers/famille_vincennes.py b/mandaye_vincennes/mappers/famille_vincennes.py index b810e85..7045fb0 100644 --- a/mandaye_vincennes/mappers/famille_vincennes.py +++ b/mandaye_vincennes/mappers/famille_vincennes.py @@ -1,9 +1,9 @@ from mandaye.auth.saml2 import END_POINTS_PATH -from mandaye_vincennes.filters.vincennes import EspaceFamille +from mandaye_vincennes.filters import vincennes folder_target = '/vincennes-noredirect' -filters = EspaceFamille() +filters = vincennes.EspaceFamille() form_values = { 'post_url': '%s/login.do' % folder_target, @@ -91,20 +91,14 @@ mapping = [ } }, { - 'path': r'%s$' % END_POINTS_PATH['single_logout'], + 'path': r'%s/mandayelogout$' % folder_target, 'method': 'GET', - 'response': {'auth': 'single_logout',} - }, - { - 'path': r'%s$' % END_POINTS_PATH['single_logout_return'], - 'method': 'GET', - 'response': { - 'auth': 'single_logout_return', - 'values': { - 'next_url': '/' - } - } + 'target': '%s/deconnexion.do' % folder_target, + 'on_response': [{ + 'filter': vincennes.local_logout, + }] }, + { 'path': r'/mandaye/disassociate$', 'method': 'GET',