[ZODB-Dev] SecureServerStorage and SecureClientStorage

Christian Reis kiko@async.com.br
Fri, 4 Oct 2002 13:01:50 -0300


On Thu, Oct 03, 2002 at 03:52:47PM -0300, Johan Dahlin wrote:
> 4. I am modifying the ServerStub class directly at the moment, could
> this be solved in a different way?

Looking through the code, we have something like:

> def authUser(self, storage_id, username, password):
>     return self.rpc.call('authUser', storage_id, username, password)
> ServerStub.StorageServer.authUser = authUser

This stub is called by testConnection here:

>    def testConnection(self, conn):
>        LOG("ClientStorage", INFO, "Testing connection %r" % conn)
>        stub = ServerStub.StorageServer(conn)
>        storage_id = str(self._storage)
>        retval = stub.authUser(storage_id,
>                               self._username,
>                               self._password)
>        if not retval:
>            raise AuthError
>        
>        try:
>            stub.register(storage_id, self._is_read_only)
>            return 1
>        except POSException.ReadOnlyError:
>            if not self._read_only_fallback:
>                raise
>            LOG("ClientStorage", INFO,
>                "Got ReadOnlyError; trying again with read_only=1")
>            stub.register(storage_id, read_only=1)
>            return 0

Jeremy/Guido, would there be a nicer way of providing a hook for
authentication; perhaps by subclassing the stub and providing it to the
storage constructor?

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL