Merge "Return 403 instead of 401 when policies reject" into milestone-proposed
This commit is contained in:
commit
facd8951f7
|
@ -573,7 +573,7 @@ class ResourceExceptionHandler(object):
|
|||
|
||||
if isinstance(ex_value, exception.NotAuthorized):
|
||||
msg = unicode(ex_value)
|
||||
raise Fault(webob.exc.HTTPUnauthorized(explanation=msg))
|
||||
raise Fault(webob.exc.HTTPForbidden(explanation=msg))
|
||||
elif isinstance(ex_value, TypeError):
|
||||
LOG.exception(ex_value)
|
||||
raise Fault(webob.exc.HTTPBadRequest())
|
||||
|
|
|
@ -174,7 +174,7 @@ class SimpleTenantUsageTest(test.TestCase):
|
|||
try:
|
||||
res = req.get_response(fakes.wsgi_app(
|
||||
fake_auth_context=self.alt_user_context))
|
||||
self.assertEqual(res.status_int, 401)
|
||||
self.assertEqual(res.status_int, 403)
|
||||
finally:
|
||||
policy.reset()
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ class ResourceTest(test.TestCase):
|
|||
req = webob.Request.blank('/tests')
|
||||
app = fakes.TestRouter(Controller())
|
||||
response = req.get_response(app)
|
||||
self.assertEqual(response.status_int, 401)
|
||||
self.assertEqual(response.status_int, 403)
|
||||
|
||||
def test_dispatch(self):
|
||||
class Controller(object):
|
||||
|
|
Loading…
Reference in New Issue