You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2015/02/28 00:19:05 UTC

[10/14] allura git commit: [#7840] ticket:740 Format auth header according to spec

[#7840] ticket:740 Format auth header according to spec


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/862c1850
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/862c1850
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/862c1850

Branch: refs/heads/master
Commit: 862c18502642b099a586d0add28e35ddfe9a2eb4
Parents: 7a934fa
Author: Igor Bondarenko <je...@gmail.com>
Authored: Wed Feb 25 14:21:58 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Fri Feb 27 22:40:53 2015 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/rest.py           | 2 +-
 Allura/allura/tests/functional/test_rest.py | 6 +++---
 AlluraTest/alluratest/controller.py         | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/862c1850/Allura/allura/controllers/rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/rest.py b/Allura/allura/controllers/rest.py
index ab21649..8eafa30 100644
--- a/Allura/allura/controllers/rest.py
+++ b/Allura/allura/controllers/rest.py
@@ -107,7 +107,7 @@ class OAuthNegotiator(object):
         return result
 
     def _authenticate(self):
-        bearer_token_prefix = 'OAuth BearerToken access_token='
+        bearer_token_prefix = 'Bearer '
         auth = request.headers.get('Authorization')
         if auth and auth.startswith(bearer_token_prefix):
             access_token = auth[len(bearer_token_prefix):]

http://git-wip-us.apache.org/repos/asf/allura/blob/862c1850/Allura/allura/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index fca1078..43a92d1 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -92,7 +92,7 @@ class TestRestHome(TestRestApiBase):
     @mock.patch('allura.controllers.rest.request')
     def test_bearer_token_non_bearer_via_headers(self, request, OAuthAccessToken):
         request.headers = {
-            'Authorization': 'OAuth BearerToken access_token=foo'
+            'Authorization': 'Bearer foo'
         }
         request.scheme = 'https'
         self._patch_token(OAuthAccessToken)
@@ -106,7 +106,7 @@ class TestRestHome(TestRestApiBase):
     @mock.patch('allura.controllers.rest.request')
     def test_bearer_token_invalid_via_headers(self, request, OAuthAccessToken):
         request.headers = {
-            'Authorization': 'OAuth BearerToken access_token=foo'
+            'Authorization': 'Bearer foo'
         }
         request.scheme = 'https'
         self._patch_token(OAuthAccessToken)
@@ -138,7 +138,7 @@ class TestRestHome(TestRestApiBase):
         ThreadLocalODMSession.flush_all()
         token = access_token.api_key
         request.headers = {
-            'Authorization': 'OAuth BearerToken access_token={}'.format(token)
+            'Authorization': 'Bearer {}'.format(token)
         }
         request.scheme = 'https'
         r = self.api_post('/rest/p/test/wiki', access_token='foo')

http://git-wip-us.apache.org/repos/asf/allura/blob/862c1850/AlluraTest/alluratest/controller.py
----------------------------------------------------------------------
diff --git a/AlluraTest/alluratest/controller.py b/AlluraTest/alluratest/controller.py
index c64ea5f..0f13c5d 100644
--- a/AlluraTest/alluratest/controller.py
+++ b/AlluraTest/alluratest/controller.py
@@ -224,7 +224,7 @@ class TestRestApiBase(TestController):
 
         token = self.token(user).api_key
         headers = {
-            'Authorization': 'OAuth BearerToken access_token={}'.format(token)
+            'Authorization': 'Bearer {}'.format(token)
         }
 
         fn = getattr(self.app, method.lower())