set denied resp on requests to '/' in tempauth

Change-Id: If2e319561b3d41e09310228792356f38b7958416
This commit is contained in:
David Goetz 2012-03-13 12:01:28 -07:00
parent cb84214b5d
commit a7d2b649d5
2 changed files with 5 additions and 3 deletions

View File

@ -158,7 +158,7 @@ class TempAuth(object):
version, rest = split_path(env.get('PATH_INFO', ''),
1, 2, True)
except ValueError:
return HTTPNotFound()(env, start_response)
version, rest = None, None
if rest and rest.startswith(self.reseller_prefix):
# Handle anonymous access to accounts I'm the definitive
# auth for.

View File

@ -139,9 +139,11 @@ class TestAuth(unittest.TestCase):
ath = auth.filter_factory({'auth_prefix': 'test'})(app)
self.assertEquals(ath.auth_prefix, '/test/')
def test_top_level_ignore(self):
def test_top_level_deny(self):
resp = self._make_request('/').get_response(self.test_auth)
self.assertEquals(resp.status_int, 404)
self.assertEquals(resp.status_int, 401)
self.assertEquals(resp.environ['swift.authorize'],
self.test_auth.denied_response)
def test_anon(self):
resp = \