incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ket...@apache.org
Subject svn commit: r493349 - in /incubator/heraldry/libraries/python/openid/trunk/openid: consumer/consumer.py test/test_consumer.py
Date Sat, 06 Jan 2007 05:23:52 GMT
Author: keturn
Date: Fri Jan  5 21:23:51 2007
New Revision: 493349

URL: http://svn.apache.org/viewvc?view=rev&rev=493349
Log:
[python-to-heraldry @ Make _createAssociateRequest look at endpoint compatibility mode when
including openid.ns in associate request]

Original author: cygnus@janrain.com
Date: 2006-12-20 23:32:01+00:00

Modified:
    incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py
    incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py?view=diff&rev=493349&r1=493348&r2=493349
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py Fri Jan 
5 21:23:51 2007
@@ -816,6 +816,9 @@
             'openid.assoc_type': assoc_type,
             }
 
+        if not endpoint.compatibilityMode():
+            args['openid.ns'] = OPENID2_NS
+
         if assoc_session.session_type != 'no-encryption':
             args['openid.session_type'] = assoc_session.session_type
 

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py?view=diff&rev=493349&r1=493348&r2=493349
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py Fri Jan
 5 21:23:51 2007
@@ -5,7 +5,8 @@
 from openid.message import Message, OPENID_NS, OPENID2_NS, IDENTIFIER_SELECT
 from openid import cryptutil, dh, oidutil, kvform
 from openid.store.nonce import mkNonce, split as splitNonce
-from openid.consumer.discover import OpenIDServiceEndpoint
+from openid.consumer.discover import OpenIDServiceEndpoint, OPENID_2_0_TYPE, \
+     OPENID_1_1_TYPE
 from openid.consumer.consumer import \
      AuthRequest, GenericConsumer, SUCCESS, FAILURE, CANCEL, SETUP_NEEDED, \
      SuccessResponse, FailureResponse, SetupNeededResponse, CancelResponse, \
@@ -1016,6 +1017,12 @@
                     self.consumer._createAssociateRequest(self.endpoint,
                                                           'HMAC-SHA1',
                                                           'DH-SHA1')
+
+        assert self.endpoint.compatibilityMode() == \
+               (args.get('openid.ns') is None), \
+               "Endpoint compat mode %r != (openid.ns in args)" % \
+               (self.endpoint.compatibilityMode())
+
         message = Message.fromPostArgs(args)
         server_sess = DiffieHellmanSHA1ServerSession.fromMessage(message)
         server_resp = server_sess.answer(self.secret)
@@ -1033,6 +1040,12 @@
         self.failUnlessEqual(ret.secret, self.secret)
         self.failUnlessEqual(ret.handle, 'handle')
         self.failUnlessEqual(ret.lifetime, 1000)
+
+    def test_openid2success(self):
+        # Use openid 2 type in endpoint so _setUpDH checks
+        # compatibility mode state properly
+        self.endpoint.type_uris = [OPENID_2_0_TYPE, OPENID_1_1_TYPE]
+        self.test_success()
 
     def test_badAssocType(self):
         sess, server_resp = self._setUpDH()



Mime
View raw message