From 8e99b9a8e21c190e2ecd63868caded15a87618bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Schneider?= Date: Fri, 30 May 2014 19:18:48 +0200 Subject: [PATCH] rp_meyzieu: begin working replay --- rp_meyzieu.db | Bin 7168 -> 0 bytes rp_meyzieu/config.py | 11 ++--- rp_meyzieu/filters/portail_famille_ecitiz.py | 21 ++++++++ rp_meyzieu/mappers/linuxfr_example.py | 13 ++--- rp_meyzieu/mappers/portail_famille_ecities.py | 45 +++++++++++++----- 5 files changed, 63 insertions(+), 27 deletions(-) delete mode 100644 rp_meyzieu.db create mode 100644 rp_meyzieu/filters/portail_famille_ecitiz.py diff --git a/rp_meyzieu.db b/rp_meyzieu.db deleted file mode 100644 index d05bf3ee2e37b1f7fe16bcda6349008a5a61f3a8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7168 zcmeHMO>f#T7`6!?0&RzN2M(x`H)#@xA}t`=a@taAIy4GvfJr??E-{m*d{9WxE<3Pk zf3WABcj_+t1+xiZB&#@0JAf@)j{SZ0beAqIlLFGp>B@_b7O@CX=q)0L#8TcOzJmx{5@(b`Tn`A&Tu=5N&f{AAh zwPucqs?u?A|L=fuxAVXyK*_)!FmMEupjR+Xv}UW-svkERxOR?DRa`w&>)L6(+S2OH zdhNudW8zz0aR2Xta=!=ENQjbwJ!aqlDxf@ZrygOJF(x*%ESlqdK;sp|HxOpUB)l5Nd_bX5eCHlPXQb7{v9q7rNqaG_}?yUn8}yRaPh<=Hx?xp zwQtzSnA7QuxlU}EXzExSU^LLqIvB--sF=&H%nZl3(R)pAzR~nzty)6e-T-xnoldT_ zc%I1Q4-es&{4yRhCx$6YXj zV$*fr@wDS<2`IyE`)Y_$Q5f<(UnSG|egy*NnDo=^*5ZGS4B~t4a&5#DG1T}@>g&@~ zCSNGPZ!4g|Va$Rl9fcKaZb4(YADFX-^Vcy<+?i+0iRIH-s1!NL(UcO8*PLMz{`2dc z*V&+bi6bf&;Vwq59~b;+->4M3ip?lBLZ$3JrF!%9G9=k?>EA2L(BjG diff --git a/rp_meyzieu/config.py b/rp_meyzieu/config.py index 2105f22..da275f8 100644 --- a/rp_meyzieu/config.py +++ b/rp_meyzieu/config.py @@ -10,7 +10,7 @@ _PROJECT_PATH = os.path.join(os.path.dirname(__file__), '..') # dialect+driver://username:password@host:port/database db_url = 'sqlite:///' + os.path.join(_PROJECT_PATH, 'rp_meyzieu.db') -debug = True +debug = False # Log configuration LOGGING = { @@ -22,9 +22,8 @@ LOGGING = { 'format': '%(asctime)s %(levelname)s %(message)s', 'datefmt': '%H:%M:%S', }, - 'file': { - 'format': '%(asctime)s %(levelname)s %(uuid)s %(message)s', - 'datefmt': '%Y-%m-%d %H:%M:%S' + 'syslog': { + 'format': 'mandaye-meyzieu(pid=%(process)d) %(name)s %(levelname)s %(uuid)s %(message)s', } }, 'handlers': { @@ -36,7 +35,7 @@ LOGGING = { 'syslog': { 'level': 'INFO', 'class': 'entrouvert.logging.handlers.SysLogHandler', - 'formatter': 'file', + 'formatter': 'syslog', 'address': '/dev/log' }, }, @@ -84,7 +83,7 @@ email_from = 'traceback@entrouvert.com' email_to = ['admin@localhost'] # Use long traceback with xtraceback -use_long_trace = True +use_long_trace = False # Ask Mandaye to auto decompress a response message # Decompress response only if you load a filter diff --git a/rp_meyzieu/filters/portail_famille_ecitiz.py b/rp_meyzieu/filters/portail_famille_ecitiz.py new file mode 100644 index 0000000..c414e2f --- /dev/null +++ b/rp_meyzieu/filters/portail_famille_ecitiz.py @@ -0,0 +1,21 @@ + +import re + +from mandaye.log import logger + +def associate(env, values, request, response): + if response.msg and "', '
', + response.msg) + response.msg = sub[0] + if sub[1] != 1: + logger.warning('Filter portail_famille_ecitiz.associate: change form action failed !') + response.msg = response.msg.replace('', '') + response.msg = response.msg.replace('Connexion', 'Association') + sub = re.subn(r'', '', + response.msg) + response.msg = sub[0] + if sub[1] != 1: + logger.warning('Filter portail_famille_ecitiz.associate: submit replacement failed !') + + return response diff --git a/rp_meyzieu/mappers/linuxfr_example.py b/rp_meyzieu/mappers/linuxfr_example.py index 2773707..80c5abf 100644 --- a/rp_meyzieu/mappers/linuxfr_example.py +++ b/rp_meyzieu/mappers/linuxfr_example.py @@ -32,7 +32,7 @@ form_values = { } urls = { - 'associate_url': '/mandaye/associate', + 'associate_url': '/mandaye_associate', 'connection_url': '/mandaye/sso', 'login_url': '/mandaye/login' } @@ -61,21 +61,18 @@ mapping = [ }] }, { - 'path': r'/mandaye/associate$', + 'path': r'/mandaye_associate$', 'method': 'GET', + 'target': '/ffaxsslMeyzieu/workflow_url?ECITIZ_ACTIVITY_PATH=Citoyen&ECITIZ_HOME_URL=citoyen.jsp&ECITIZ_PROCESS_ID=guichet&ECITIZ_DECONNECTION_URL=services_list.jsp&ECITIZ_ORG=MEY00', 'on_response': [{ - 'filter': ReplayFilter.associate, + 'filter': ecitiz.associate, 'values': { 'action': urls['associate_url'], - 'template': 'associate.html', - 'sp_name': 'Linux FR', - 'login_name': form_values['username_field'], - 'password_name': form_values['password_field'], }, },] }, { - 'path': r'/mandaye/associate$', + 'path': r'/mandaye_associate$', 'method': 'POST', 'response': [ { diff --git a/rp_meyzieu/mappers/portail_famille_ecities.py b/rp_meyzieu/mappers/portail_famille_ecities.py index 9f87fea..8797d83 100644 --- a/rp_meyzieu/mappers/portail_famille_ecities.py +++ b/rp_meyzieu/mappers/portail_famille_ecities.py @@ -21,21 +21,22 @@ login_url, form_attrs, post_fields and username_field are obligatory * mapping """ -from rp_meyzieu.filters.example import ReplayFilter +from mandaye.auth.saml2 import END_POINTS_PATH +from rp_meyzieu.filters import portail_famille_ecitiz form_values = { - 'login_url': '/ffaxsslMeyzieu/workflow_url', + 'login_url': '/ffaxsslMeyzieu/workflow_url?ECITIZ_ACTIVITY_PATH=Citoyen&ECITIZ_HOME_URL=citoyen.jsp&ECITIZ_PROCESS_ID=guichet&ECITIZ_DECONNECTION_URL=services_list.jsp&ECITIZ_ORG=MEY00', 'form_attrs': { 'name': 'eCitiz' }, - 'post_fields': ['MonIdentifiant_champcalcule6', 'MonMotDePasse_champcalcule9', 'egoPage', 'workflow', 'egoToken', 'egoSubmitMeConnecter_action133_6T9N'], + 'post_fields': ['MonIdentifiant_champcalcule6', 'MonMotDePasse_champcalcule9'], 'username_field': 'MonIdentifiant_champcalcule6', 'password_field': 'MonMotDePasse_champcalcule9', -} + } urls = { - 'associate_url': '/mandaye/associate', - 'connection_url': '/mandaye/sso', - 'login_url': '/mandaye/login' -} + 'associate_url': '/ffaxsslMeyzieu/mandaye_associate', + 'connection_url': '/mandaye/sso', + 'login_url': '/mandaye/login' + } mapping = [ { @@ -61,20 +62,19 @@ mapping = [ }] }, { - 'path': r'/mandaye/associate$', + 'path': r'/ffaxsslMeyzieu/mandaye_associate$', 'method': 'GET', + 'target': '/ffaxsslMeyzieu/workflow_url?ECITIZ_ACTIVITY_PATH=Citoyen&ECITIZ_HOME_URL=citoyen.jsp&ECITIZ_PROCESS_ID=guichet&ECITIZ_DECONNECTION_URL=services_list.jsp&ECITIZ_ORG=MEY00', 'on_response': [{ - 'filter': ReplayFilter.associate, + 'filter': portail_famille_ecitiz.associate, 'values': { 'action': urls['associate_url'], 'template': 'portail_famille/associate.html', - 'login_name': form_values['username_field'], - 'password_name': form_values['password_field'], }, },] }, { - 'path': r'/mandaye/associate$', + 'path': r'/ffaxsslMeyzieu/mandaye_associate$', 'method': 'POST', 'response': [ { @@ -83,5 +83,24 @@ mapping = [ }, ] }, + { + 'path': r'%s$' % END_POINTS_PATH['single_sign_on_post'], + 'method': 'POST', + 'response': [{'auth': 'single_sign_on_post'}] + }, + { + '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', + }] + }, ]