ermes logout: make slo when you using an idp
This commit is contained in:
parent
f5a75ea275
commit
3418203d49
|
@ -151,6 +151,24 @@ def registration_association(env, values, request, response):
|
|||
clean_registration_session(env, values, request, response)
|
||||
return response
|
||||
|
||||
def rewrite_logged_box(env, values, request, response):
|
||||
session = env.get('beaker.session')
|
||||
if response.msg and \
|
||||
'class="account_logoff"' in response.msg and \
|
||||
session and \
|
||||
session.has_key('unique_id'):
|
||||
r = re.compile(
|
||||
r'<a class="account_logoff" target="_top" href="#" tabindex="-1" role="menuitem".*?</a>',
|
||||
re.MULTILINE|re.DOTALL)
|
||||
|
||||
resp = re.sub(r,
|
||||
r"""
|
||||
<a target="_top" href="/mandaye/logout" tabindex="-1" role="menuitem"><i class="icon-off"> </i><span>Me déconnecter</span></a>
|
||||
""",
|
||||
response.msg)
|
||||
response.msg = resp
|
||||
return response
|
||||
|
||||
def is_user_locally_logged_in(env, request, response):
|
||||
session = env['beaker.session']
|
||||
if session.has_key('locally_logged_in') and session['locally_logged_in']:
|
||||
|
@ -159,7 +177,7 @@ def is_user_locally_logged_in(env, request, response):
|
|||
|
||||
def is_logged_in(env, values, request, response):
|
||||
session = env['beaker.session']
|
||||
if response.msg and 'account_logoff' in response.msg:
|
||||
if response.msg and '<div id="identite_utilisateur">Bienvenue' in response.msg:
|
||||
session['locally_logged_in'] = True
|
||||
else:
|
||||
session['locally_logged_in'] = False
|
||||
|
|
|
@ -53,10 +53,15 @@ mapping = [
|
|||
{
|
||||
'path': r'/',
|
||||
'method': 'GET',
|
||||
'on_response': [{
|
||||
'content-types': ['text/html'],
|
||||
'filter': archimed.is_logged_in,
|
||||
}],
|
||||
'content-types': ['text/html'],
|
||||
'on_response': [
|
||||
{
|
||||
'filter': archimed.is_logged_in,
|
||||
},
|
||||
{
|
||||
'filter': archimed.rewrite_logged_box
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
'path': r'/mandaye/login$',
|
||||
|
@ -74,9 +79,9 @@ mapping = [
|
|||
'response': {'auth': 'sso',}
|
||||
},
|
||||
{
|
||||
'path': r'/%s/DEFAULT/Ermes/Recherche/logon.svc/logoff$' % base,
|
||||
'on_response': [{'auth': 'logout',}],
|
||||
},
|
||||
'path': r'/%s/DEFAULT/Ermes/Recherche/logon.svc/logoff$' % base,
|
||||
'on_response': [{'auth': 'logout',}],
|
||||
},
|
||||
{
|
||||
'path': r'%s$' % END_POINTS_PATH['single_sign_on_post'],
|
||||
'method': 'POST',
|
||||
|
@ -122,7 +127,7 @@ mapping = [
|
|||
'action': '/mandaye/associate?next_url=/%s' % base,
|
||||
'login_name': form_values['username_field'],
|
||||
'password_name': form_values['password_field'],
|
||||
},
|
||||
},
|
||||
}]
|
||||
},
|
||||
{
|
||||
|
@ -154,5 +159,3 @@ mapping = [
|
|||
'response': {'filter': archimed.json_response,},
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
|
|
Reference in New Issue