incubator-heraldry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ket...@apache.org
Subject svn commit: r493315 - in /incubator/heraldry/libraries/python/openid/trunk/openid: consumer/consumer.py consumer/discover.py test/test_consumer.py test/test_discover.py test/test_openidyadis.py
Date Sat, 06 Jan 2007 05:19:25 GMT
Author: keturn
Date: Fri Jan  5 21:19:24 2007
New Revision: 493315

URL: http://svn.apache.org/viewvc?view=rev&rev=493315
Log:
[python-to-heraldry @ Change OpenIDServiceEndpoint.identity_url to .claimed_id]

Original author: cygnus@janrain.com
Date: 2006-12-15 21:44:46+00:00

Modified:
    incubator/heraldry/libraries/python/openid/trunk/openid/consumer/consumer.py
    incubator/heraldry/libraries/python/openid/trunk/openid/consumer/discover.py
    incubator/heraldry/libraries/python/openid/trunk/openid/test/test_consumer.py
    incubator/heraldry/libraries/python/openid/trunk/openid/test/test_discover.py
    incubator/heraldry/libraries/python/openid/trunk/openid/test/test_openidyadis.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=493315&r1=493314&r2=493315
==============================================================================
--- 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:19:24 2007
@@ -490,7 +490,7 @@
         except ValueError:
             return FailureResponse(response.endpoint, 'Malformed nonce')
         if not self.store.useNonce(server_url, timestamp, salt):
-            return FailureResponse(response,
+            return FailureResponse(response.endpoint,
                                    'Nonce missing from store')
 
         # If the nonce check succeeded, return the original success
@@ -620,7 +620,7 @@
             return (
                 (endpoint.server_url == server_url) and
                 # Delegate must be equivalent to the discovered URL.
-                ((endpoint.getServerID() == endpoint.identity_url) or
+                ((endpoint.getServerID() == endpoint.claimed_id) or
                  (endpoint.getServerID() == identifier)))
 
         services = filter(serviceMatches, services)
@@ -930,7 +930,7 @@
         if endpoint is None:
             self.identity_url = None
         else:
-            self.identity_url = endpoint.identity_url
+            self.identity_url = endpoint.claimed_id
 
 class SuccessResponse(Response):
     """A response with a status of SUCCESS. Indicates that this request is a
@@ -956,7 +956,7 @@
         # Don't use setEndpoint, because endpoint should never be None
         # for a successfull transaction.
         self.endpoint = endpoint
-        self.identity_url = endpoint.identity_url
+        self.identity_url = endpoint.claimed_id
 
         self.message = message
 

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/consumer/discover.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/consumer/discover.py?view=diff&rev=493315&r1=493314&r2=493315
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/consumer/discover.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/consumer/discover.py Fri Jan 
5 21:19:24 2007
@@ -47,7 +47,7 @@
             return OPENID_1_0_MESSAGE_NS
 
     def __init__(self):
-        self.identity_url = None
+        self.claimed_id = None
         self.server_url = None
         self.type_uris = []
         self.delegate = None
@@ -70,13 +70,13 @@
             # that's a pathological configuration anyway, so I don't
             # think I care.
             self.delegate = findDelegate(service_element)
-            self.identity_url = yadis_url
+            self.claimed_id = yadis_url
 
     def getServerID(self):
         """Return the identifier that should be sent as the
         openid.identity_url parameter to the server."""
         if self.delegate is None:
-            return self.canonicalID or self.identity_url
+            return self.canonicalID or self.claimed_id
         else:
             return self.delegate
 
@@ -111,7 +111,7 @@
         """
         delegate_url, server_url = parseOpenIDLinkRel(html)
         service = cls()
-        service.identity_url = uri
+        service.claimed_id = uri
         service.delegate = delegate_url
         service.server_url = server_url
         service.type_uris = [OPENID_1_0_TYPE]
@@ -150,7 +150,7 @@
     @param uri: normalized identity URL
     @type uri: str
 
-    @return: (identity_url, services)
+    @return: (claimed_id, services)
     @rtype: (str, list(OpenIDServiceEndpoint))
 
     @raises: DiscoveryFailure
@@ -161,7 +161,7 @@
     # bother to catch it.
     response = yadisDiscover(uri)
 
-    identity_url = response.normalized_uri
+    claimed_id = response.normalized_uri
     try:
         openid_services = extractServices(
             response.normalized_uri, response.response_text,
@@ -184,13 +184,13 @@
         # Try to parse the response as HTML to get OpenID 1.0/1.1
         # <link rel="...">
         try:
-            service = OpenIDServiceEndpoint.fromHTML(identity_url, body)
+            service = OpenIDServiceEndpoint.fromHTML(claimed_id, body)
         except ParseError:
             pass # Parsing failed, so return an empty list
         else:
             openid_services = [service]
 
-    return (identity_url, openid_services)
+    return (claimed_id, openid_services)
 
 def discoverXRI(iname):
     endpoints = []
@@ -218,18 +218,18 @@
         raise DiscoveryFailure(
             'HTTP Response status from identity URL host is not 200. '
             'Got status %r' % (http_resp.status,), http_resp)
-    identity_url = http_resp.final_url
+    claimed_id = http_resp.final_url
 
     # Try to parse the response as HTML to get OpenID 1.0/1.1
     # <link rel="...">
     try:
-        service = OpenIDServiceEndpoint.fromHTML(identity_url, http_resp.body)
+        service = OpenIDServiceEndpoint.fromHTML(claimed_id, http_resp.body)
     except ParseError:
         openid_services = []
     else:
         openid_services = [service]
 
-    return identity_url, openid_services
+    return claimed_id, openid_services
 
 def discover(uri):
     parsed = urlparse.urlparse(uri)
@@ -240,6 +240,6 @@
         uri = 'http://' + uri
     
     uri = normalizeURL(uri)
-    identity_url, openid_services = discoverYadis(uri)
-    identity_url = normalizeURL(identity_url)
-    return identity_url, openid_services
+    claimed_id, openid_services = discoverYadis(uri)
+    claimed_id = normalizeURL(claimed_id)
+    return claimed_id, openid_services

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=493315&r1=493314&r2=493315
==============================================================================
--- 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:19:24 2007
@@ -141,7 +141,7 @@
         mode = 'checkid_setup'
 
     endpoint = OpenIDServiceEndpoint()
-    endpoint.identity_url = user_url
+    endpoint.claimed_id = user_url
     endpoint.server_url = server_url
     endpoint.delegate = delegate_url
 
@@ -267,7 +267,7 @@
         self.consumer = self.consumer_class(self.store)
         self.return_to = "nonny"
         self.endpoint = OpenIDServiceEndpoint()
-        self.endpoint.identity_url = self.consumer_id = "consu"
+        self.endpoint.claimed_id = self.consumer_id = "consu"
         self.endpoint.server_url = self.server_url = "serlie"
         self.endpoint.delegate = self.server_id = "sirod"
 
@@ -335,7 +335,7 @@
         message = Message.fromPostArgs({'openid.mode': 'cancel'})
         r = self.consumer.complete(message, self.endpoint)
         self.failUnlessEqual(r.status, CANCEL)
-        self.failUnless(r.identity_url == self.endpoint.identity_url)
+        self.failUnless(r.identity_url == self.endpoint.claimed_id)
 
     def test_error(self):
         msg = 'an error message'
@@ -344,7 +344,7 @@
                  })
         r = self.consumer.complete(message, self.endpoint)
         self.failUnlessEqual(r.status, FAILURE)
-        self.failUnless(r.identity_url == self.endpoint.identity_url)
+        self.failUnless(r.identity_url == self.endpoint.claimed_id)
         self.failUnlessEqual(r.message, msg)
 
     def test_errorWithNoOptionalKeys(self):
@@ -356,7 +356,7 @@
                  })
         r = self.consumer.complete(message, self.endpoint)
         self.failUnlessEqual(r.status, FAILURE)
-        self.failUnless(r.identity_url == self.endpoint.identity_url)
+        self.failUnless(r.identity_url == self.endpoint.claimed_id)
         self.failUnless(r.contact == contact)
         self.failUnless(r.reference is None)
         self.failUnlessEqual(r.message, msg)
@@ -371,7 +371,7 @@
                  })
         r = self.consumer.complete(message, self.endpoint)
         self.failUnlessEqual(r.status, FAILURE)
-        self.failUnless(r.identity_url == self.endpoint.identity_url)
+        self.failUnless(r.identity_url == self.endpoint.claimed_id)
         self.failUnless(r.contact == contact)
         self.failUnless(r.reference == reference)
         self.failUnlessEqual(r.message, msg)
@@ -380,7 +380,7 @@
         message = Message.fromPostArgs({})
         r = self.consumer.complete(message, self.endpoint)
         self.failUnlessEqual(r.status, FAILURE)
-        self.failUnless(r.identity_url == self.endpoint.identity_url)
+        self.failUnless(r.identity_url == self.endpoint.claimed_id)
 
     def test_idResMissingField(self):
         # XXX - this test is passing, but not necessarily by what it
@@ -437,7 +437,7 @@
     def test_idResMissingNoSigs(self):
         def _vrfy(vid, surl):
             endpoint = OpenIDServiceEndpoint()
-            endpoint.identity_url = vid
+            endpoint.claimed_id = vid
             endpoint.server_url = surl
             endpoint.delegate = vid
             return endpoint
@@ -874,7 +874,7 @@
 
     def test_idpEndpoint(self):
         self.endpoint.delegate = None
-        self.endpoint.identity_url = None
+        self.endpoint.claimed_id = None
         url = self.authreq.redirectURL('http://7.utest/', 'http://7.utest/r')
         _, qstring = url.split('?')
         params = dict(cgi.parse_qsl(qstring))
@@ -882,7 +882,7 @@
 
     def test_idpAnonymous(self):
         self.endpoint.delegate = None
-        self.endpoint.identity_url = None
+        self.endpoint.claimed_id = None
         self.authreq.anonymous = True
         url = self.authreq.redirectURL('http://7.utest/', 'http://7.utest/r')
         self.failUnless(url.find('openid.identity') == -1,
@@ -897,7 +897,7 @@
 class TestSuccessResponse(unittest.TestCase):
     def setUp(self):
         self.endpoint = OpenIDServiceEndpoint()
-        self.endpoint.identity_url = 'identity_url'
+        self.endpoint.claimed_id = 'identity_url'
 
     def test_extensionResponse(self):
         resp = mkSuccess(self.endpoint, {
@@ -1020,7 +1020,7 @@
 class ConsumerTest(unittest.TestCase):
     def setUp(self):
         self.endpoint = OpenIDServiceEndpoint()
-        self.endpoint.identity_url = self.identity_url = 'http://identity.url/'
+        self.endpoint.claimed_id = self.identity_url = 'http://identity.url/'
         self.store = None
         self.session = {}
         self.consumer = Consumer(self.session, self.store)
@@ -1165,7 +1165,7 @@
             })
 
         endpoint = OpenIDServiceEndpoint()
-        endpoint.identity_url = identifier
+        endpoint.claimed_id = identifier
         endpoint.server_url = self.endpoint.server_url
         endpoint.delegate = identifier
         iverified = []
@@ -1226,7 +1226,7 @@
 
     def test_theGoodStuff(self):
         endpoint = OpenIDServiceEndpoint()
-        endpoint.identity_url = self.identifier
+        endpoint.claimed_id = self.identifier
         endpoint.server_url = self.server_url
         endpoint.delegate = self.identifier
         self.services = [endpoint]
@@ -1238,7 +1238,7 @@
     def test_otherServer(self):
         # a set of things without the stuff
         endpoint = OpenIDServiceEndpoint()
-        endpoint.identity_url = self.identifier
+        endpoint.claimed_id = self.identifier
         endpoint.server_url = "http://the-MOON.unittest/"
         endpoint.delegate = self.identifier
         self.services = [endpoint]
@@ -1250,7 +1250,7 @@
     def test_foreignDelegate(self):
         # a set of things with the server stuff but other delegate
         endpoint = OpenIDServiceEndpoint()
-        endpoint.identity_url = self.identifier
+        endpoint.claimed_id = self.identifier
         endpoint.server_url = self.server_url
         endpoint.delegate = "http://unittest/juan-carlos"
         self.failUnlessRaises(DiscoveryFailure,

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/test/test_discover.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/test/test_discover.py?view=diff&rev=493315&r1=493314&r2=493315
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/test/test_discover.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/test/test_discover.py Fri Jan
 5 21:19:24 2007
@@ -322,7 +322,7 @@
                              "http://www.myopenid.com/server")
         self.failUnlessEqual(services[0].delegate,
                              "http://smoker.myopenid.com/")
-        self.failUnlessEqual(services[0].identity_url, self.id_url)
+        self.failUnlessEqual(services[0].claimed_id, self.id_url)
         self._notUsedYadis(services[0])
 
     def test_noOpenID(self):
@@ -363,7 +363,7 @@
                              "http://www.myopenid.com/server")
         self.failUnlessEqual(services[0].delegate,
                              "http://smoker.myopenid.com/")
-        self.failUnlessEqual(services[0].identity_url, expected_final_url)
+        self.failUnlessEqual(services[0].claimed_id, expected_final_url)
         self._notUsedYadis(services[0])
 
     def test_emptyList(self):
@@ -385,7 +385,7 @@
                              "Not one service in %r" % (services,))
         self.failUnlessEqual(services[0].server_url,
                              "http://www.myopenid.com/server")
-        self.failUnlessEqual(services[0].identity_url, self.id_url)
+        self.failUnlessEqual(services[0].claimed_id, self.id_url)
         self._notUsedYadis(services[0])
 
     def test_yadisNoDelegate(self):
@@ -412,7 +412,7 @@
                              "Not 1 service in %r" % (services,))
         self.failUnlessEqual(services[0].server_url,
                              "http://www.myopenid.com/server")
-        self.failUnlessEqual(services[0].identity_url, None)
+        self.failUnlessEqual(services[0].claimed_id, None)
         self.failUnless(services[0].delegate is None,
                         'Delegate should be None. Got %r' %
                         (services[0].delegate,))
@@ -428,7 +428,7 @@
                              "Not 1 service in %r" % (services,))
         self.failUnlessEqual(services[0].server_url,
                              "http://www.myopenid.com/server")
-        self.failUnlessEqual(services[0].identity_url, None)
+        self.failUnlessEqual(services[0].claimed_id, None)
         self.failUnless(services[0].delegate is None,
                         'Delegate should be None. Got %r' %
                         (services[0].delegate,))
@@ -443,7 +443,7 @@
         self.failUnlessEqual(self.id_url, id_url)
         self.failUnlessEqual(services[0].server_url,
                              "http://www.myopenid.com/server")
-        self.failUnlessEqual(services[0].identity_url, self.id_url)
+        self.failUnlessEqual(services[0].claimed_id, self.id_url)
         self.failUnless(services[0].delegate is None,
                         'Delegate should be None. Got %r' %
                         (services[0].delegate,))
@@ -504,7 +504,7 @@
         """When there is no delegate, the CanonicalID should be used with XRI.
         """
         endpoint = discover.OpenIDServiceEndpoint()
-        endpoint.identity_url = "=example"
+        endpoint.claimed_id = "=example"
         endpoint.canonicalID = XRI("=!1000")
         self.failUnlessEqual(endpoint.getServerID(), XRI("=!1000"))
 

Modified: incubator/heraldry/libraries/python/openid/trunk/openid/test/test_openidyadis.py
URL: http://svn.apache.org/viewvc/incubator/heraldry/libraries/python/openid/trunk/openid/test/test_openidyadis.py?view=diff&rev=493315&r1=493314&r2=493315
==============================================================================
--- incubator/heraldry/libraries/python/openid/trunk/openid/test/test_openidyadis.py (original)
+++ incubator/heraldry/libraries/python/openid/trunk/openid/test/test_openidyadis.py Fri Jan
 5 21:19:24 2007
@@ -138,7 +138,7 @@
             seen_uris.append(endpoint.server_url)
 
             # All endpoints will have same yadis_url
-            self.failUnlessEqual(self.yadis_url, endpoint.identity_url)
+            self.failUnlessEqual(self.yadis_url, endpoint.claimed_id)
 
             # and delegate
             self.failUnlessEqual(self.delegate, endpoint.delegate)



Mime
View raw message