summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjschneider <jschneider@3ed937ae-f919-0410-9a43-8e6f19e4ba6e>2009-09-30 10:19:22 (GMT)
committerjschneider <jschneider@3ed937ae-f919-0410-9a43-8e6f19e4ba6e>2009-09-30 10:19:22 (GMT)
commitb219c94759a59ca7e7a3e43c200fc454913a4509 (patch)
tree962431ccfb2e9e3896a69ce075e97082338a2593
parentdddf6c413200044e8ebca1952e0a290920e6c5ca (diff)
downloadlarpe-b219c94759a59ca7e7a3e43c200fc454913a4509.zip
larpe-b219c94759a59ca7e7a3e43c200fc454913a4509.tar.gz
larpe-b219c94759a59ca7e7a3e43c200fc454913a4509.tar.bz2
Bug fixes in logout
* larpe/saml2.ptl: bad variables name and code cleaning * larpe/site_authentication.ptl: fix bugs in local_logout git-svn-id: svn+ssh://labs.libre-entreprise.org/svnroot/larpe@482 3ed937ae-f919-0410-9a43-8e6f19e4ba6e
-rw-r--r--larpe/trunk/larpe/saml2.ptl49
-rw-r--r--larpe/trunk/larpe/site_authentication.ptl9
2 files changed, 27 insertions, 31 deletions
diff --git a/larpe/trunk/larpe/saml2.ptl b/larpe/trunk/larpe/saml2.ptl
index 94a2648..7e1fb87 100644
--- a/larpe/trunk/larpe/saml2.ptl
+++ b/larpe/trunk/larpe/saml2.ptl
@@ -315,7 +315,7 @@ class Saml2(Saml2Directory):
request_session_index = logout.request.sessionIndex
if request_name_identifier == name_identifier and \
(not session_index or request_session_index == session_index) \
- and session.lasso_session_dump.get(providerId):
+ and session.lasso_session_dumps.get(providerId):
get_logger().info('SLO/SOAP from %s' % logout.remoteProviderId)
break
else:
@@ -393,33 +393,26 @@ class Saml2(Saml2Directory):
else:
raise
else:
- try:
- providerId = logout.server.providerId
- session_index = logout.request.sessionIndex
- name_identifier = logout.nameIdentifier.content
- # Remove reference to local authentication on this SP in the session
- # if a user is present, try a local logout
- for session2 in get_session_manager().values():
- if session2.lasso_session_name_identifiers.get(providerId) == name_identifier \
- and ( not session_index
- or session2.lasso_session_indexes.get(providerId) == session_index):
- if session2.users.has_key(provider_id):
- # try a local logout
- try:
- site_authentication.get_site_authentication(Host.get_host_from_url()).local_logout(user=session2.users[provider_id], cookies=getattr(session2,'cookies'))
- except:
- pass
- del session2.users[provider_id]
- if session2.lasso_session_dumps.has_key(provider_id):
- del session2.lasso_session_dumps[provider_id]
- if session2.lasso_session_indexes.has_key(provider_id):
- del session2.lasso_session_indexes[provider_id]
- if session2.lasso_session_name_identifiers.has_key(provider_id):
- del session2.lasso_session_name_identifiers[provider_id]
- session2.store()
- except:
- # killing all session failed, ignoring silently
- pass
+ providerId = logout.server.providerId
+ session_index = logout.request.sessionIndex
+ name_identifier = logout.nameIdentifier.content
+ # Remove reference to local authentication on this SP in the session
+ # if a user is present, try a local logout
+ for session2 in get_session_manager().values():
+ if session2.lasso_session_name_identifiers.get(providerId) == name_identifier \
+ and ( not session_index
+ or session2.lasso_session_indexes.get(providerId) == session_index):
+ if session2.users.has_key(providerId):
+ # try a local logout
+ site_authentication.get_site_authentication(Host.get_host_from_url()).local_logout(user=session2.users[providerId], cookies=getattr(session2,'cookies'))
+ del session2.users[providerId]
+ if session2.lasso_session_dumps.has_key(providerId):
+ del session2.lasso_session_dumps[providerId]
+ if session2.lasso_session_indexes.has_key(providerId):
+ del session2.lasso_session_indexes[providerId]
+ if session2.lasso_session_name_identifiers.has_key(providerId):
+ del session2.lasso_session_name_identifiers[providerId]
+ session2.store()
get_session_manager().expire_session(logout.server.providerId)
logout.buildResponseMsg()
diff --git a/larpe/trunk/larpe/site_authentication.ptl b/larpe/trunk/larpe/site_authentication.ptl
index 49cb8ee..93b9b81 100644
--- a/larpe/trunk/larpe/site_authentication.ptl
+++ b/larpe/trunk/larpe/site_authentication.ptl
@@ -300,11 +300,14 @@ class SiteAuthentication:
url = self.host.logout_url
if url is not None and cookies is not None:
try:
- http_get_page(url, {'Cookie': federation.cookies})
- except:
- pass
+ http_get_page(url, {'Cookie': cookies})
+ except ConnectionError, err:
+ get_logger().warning(_"%s logout failed" % url)
+ get_logger().debug(err)
# Remove cookies from the browser
+ # TODO: this should be removed because this only works
+ # with a 'direct' logout
if hasattr(self.host, 'cookies'):
for cookie in self.host.cookies:
get_response().expire_cookie(cookie, path='/')