diff --git a/rp_meyzieu.db b/rp_meyzieu.db deleted file mode 100644 index d05bf3e..0000000 Binary files a/rp_meyzieu.db and /dev/null differ 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', + }] + }, ]