65 lines
1.9 KiB
Python
65 lines
1.9 KiB
Python
|
|
from mandaye.auth.saml2 import SAML2Auth
|
|
from mandaye.filters.replay import ReplayFilter
|
|
from mandaye.configs import saml2 as saml2_config
|
|
|
|
from cam.filters import archimed
|
|
|
|
form_values = {
|
|
'form_action': '/BM/DEFAULT/logon.svc/logon',
|
|
'post_fields': ['username', 'password'],
|
|
'username_field': 'username',
|
|
'password_field': 'password',
|
|
}
|
|
|
|
auth = SAML2Auth(form_values, 'archimed', saml2_config)
|
|
|
|
archimed_mapping = [
|
|
{
|
|
'path': r'/',
|
|
'method': 'GET',
|
|
'on_request': [{
|
|
'filter': archimed.default_req,
|
|
}]
|
|
},
|
|
# {
|
|
# 'path': r'/*',
|
|
# 'method': 'GET',
|
|
# 'content-types': ['text/html', 'application/javascript'],
|
|
# 'on_response': [{
|
|
# 'filter': archimed.default_resp,
|
|
# }]
|
|
# },
|
|
{
|
|
'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"
|
|
},
|
|
]
|
|
},
|
|
]
|
|
|
|
archimed_mapping.extend(auth.get_default_mapping())
|
|
|