]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Always send oauth_version=1.0, even when using 1.0a.
authorBen Darnell <ben@bendarnell.com>
Sun, 14 Apr 2013 19:31:50 +0000 (15:31 -0400)
committerBen Darnell <ben@bendarnell.com>
Sun, 14 Apr 2013 19:31:50 +0000 (15:31 -0400)
This is required by the spec (http://oauth.net/core/1.0/#auth_step1).
Many providers (including Google and Twitter) allow a value of either
1.0 or 1.0a here, but e.g. LinkedIn requires 1.0.

Closes #236.

tornado/auth.py
tornado/test/auth_test.py

index fddbad6cb7f0a0c98442bb715001d317437691c4..df95884b2dafe1f4c36e4b7ad8a3d0a80ad1ed22 100644 (file)
@@ -367,7 +367,7 @@ class OAuthMixin(object):
             oauth_signature_method="HMAC-SHA1",
             oauth_timestamp=str(int(time.time())),
             oauth_nonce=escape.to_basestring(binascii.b2a_hex(uuid.uuid4().bytes)),
-            oauth_version=getattr(self, "_OAUTH_VERSION", "1.0a"),
+            oauth_version="1.0",
         )
         if getattr(self, "_OAUTH_VERSION", "1.0a") == "1.0a":
             if callback_uri == "oob":
@@ -409,7 +409,7 @@ class OAuthMixin(object):
             oauth_signature_method="HMAC-SHA1",
             oauth_timestamp=str(int(time.time())),
             oauth_nonce=escape.to_basestring(binascii.b2a_hex(uuid.uuid4().bytes)),
-            oauth_version=getattr(self, "_OAUTH_VERSION", "1.0a"),
+            oauth_version="1.0",
         )
         if "verifier" in request_token:
             args["oauth_verifier"] = request_token["verifier"]
@@ -488,7 +488,7 @@ class OAuthMixin(object):
             oauth_signature_method="HMAC-SHA1",
             oauth_timestamp=str(int(time.time())),
             oauth_nonce=escape.to_basestring(binascii.b2a_hex(uuid.uuid4().bytes)),
-            oauth_version=getattr(self, "_OAUTH_VERSION", "1.0a"),
+            oauth_version="1.0",
         )
         args = {}
         args.update(base_args)
index dcecfa4cc7a20f0728d3db22b548852a02fa129d..69209da8758f97ef8cdb4935a4272c1d5af3ea93 100644 (file)
@@ -172,7 +172,7 @@ class TwitterServerShowUserHandler(RequestHandler):
         assert 'oauth_signature' in self.request.arguments
         assert self.get_argument('oauth_consumer_key') == 'test_twitter_consumer_key'
         assert self.get_argument('oauth_signature_method') == 'HMAC-SHA1'
-        assert self.get_argument('oauth_version') == '1.0a'
+        assert self.get_argument('oauth_version') == '1.0'
         assert self.get_argument('oauth_token') == 'hjkl'
         self.write(dict(screen_name=screen_name, name=screen_name.capitalize()))