[CalendarServer-changes] [10631] CalendarServer/branches/users/glyph/digest-auth-redux
source_changes at macosforge.org
source_changes at macosforge.org
Fri Feb 1 15:53:30 PST 2013
Revision: 10631
http://trac.calendarserver.org//changeset/10631
Author: glyph at apple.com
Date: 2013-02-01 15:53:30 -0800 (Fri, 01 Feb 2013)
Log Message:
-----------
Delegate a bit more of the implementation to its superclass.
Modified Paths:
--------------
CalendarServer/branches/users/glyph/digest-auth-redux/twistedcaldav/directory/digest.py
Property Changed:
----------------
CalendarServer/branches/users/glyph/digest-auth-redux/
Modified: CalendarServer/branches/users/glyph/digest-auth-redux/twistedcaldav/directory/digest.py
===================================================================
--- CalendarServer/branches/users/glyph/digest-auth-redux/twistedcaldav/directory/digest.py 2013-02-01 23:53:23 UTC (rev 10630)
+++ CalendarServer/branches/users/glyph/digest-auth-redux/twistedcaldav/directory/digest.py 2013-02-01 23:53:30 UTC (rev 10631)
@@ -144,11 +144,12 @@
self.qop = qop
self.db = DigestCredentialsMemcache(namespace)
+
@inlineCallbacks
def getChallenge(self, peer):
"""
- Generate the challenge for use in the WWW-Authenticate header
- Do the default behavior but then strip out any 'qop' from the challenge fields
+ Generate the challenge for use in the WWW-Authenticate header Do the
+ default behavior but then strip out any 'qop' from the challenge fields
if no qop was specified.
@param peer: The L{IAddress} of the requesting client.
@@ -157,7 +158,9 @@
header.
"""
- c = self.generateNonce()
+ challenge = yield (super(QopDigestCredentialFactory, self)
+ .getChallenge(peer))
+ c = challenge['nonce']
# Make sure it is not a duplicate
result = (yield self.db.has_key(c))
@@ -167,13 +170,6 @@
# The database record is a tuple of (nonce-count, timestamp)
yield self.db.set(c, (0, time.time()))
- challenge = {
- 'nonce': c,
- 'qop': 'auth',
- 'algorithm': self.algorithm,
- 'realm': self.realm,
- }
-
if self.qop:
challenge['qop'] = self.qop
else:
@@ -185,6 +181,7 @@
returnValue(challenge)
+
@inlineCallbacks
def decode(self, response, request):
"""
@@ -236,10 +233,9 @@
originalMethod = None
credentials = DigestedCredentials(username,
- request.method,
- self.realm,
- auth,
- originalMethod)
+ originalMethod or request.method,
+ self._real.authenticationRealm,
+ auth)
if not self.qop and credentials.fields.has_key('qop'):
del credentials.fields['qop']
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130201/3ef497f1/attachment.html>
More information about the calendarserver-changes
mailing list