48 lines
1.6 KiB
Python
48 lines
1.6 KiB
Python
|
|
from mandaye.auth.saml2 import SAML2Auth
|
|
from mandaye.filters.replay import ReplayFilter
|
|
from mandaye.configs import saml2 as saml2_config
|
|
|
|
form_values = {
|
|
'form_url': '/compte/connexion',
|
|
'form_attrs': { 'id': 'new_account' },
|
|
'post_fields': ['account[login]', 'account[password]'],
|
|
'username_field': 'account[login]',
|
|
'password_field': 'account[password]',
|
|
}
|
|
|
|
auth = SAML2Auth(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())
|