Mailing List Archive

[Zope-PTK] LoginManager (was Re: Stability rule-of-thumb (fwd))
At 02:06 PM 2/6/00 +1100, Stuart 'Zen' Bishop wrote:
>
>getUserNames has to be there to support the Zope management interface
>(eg. assigning a local role). Although this interface still works for
>3000 users, I'm fairly certain I'm going to have to start patching it
>to work with 40000...

Mike has offered to "sneak in" a patch to the DTML for the local roles
assignment screen that simply uses a text field for the user name instead
of a select list, being as the current interface sucks to use even for much
smaller lists than 3000 users.


>It seems that way. Some problems GUF tried to solve (being able to
>seperate the role membership, authentication, valid domains and
>now user properties) have now been pushed down to the user object.
>The valid user list has been factored out into the UserSource.
>
>There exists a need for all of these functions to be pluggable.

In the latest version of the LoginManager (formerly UUF) code, the base
class for User objects delegates the getRoles, getDomains, and authenticate
methods back to its UserSource, allowing a GUF-like UserSource to work. I
haven't finished the GUS (Generic User Source) yet, but about all it lacks
right now is a little transformation code (that could be lifted from GUF)
and a proper Zope management interface.


>It would be nifty (but probably outside the scope of an initial release)
>if multiple components could be selected as sources for the userproperties.
>In this way I could have multiple property sheets from different sources
>(possibly readonly). There would have to be a property sheet called
'default'
>which is read/write for applications such as PTK which need a

>backend-independant method of storing properties.

I expect we'll make an initial release this week. I've already written
three LoginMethod classes (Basic Auth, REMOTE_USER, and Basic Cookie), and
if you like the LoginManager system overall, I imagine you might want to
create a TokenCookie LoginMethod class using code from GUF. :)

I still need to bone up on the propertysheets protocol in order to add it
in to the base User and UserSource classes, but I don't think it'll be too
difficult to define a delegation protocol for it. Creating a good way of
plugging propertysheet implementations into a UserSource, however, is going
to be a bit trickier, I think.

Ty and I are pretty excited about the project. I can't wait to transform
our custom user folders into UserSources and drop all the duplicated
validation code. Plus the idea of being able to later add a LoginMethod
for say, SSL client certificates, without having to change any UserSource
code, is just phenomenal. And getting property sheets to be available is
cool too. One of our folders is LDAP based and it would be just great to
put all the LDAP attributes on a property sheet, and provide editing, too.
Re: [Zope-PTK] LoginManager (was Re: Stability rule-of-thumb (fwd)) [ In reply to ]
On Sun, 6 Feb 2000, Phillip J. Eby wrote:

> Mike has offered to "sneak in" a patch to the DTML for the local roles
> assignment screen that simply uses a text field for the user name instead
> of a select list, being as the current interface sucks to use even for much
> smaller lists than 3000 users.

Actually, I offered to champion a change. Just sneaking it in could
be hazardous to my health. (Read: You blew my cover! The gig's
up! ;-) )

> I expect we'll make an initial release this week. I've already written
> three LoginMethod classes (Basic Auth, REMOTE_USER, and Basic Cookie), and
> if you like the LoginManager system overall, I imagine you might want to
> create a TokenCookie LoginMethod class using code from GUF. :)

Layered LoginMethod classes are pretty exciting. I think that this
will allow one to implement a two-tier authentication scheme as discussed
in this list last month, and seen on Yahoo. This just occurred to me, so
I'm not sure if it'll work out but I'll outline the idea below.

For those just tuning in: with this scheme, you cache the user's
identity but not credentials in browser cookies. This is sufficient for
them to appear 'logged in' and do most portal tasks, but if the user
attempts to do something more sensitive (like create or edit an object, or
view/change their profile data) it pops up a login window to finish
authenticating the user.

The last-tried LoginMethod would look for just the identity cookie.
Instead of returning the actual User, it would return something that looks
like the user, but with Anonymous privelages and no sensitive data. When
the user attempts to do something sensitive,

That would allow the user to work on the portal with their customization
settings without logging in. When they try to do something sensitive, a
password propt pops up, and an earlier LoginMethod will begin returning
their actual User object.

--
Mike Pelletier email: mike@digicool.com
Mild mannered software developer icq: 7127228
by day, super villain by night. phone: 519-884-2434
Re: [Zope-PTK] LoginManager (was Re: Stability rule-of-thumb (fwd)) [ In reply to ]
At 02:54 PM 2/6/00 -0500, Mike Pelletier wrote:
>
> For those just tuning in: with this scheme, you cache the user's
>identity but not credentials in browser cookies. This is sufficient for
>them to appear 'logged in' and do most portal tasks, but if the user
>attempts to do something more sensitive (like create or edit an object, or
>view/change their profile data) it pops up a login window to finish
>authenticating the user.
>
> The last-tried LoginMethod would look for just the identity cookie.
>Instead of returning the actual User, it would return something that looks
>like the user, but with Anonymous privelages and no sensitive data. When
>the user attempts to do something sensitive,
>
> That would allow the user to work on the portal with their customization
>settings without logging in. When they try to do something sensitive, a
>password propt pops up, and an earlier LoginMethod will begin returning
>their actual User object.

Sounds like it could work quite well, at least in principle. If you wanted
to use the "forbiddenPage" hook with this, you might need to have it
explicitly check for one of these unauthenticated-user objects, and just
return so that the LoginManager falls through to the login method. The
tricky bit that I see is getting at the property sheets, since those are
managed by the user source, not the login method. I guess you could just
return a proxy wrapper over the user which overrode its getRoles() method.
But then there is the issue of how you would ever show the user links to do
things which they don't have logged-in permissions for, since such things
are usually filtered out of view...

Anyway, speaking of PropertySheets, I have been banging my brain up against
the OFS.PropertySheets module for the past hour or so with only limited
success. It appears that the OFS.PropertySheets concept of
"propertysheets" isn't quite the same as the ZClass notion of
"propertysheets". The former supports a sequence interface coupled with a
mapping-interface "get" method, while the latter wants to do
propertysheets.sheetname. Huh? Plus, I see what look to me like plain ol'
bugs in OFS.PropertySheets, suggesting that the code in question isn't
actually used. For example:

def delPropertySheet(self, name):
result=[]
for propset in self.aq_parent.__propsets__:
if propset.id != name and propset.xml_namespace() != name:
result.append(propset)
self.parent.__propsets__=tuple(result)

The last line seems to be a typo or leftover cruft from a previous
implementation approach.

Anywho, I think I have a general idea of how to implement a propertysheet
delegation protocol, but the devil is in the details: specifically, what
parts of the "propertysheets" object need to be supported. Mike, can you
tell me what the PTK needs, and/or point me to someone in DC who knows what
the rest of Zope does with the propertysheets attribute? Thanks.