137 lines
4.5 KiB
Python
137 lines
4.5 KiB
Python
|
|
from mandaye.auth.saml2 import SAML2Auth
|
|
from mandaye.auth.saml2 import END_POINTS_PATH
|
|
|
|
from cam.filters import archimed
|
|
|
|
base = 'EXPLOITATION'
|
|
|
|
form_values = {
|
|
'login_url': '/%s' % base,
|
|
'post_url': '/%s/Default/Ermes/Recherche/logon.svc/logon' % base,
|
|
'post_fields': ['username', 'password'],
|
|
'username_field': 'username',
|
|
'password_field': 'password',
|
|
}
|
|
|
|
urls = {
|
|
'login_url': '/mandaye/login',
|
|
'connection_url': '/mandaye/sso',
|
|
'associate_url': '/mandaye/associate',
|
|
'disassociate_url': '/mandaye/disassociate',
|
|
'disassociate_next_url': '/mandaye/logout',
|
|
'logout_url': '/mandaye/logout',
|
|
}
|
|
|
|
mapping = [
|
|
{
|
|
'path': r'/',
|
|
'on_request': [{
|
|
'filter': archimed.default_req,
|
|
'decompress': False,
|
|
}]
|
|
},
|
|
{
|
|
'path': r'/',
|
|
'on_response': [{
|
|
'filter': archimed.default_resp,
|
|
'content-types': ['text/html', 'application/javascript', 'application/x-javascript', 'application/json'],
|
|
}]
|
|
},
|
|
{
|
|
'path': r'/mandaye/login$',
|
|
'method': 'GET',
|
|
'response': {
|
|
'auth': 'login',
|
|
'values': {
|
|
'associate_url': '/mandaye/associate',
|
|
'condition': "'\"success\":true' in response.msg"
|
|
},
|
|
}
|
|
},
|
|
{
|
|
'path': r'/mandaye/sso$',
|
|
'method': 'GET',
|
|
'response': {'auth': 'sso',}
|
|
},
|
|
{
|
|
'path': r'%s$' % END_POINTS_PATH['single_sign_on_post'],
|
|
'method': 'POST',
|
|
'response': {
|
|
'auth': 'single_sign_on_post',
|
|
'values': {
|
|
'login_url': '/mandaye/login',
|
|
'next_url': '/%s/' % base
|
|
}
|
|
}
|
|
},
|
|
{
|
|
'path': r'%s$' % END_POINTS_PATH['single_logout'],
|
|
'method': 'GET',
|
|
'response': {'auth': 'single_logout'}
|
|
},
|
|
{
|
|
'path': r'%s$' % END_POINTS_PATH['single_logout_return'],
|
|
'method': 'GET',
|
|
'response': {
|
|
'auth': 'single_logout_return',
|
|
'values': {
|
|
'next_url': '/%s' % base
|
|
}
|
|
}
|
|
},
|
|
{
|
|
'path': r'/mandaye/associate$',
|
|
'method': 'GET',
|
|
'response': {
|
|
'filter': archimed.associate,
|
|
'values': {
|
|
'action': '/mandaye/associate?next_url=/%s' % base,
|
|
'template': 'archimed/associate.html',
|
|
'sp_name': 'Archimed',
|
|
'login_name': form_values['username_field'],
|
|
'password_name': form_values['password_field'],
|
|
},
|
|
},
|
|
'on_request': [{
|
|
'filter': archimed.associate_req,
|
|
'values': {
|
|
'action': '/mandaye/associate?next_url=/%s' % base,
|
|
'login_name': form_values['username_field'],
|
|
'password_name': form_values['password_field'],
|
|
},
|
|
}]
|
|
},
|
|
{
|
|
'path': r'/mandaye/associate_confirm$',
|
|
'method': 'GET',
|
|
'response': {
|
|
'filter': archimed.associate_confirm,
|
|
'values': {
|
|
'associate_url': '/mandaye/associate',
|
|
'template': 'archimed/associate_confirm.html',
|
|
},
|
|
}
|
|
},
|
|
{
|
|
'path': r'/mandaye/associate$',
|
|
'method': 'POST',
|
|
'response': {
|
|
'auth': 'associate_submit',
|
|
'values': {'condition': "'\"success\":true' in response.msg"}
|
|
},
|
|
'on_reponse': [
|
|
{
|
|
'filter': archimed.clean_registration_session,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
'path': r'/mandaye/json$',
|
|
'method': 'GET',
|
|
'response': {'filter': archimed.json_response,},
|
|
},
|
|
]
|
|
|
|
|