
I need basic authentication in twisted.web for an XMLRPC server. After reading the mailing list, the documentation and the code, I came up with the following solution. Since I'm rather new to twisted web, it would be nice if someone could comment on this code. Perhaps it is helpful as an example for others solving the same problem or trying to understand twisted.web and twisted.cred. Short usage instruction: Save the code to basicauth.py Start the server: twistd -noy basicauth.py http://localhost:8080/ will show the file "basicauth.py" after authenticating with user "bob" and password "123" By the way, twisted is fantastic. Franz-Josef Grosch -- Tenovis Comergo - Applications

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Since I'm rather new to twisted web, it would be nice if someone could comment on this code.
See below.
Perhaps it is helpful as an example for others solving the same problem or trying to understand twisted.web and twisted.cred.
Indeed, it came at the right moment, thanks. :^)
By the way, twisted is fantastic.
Indeed #2. :^)
def getChild(self, path, request): def loginSuccess(result): interface, avatar, logout = result return avatar
In order to make it return the right resource, I changed this last line as follows: return avatar.getChildWithDefault(path, request) - -- Nicola Larosa - nico@tekNico.net "Inside every old guy is a young guy wondering WTF happened." -- big-giant-head on Slashdot -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAUFEWXv0hgDImBm4RAqJPAKCRqUVbreP9Xz/JLKtJS33w3XzrYgCgu4Rv U/PjSECLf7LhDqZlCs2w93U= =syKk -----END PGP SIGNATURE-----
participants (2)
-
Grosch Franz-Josef (MPA/DF)
-
Nicola Larosa