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/mandaye/skel/example.module/configs/linuxfr_saml_example.py

50 lines
1.7 KiB
Python

from {project_name}.auth.example import MyAuthSAML
from {project_name}.filters.example import ReplayFilter
from mandaye.configs import saml2 as saml2_config
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]',
}}
auth = MyAuthSAML(form_values, 'linuxfr', saml2_config)
linuxfr_mapping = [
{{
'path': r'/mandaye/associate$',
'method': 'GET',
'on_response': [{{
'filter': ReplayFilter.associate,
'values': {{
'action': '/mandaye/associate',
'template': 'associate.html',
'sp_name': 'Linux FR',
'login_name': form_values['username_field'],
'password_name': form_values['password_field'],
}},
}},]
}},
{{
'path': r'/mandaye/associate$',
'method': 'POST',
'response': [
{{
'filter': auth.associate_submit,
'values': {{
'connection_url': '/mandaye/sso',
'associate_url': '/mandaye/associate',
}},
'condition': "response.code==302"
}},
]
}},
]
linuxfr_mapping.extend(auth.get_default_mapping())