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-vincennes/mandaye_vincennes/mappers/famille_vincennes.py

114 lines
3.8 KiB
Python

from mandaye.auth.saml2 import END_POINTS_PATH
from mandaye_vincennes.filters import vincennes
folder_target = '/vincennes-noredirect'
filters = vincennes.EspaceFamille()
form_values = {
'post_url': '%s/login.do' % folder_target,
'login_url': '%s/index.do' % folder_target,
'form_attrs': { 'action': 'login.do', },
'post_fields': ['codeFamille', 'motDePasse'],
'username_field': 'codeFamille',
'password_field': 'motDePasse'
}
urls = {
'login_url': '/mandaye/login',
'associate_url': '%s/associate' % folder_target,
'connection_url': '/mandaye/sso',
'disassociate_url': '/mandaye/disassociate',
}
mapping = [
{
'path': r'/$',
'method': 'GET',
'redirect': '%s/affichage_accueil_prive.do' % folder_target
},
{
'path': r"/(?!.*/associate)",
'on_response': [{
'filter': filters.resp_login_page,
'content-types': ['text/html'],
'values': {
'connection_url': '/mandaye/sso',
'template': 'famille/login.html',
'title': 'Connexion via votre compte citoyen'
}
},]
},
{
'path': r'/mandaye/login$',
'method': 'GET',
'response': {
'auth': 'login',
'values': {'condition': 'response.code==302'},
},
},
{
'path': r'%s/associate$' % folder_target,
'method': 'GET',
'target': '%s/index.do' % folder_target,
'on_response': [{
'filter': filters.resp_associate,
'values': {
'action': '%s/associate' % folder_target,
'template': 'famille/associate.html',
'title': 'Associer un compte au compte citoyen de Vincennes',
'badlogin_msg': "Code famille et/ou mot de passe incorrects",
'failed_msg': "Vos identifiants pour l'espace famille ne fonctionnent plus ! Merci de les ressaisir.",
},
}]
},
{
'path': r'%s/associate$' % folder_target,
'method': 'POST',
'response': {
'auth': 'associate_submit',
'values': {'condition': 'response.code==302'}
},
},
{
'path': r'/mandaye/sso$',
'method': 'GET',
'response': {
'auth': 'sso',
'values': {
'next_url': '/mandaye/login',
}
}
},
{
'path': r'%s$' % END_POINTS_PATH['single_sign_on_post'],
'method': 'POST',
'response': {
'auth': 'single_sign_on_post',
'values': {
'login_url': '/mandaye/login',
}
}
},
{
'path': r'%s/mandayelogout$' % folder_target,
'method': 'GET',
'target': '%s/deconnexion.do' % folder_target,
'on_response': [{
'filter': vincennes.local_logout,
}]
},
{
'path': r'/mandaye/disassociate$',
'method': 'GET',
'response': {
'auth': 'disassociate',
'values': {
'next_url': '%s/deconnexion.do' % folder_target,
},
}
},
]