Re: [Zope3-dev] logout patterns: a small proposal

2006-01-03 Thread Stephan Richter
On Thursday 08 December 2005 10:11, Gary Poster wrote:
> Thoughts?

+1

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] logout patterns: a small proposal

2005-12-13 Thread Gary Poster

I plan to do this tomorrow, in the "silence means consent" vein.

Want to refresh your memory?

http://mail.zope.org/pipermail/zope3-dev/2005-December/016887.html

Gary
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] logout patterns: a small proposal

2005-12-08 Thread Gary Poster


On Dec 8, 2005, at 10:58 AM, Sidnei da Silva wrote:


On Thu, Dec 08, 2005 at 10:11:46AM -0500, Gary Poster wrote:
| ...

Sounds good to me.


Cool.


Only one issue that you should have in mind, and that has bitten me
several times with the Zope 2 PluggableAuthService is the following:

If you use the 'HTTPBasicAuthHelper' for login, that doesn't mean you
can use it for logout. That is specially true if you happen to use the
'CookieAuthHelper', which translates cookie-based credentials to http
basic.

What happens is that it in PAS, if you call logout() it will call all
the 'ICredentialsReset', however if the HTTPBasicHelper happens
to be one of those, it will raise a 'Unauthorized' exception, because
that's how you log someone out using http basic auth, and then two
things happen:

1. The cookie credentials don't get erased because of the Unathorized
2. Any plugins that happened to be enabled for ICredentialsReset won't
   fire.


Thanks: that is interesting, and answers some idle questions I had  
lying around in my head.


In the case of the Zope 3 pluggable auth, though, there are a number  
of reasons why this (currently) doesn't come into play.  A  
particularly pertinent reason is that the default basic auth plug-in  
doesn't do the 'raise Unauthorized' trick--it just rolls over and  
plays dead (i.e., 'pass').  Logging out is effectively not available  
if you are logged in via the standard basic auth.  This is a case in  
which you would not want to offer 'log out' in the UI (or you'd want  
to work out some other compromise).


Gary
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] logout patterns: a small proposal

2005-12-08 Thread Sidnei da Silva
On Thu, Dec 08, 2005 at 10:11:46AM -0500, Gary Poster wrote:
| There are a surprising number of components in zope.app designed to  
| help with logging out.  They are all trying to solve the problem that  
| some authentication can't log out, so you shouldn't show logout links  
| then.
| 
| I only care about the pluggable auth in zope.app.authentication.   
| Therefore what I want is a way to determine whether the credentials  
| plugin used supports logout.  I want this to be dynamic, responding  
| to TTW configuration of the pluggable auth, which the current  
| zope.app solutions are not.
| 
| Jim suggested that a subscriber to principal creation event might  
| scribble an attribute on the (transient) principal object that  
| indicated that the credentials plugin used to create the principal  
| supported logout.  This would be easy to do, light-weight, robust  
| (i.e., even in the face of multiple active credentials plugins),  
| something that I could do without committing the zope project to the  
| solution, and easy to use (my tal could do something like  
| """tal:condition="request/principal/canLogout|nothing""").
| 
| The problem is that the principal creation event does not include the  
| credentials plugin used by the authentication.
| 
| The easiest way to approach this, given the current pluggable auth  
| design, is to add a 'credentialsPlugin' attribute on the info object  
| passed to the principal creation factory.  The 'credentialsPlugin'  
| attribute would have a reference to the credentialsPlugin used, and  
| would be assigned by the authentication utility.  This is a solution  
| because the event fired already includes the info object.
| 
| Pros:
| - It enables a more dynamic and much simpler story for determining  
| whether an app can support logging out than the current pertinent  
| zope.app code (as long as you only use pluggable auth).
| - It's a one-line change to the code itself (not including interface  
| and test changes).  No grand architecture changes.
| - the 'info' object seems to be a reasonable place to add information  
| about the process used to create the principal.
| - It's ignorable, for those that wish to ignore it.
| 
| Cons:
| - This is the only use case I know of for the behavior, so it has a  
| small feel of 'scratch an itch'.  Maybe that's not too bad here.

Sounds good to me.

Only one issue that you should have in mind, and that has bitten me
several times with the Zope 2 PluggableAuthService is the following:

If you use the 'HTTPBasicAuthHelper' for login, that doesn't mean you
can use it for logout. That is specially true if you happen to use the
'CookieAuthHelper', which translates cookie-based credentials to http
basic.

What happens is that it in PAS, if you call logout() it will call all
the 'ICredentialsReset', however if the HTTPBasicHelper happens
to be one of those, it will raise a 'Unauthorized' exception, because
that's how you log someone out using http basic auth, and then two
things happen:

1. The cookie credentials don't get erased because of the Unathorized
2. Any plugins that happened to be enabled for ICredentialsReset won't
   fire.

Hope that helps,

-- 
Sidnei da Silva
Enfold Systems, LLC.
http://enfoldsystems.com
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com