rp_meyzieu: begin working replay

This commit is contained in:
Jérôme Schneider 2014-05-30 19:18:48 +02:00
parent 6e74be3365
commit 8e99b9a8e2
5 changed files with 63 additions and 27 deletions

Binary file not shown.

View File

@ -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

View File

@ -0,0 +1,21 @@
import re
from mandaye.log import logger
def associate(env, values, request, response):
if response.msg and "<form" in response.msg:
sub = re.subn(r'<form action="/ffaxsslMeyzieu/workflow_url".*?>', '<form action="/ffaxsslMeyzieu/mandaye_associate" method="post" accept-charset="UTF-8">',
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('<a name="egoSubmitMeConnecter_action133_6T9N"></a>', '')
response.msg = response.msg.replace('Connexion', 'Association')
sub = re.subn(r'<input type="submit" name="egoSubmitMeConnecter_action133_6T9N".*?>', '<input type="submit" title="" class="teamnetButtonValid teamnetButtonValidLeftToRight" value="Associer" />',
response.msg)
response.msg = sub[0]
if sub[1] != 1:
logger.warning('Filter portail_famille_ecitiz.associate: submit replacement failed !')
return response

View File

@ -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': [
{

View File

@ -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',
}]
},
]