zopefoundation / Products.PluggableAuthService

Pluggable Zope authentication / authorization framework
Other
9 stars 18 forks source link

Improve the PAS override for Zope's `manage_zmi_logout` #108

Closed d-maurer closed 2 years ago

d-maurer commented 2 years ago

Fixes #107 -- more precisely, tries to improve the behavior of the PAS override of Zope's manage_zmi_logout. But it is not complete and may even work worse then previously.

Previously, the PAS override of manage_zmi_logout made the (implicit) assumption that the top level user folder uses HTTP authentication. #107 demonstrates that it fails miserably when this assumption is not met.

This PR drops the assumption but it can not guarantee full logout. The problem arises when the current request contains credentials for different user folders (e.g. manager credentials for the top level user folder and credentials for a portal's user folder). The manage_zmi_logout will reset the credentials for the lowest user folder in the current context (the one that authenticated the current user) provided that this user folder implements IPluggableAuthService (otherwise, Zope's manage_zmi_logout will be called which assumes HTTP authentication). If the request still contains credentials for further up user folders, then the logout will not be complete and the user must again call for a logout.

The support for HTTP authentication prevents us from performing an automated logout from all user folders in the current context because the HTTP logout requires the browser to show its login dialog and with this dialog the server loses control. We could do better in the absence of HTTP authentication (at least at the local level) but the PAS flexibility makes it hard to detect HTTP authentication reliably.