50 lines
1.7 KiB
Python
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())
|
|
|