[CalendarServer-changes] [456]
CalendarServer/branches/users/wsanchez/provisioning/lib-patches/
Twisted/twisted.web2.dav.auth.patch
source_changes at macosforge.org
source_changes at macosforge.org
Tue Nov 14 18:39:40 PST 2006
Revision: 456
http://trac.macosforge.org/projects/calendarserver/changeset/456
Author: wsanchez at apple.com
Date: 2006-11-14 18:39:40 -0800 (Tue, 14 Nov 2006)
Log Message:
-----------
Modified Paths:
--------------
CalendarServer/branches/users/wsanchez/provisioning/lib-patches/Twisted/twisted.web2.dav.auth.patch
Modified: CalendarServer/branches/users/wsanchez/provisioning/lib-patches/Twisted/twisted.web2.dav.auth.patch
===================================================================
--- CalendarServer/branches/users/wsanchez/provisioning/lib-patches/Twisted/twisted.web2.dav.auth.patch 2006-11-15 02:32:17 UTC (rev 455)
+++ CalendarServer/branches/users/wsanchez/provisioning/lib-patches/Twisted/twisted.web2.dav.auth.patch 2006-11-15 02:39:40 UTC (rev 456)
@@ -0,0 +1,68 @@
+Index: twisted/web2/dav/auth.py
+===================================================================
+--- twisted/web2/dav/auth.py (revision 18545)
++++ twisted/web2/dav/auth.py (working copy)
+@@ -40,7 +40,7 @@
+
+ def requestAvatar(self, avatarId, mind, *interfaces):
+ if IPrincipal in interfaces:
+- return IPrincipal, davxml.Principal(davxml.HRef(avatarId))
++ return IPrincipal, davxml.Principal(davxml.HRef(avatarId[0])), davxml.Principal(davxml.HRef(avatarId[1]))
+
+ raise NotImplementedError("Only IPrincipal interface is supported")
+
+@@ -52,33 +52,44 @@
+ class PrincipalCredentials(object):
+ implements(IPrincipalCredentials)
+
+- def __init__(self, principal, principalURI, credentials):
+- self.principal = principal
+- self.principalURI = principalURI
++ def __init__(self, authnPrincipal, authzPrincipal, credentials):
++ """
++ Initialize with both authentication and authorization values. Note that in most cases theses will be the same
++ since HTTP auth makes no distinction between the two - but we may be layering some addition auth on top of this
++ (.e.g.. proxy auth, cookies, forms etc) that make result in authentication and authorization being different.
++
++ @param authnPrincipal: L{IDAVPrincipalResource} for the authenticated principal.
++ @param authnURI: C{str} containing the URI of the authenticated principal.
++ @param authzPrincipal: L{IDAVPrincipalResource} for the authorized principal.
++ @param authzURI: C{str} containing the URI of the authorized principal.
++ @param credentials: L{ICredentials} for the authentication credentials.
++ """
++ self.authnPrincipal = authnPrincipal
++ self.authzPrincipal = authzPrincipal
+ self.credentials = credentials
+
+ def checkPassword(self, password):
+ return self.credentials.checkPassword(password)
+
+
+-class TwistedPropertyChecker:
++class TwistedPropertyChecker(object):
+ implements(checkers.ICredentialsChecker)
+
+ credentialInterfaces = (IPrincipalCredentials,)
+
+- def _cbPasswordMatch(self, matched, principalURI):
++ def _cbPasswordMatch(self, matched, principalURIs):
+ if matched:
+- return principalURI
++ # We return both URIs
++ return principalURIs
+ else:
+- raise error.UnauthorizedLogin(
+- "Bad credentials for: %s" % (principalURI,))
++ raise error.UnauthorizedLogin("Bad credentials for: %s" % (principalURIs[0],))
+
+ def requestAvatarId(self, credentials):
+ pcreds = IPrincipalCredentials(credentials)
+- pswd = str(pcreds.principal.readDeadProperty(TwistedPasswordProperty))
++ pswd = str(pcreds.authnPrincipal.readDeadProperty(TwistedPasswordProperty))
+
+ d = defer.maybeDeferred(credentials.checkPassword, pswd)
+- d.addCallback(self._cbPasswordMatch, pcreds.principalURI)
++ d.addCallback(self._cbPasswordMatch, (pcreds.authnPrincipal.principalURL(), pcreds.authzPrincipal.principalURL()))
+ return d
+
+ ##
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20061114/f32571ba/attachment.html
More information about the calendarserver-changes
mailing list