2008/7/19 Thierry Dumont <[EMAIL PROTECTED]>:
>  I have posted some time ago some messages about ldap identification I
> want to put in Sage...
>
> It is not so easy as I could imagine: Sage relies on "twisted" (and may
> be on some parts of Zope -am I wrong?- to do this);

1. Sage *only* uses Twisted to give a provide a web-based interface
to the Sage notebook.  The sage notebook system makes no further
use of Twisted whatever.   In particular, Twisted is "hardly" relevant
to authentication.   There is all that twisted-using code in avatars.py
that might seem to be relevant to authentication for the sage notebook,
but trust me -- it isn't.  It is just something that uses what is really
relevant which is the function "user" in the notebook.py file. Here's
the code in avatars.py that calls into this:
    def requestAvatarId(self, credentials):
        username = credentials.username
        password = credentials.password
        try:
            U = twist.notebook.user(username)
        except KeyError:
            return defer.succeed(FailedLogin(username, failure_type = 'user'))

        if U.password_is(password):
            return defer.succeed(username)
        else:
            return defer.succeed(FailedLogin(username,failure_type='password'))

Notice U = .. and U.password_is(...).  That's all that matters for
authentication,
and that code in notebook.py and user.py is almost as trivial as you could
possibly imagine, using nothing at all interesting (except a hash function).

2. The Sage notebook makes absolutely *no* use whatsoever of ZOPE
or ZODB.

> may be what I want
> to do is not very complicated but I am lost in "twisted", and I lack time.

You have to modify the above-pasted code to do something
else involving twist.notebook.  This "twist.notebook" thing
is, by the way, nothing more than a global instance of a Notebook
object (as defined in notebook.py) that happens to be a module-scope
variable in the twist.py file.  Otherwise it has nothing to do with
twisted.

Why don't we work together on this.  Write a pure-python file
called something like "notebook_ldap.py" that provides a
simple interface to the ldap stuff you have setup.   Show
some examples of how to use it from the command line
to authenticate a user.  Then I bet *i* can easily plug your
code into the notebook so that it will work.

> I would like to trace all the procedures called during the
> identification, in the notebook.
>
> In python, there exists some tools:
>
> python -m pdb  myprogram.py
> or
> python trace.py --count monprog.py
>
> to know where the prgram goes.
>
> But how to do this in Sage, with the notebook ?


 -- William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to