This repository has been archived on 2023-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
mandaye-meyzieu/rp_meyzieu/mappers/linuxfr_example.py

86 lines
2.3 KiB
Python

"""
You need to defined 3 variables :
* form_values (defined the login form values):
form_values = {
'login_url': '/login',
'post_url': '/login',
'form_attrs': { 'name': 'form40', },
'username_field': 'user',
'password_field': 'pass',
'post_fields': ['birthdate', 'card_number']
}
login_url, form_attrs, post_fields and username_field are obligatory
* urls (a dictionnary with urls) :
urls = {
'associate_url': '/mandaye/associate',
'connection_url': '/mandaye/sso',
'login_url': '/mandaye/login'
}
* mapping
"""
from rp_meyzieu.filters.example import ReplayFilter
form_values = {
'login_url': '/compte/connexion',
'form_attrs': { 'id': 'new_account' },
'post_fields': ['account[login]', 'account[password]'],
'username_field': 'account[login]',
'password_field': 'account[password]',
}
urls = {
'associate_url': '/mandaye_associate',
'connection_url': '/mandaye/sso',
'login_url': '/mandaye/login'
}
mapping = [
{
'path': r'/mandaye/login$',
'method': 'GET',
'response': [{
'auth': 'login',
'condition': 'response.code==302',
},]
},
{
'path': r'/mandaye/sso$',
'method': 'GET',
'response': [{
'auth': 'sso',
}]
},
{
'path': r'/mandaye/slo$',
'method': 'GET',
'response': [{
'auth': 'slo',
}]
},
{
'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': ecitiz.associate,
'values': {
'action': urls['associate_url'],
},
},]
},
{
'path': r'/mandaye_associate$',
'method': 'POST',
'response': [
{
'auth': 'associate_submit',
'condition': "response.code==302"
},
]
},
]